[open-ils-commits] [GIT] Evergreen ILS branch master updated. ba3b6e832cf631fb8a114d985402c8f6d43f32d8
Evergreen Git
git at git.evergreen-ils.org
Tue Nov 7 15:32:58 EST 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via ba3b6e832cf631fb8a114d985402c8f6d43f32d8 (commit)
via 0ee3e8acd2c6c8698f982396ecf206ebd629132e (commit)
via 2ccdbe6d9ac0da150be426e517e4ca23c0d0a045 (commit)
via d2c8443068061879747750df023ff7cf4631425d (commit)
from 73a18745da1e0a6340e84233d57f4bb42ec66d37 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ba3b6e832cf631fb8a114d985402c8f6d43f32d8
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Tue Nov 7 15:41:59 2017 -0500
LP#1145213: add schema update
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index 6ef08e2..22eae9c 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1078', :eg_version); -- csharp/bshum/gmcharlt
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1079', :eg_version); -- rhamby/cesardv/gmcharlt
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/1079.schema.fix_asset_merge.sql b/Open-ILS/src/sql/Pg/upgrade/1079.schema.fix_asset_merge.sql
new file mode 100644
index 0000000..0f82c96
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/1079.schema.fix_asset_merge.sql
@@ -0,0 +1,263 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('1079', :eg_version); -- rhamby/cesardv/gmcharlt
+
+CREATE OR REPLACE FUNCTION asset.merge_record_assets( target_record BIGINT, source_record BIGINT ) RETURNS INT AS $func$
+DECLARE
+ moved_objects INT := 0;
+ source_cn asset.call_number%ROWTYPE;
+ target_cn asset.call_number%ROWTYPE;
+ metarec metabib.metarecord%ROWTYPE;
+ hold action.hold_request%ROWTYPE;
+ ser_rec serial.record_entry%ROWTYPE;
+ ser_sub serial.subscription%ROWTYPE;
+ acq_lineitem acq.lineitem%ROWTYPE;
+ acq_request acq.user_request%ROWTYPE;
+ booking booking.resource_type%ROWTYPE;
+ source_part biblio.monograph_part%ROWTYPE;
+ target_part biblio.monograph_part%ROWTYPE;
+ multi_home biblio.peer_bib_copy_map%ROWTYPE;
+ uri_count INT := 0;
+ counter INT := 0;
+ uri_datafield TEXT;
+ uri_text TEXT := '';
+BEGIN
+
+ -- move any 856 entries on records that have at least one MARC-mapped URI entry
+ SELECT INTO uri_count COUNT(*)
+ FROM asset.uri_call_number_map m
+ JOIN asset.call_number cn ON (m.call_number = cn.id)
+ WHERE cn.record = source_record;
+
+ IF uri_count > 0 THEN
+
+ -- This returns more nodes than you might expect:
+ -- 7 instead of 1 for an 856 with $u $y $9
+ SELECT COUNT(*) INTO counter
+ FROM oils_xpath_table(
+ 'id',
+ 'marc',
+ 'biblio.record_entry',
+ '//*[@tag="856"]',
+ 'id=' || source_record
+ ) as t(i int,c text);
+
+ FOR i IN 1 .. counter LOOP
+ SELECT '<datafield xmlns="http://www.loc.gov/MARC21/slim"' ||
+ ' tag="856"' ||
+ ' ind1="' || FIRST(ind1) || '"' ||
+ ' ind2="' || FIRST(ind2) || '">' ||
+ STRING_AGG(
+ '<subfield code="' || subfield || '">' ||
+ regexp_replace(
+ regexp_replace(
+ regexp_replace(data,'&','&','g'),
+ '>', '>', 'g'
+ ),
+ '<', '<', 'g'
+ ) || '</subfield>', ''
+ ) || '</datafield>' INTO uri_datafield
+ FROM oils_xpath_table(
+ 'id',
+ 'marc',
+ 'biblio.record_entry',
+ '//*[@tag="856"][position()=' || i || ']/@ind1|' ||
+ '//*[@tag="856"][position()=' || i || ']/@ind2|' ||
+ '//*[@tag="856"][position()=' || i || ']/*/@code|' ||
+ '//*[@tag="856"][position()=' || i || ']/*[@code]',
+ 'id=' || source_record
+ ) as t(id int,ind1 text, ind2 text,subfield text,data text);
+
+ -- As most of the results will be NULL, protect against NULLifying
+ -- the valid content that we do generate
+ uri_text := uri_text || COALESCE(uri_datafield, '');
+ END LOOP;
+
+ IF uri_text <> '' THEN
+ UPDATE biblio.record_entry
+ SET marc = regexp_replace(marc,'(</[^>]*record>)', uri_text || E'\\1')
+ WHERE id = target_record;
+ END IF;
+
+ END IF;
+
+ -- Find and move metarecords to the target record
+ SELECT INTO metarec *
+ FROM metabib.metarecord
+ WHERE master_record = source_record;
+
+ IF FOUND THEN
+ UPDATE metabib.metarecord
+ SET master_record = target_record,
+ mods = NULL
+ WHERE id = metarec.id;
+
+ moved_objects := moved_objects + 1;
+ END IF;
+
+ -- Find call numbers attached to the source ...
+ FOR source_cn IN SELECT * FROM asset.call_number WHERE record = source_record LOOP
+
+ SELECT INTO target_cn *
+ FROM asset.call_number
+ WHERE label = source_cn.label
+ AND prefix = source_cn.prefix
+ AND suffix = source_cn.suffix
+ AND owning_lib = source_cn.owning_lib
+ AND record = target_record
+ AND NOT deleted;
+
+ -- ... and if there's a conflicting one on the target ...
+ IF FOUND THEN
+
+ -- ... move the copies to that, and ...
+ UPDATE asset.copy
+ SET call_number = target_cn.id
+ WHERE call_number = source_cn.id;
+
+ -- ... move V holds to the move-target call number
+ FOR hold IN SELECT * FROM action.hold_request WHERE target = source_cn.id AND hold_type = 'V' LOOP
+
+ UPDATE action.hold_request
+ SET target = target_cn.id
+ WHERE id = hold.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ UPDATE asset.call_number SET deleted = TRUE WHERE id = source_cn.id;
+
+ -- ... if not ...
+ ELSE
+ -- ... just move the call number to the target record
+ UPDATE asset.call_number
+ SET record = target_record
+ WHERE id = source_cn.id;
+ END IF;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- Find T holds targeting the source record ...
+ FOR hold IN SELECT * FROM action.hold_request WHERE target = source_record AND hold_type = 'T' LOOP
+
+ -- ... and move them to the target record
+ UPDATE action.hold_request
+ SET target = target_record
+ WHERE id = hold.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- Find serial records targeting the source record ...
+ FOR ser_rec IN SELECT * FROM serial.record_entry WHERE record = source_record LOOP
+ -- ... and move them to the target record
+ UPDATE serial.record_entry
+ SET record = target_record
+ WHERE id = ser_rec.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- Find serial subscriptions targeting the source record ...
+ FOR ser_sub IN SELECT * FROM serial.subscription WHERE record_entry = source_record LOOP
+ -- ... and move them to the target record
+ UPDATE serial.subscription
+ SET record_entry = target_record
+ WHERE id = ser_sub.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- Find booking resource types targeting the source record ...
+ FOR booking IN SELECT * FROM booking.resource_type WHERE record = source_record LOOP
+ -- ... and move them to the target record
+ UPDATE booking.resource_type
+ SET record = target_record
+ WHERE id = booking.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- Find acq lineitems targeting the source record ...
+ FOR acq_lineitem IN SELECT * FROM acq.lineitem WHERE eg_bib_id = source_record LOOP
+ -- ... and move them to the target record
+ UPDATE acq.lineitem
+ SET eg_bib_id = target_record
+ WHERE id = acq_lineitem.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- Find acq user purchase requests targeting the source record ...
+ FOR acq_request IN SELECT * FROM acq.user_request WHERE eg_bib = source_record LOOP
+ -- ... and move them to the target record
+ UPDATE acq.user_request
+ SET eg_bib = target_record
+ WHERE id = acq_request.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- Find parts attached to the source ...
+ FOR source_part IN SELECT * FROM biblio.monograph_part WHERE record = source_record LOOP
+
+ SELECT INTO target_part *
+ FROM biblio.monograph_part
+ WHERE label = source_part.label
+ AND record = target_record;
+
+ -- ... and if there's a conflicting one on the target ...
+ IF FOUND THEN
+
+ -- ... move the copy-part maps to that, and ...
+ UPDATE asset.copy_part_map
+ SET part = target_part.id
+ WHERE part = source_part.id;
+
+ -- ... move P holds to the move-target part
+ FOR hold IN SELECT * FROM action.hold_request WHERE target = source_part.id AND hold_type = 'P' LOOP
+
+ UPDATE action.hold_request
+ SET target = target_part.id
+ WHERE id = hold.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- ... if not ...
+ ELSE
+ -- ... just move the part to the target record
+ UPDATE biblio.monograph_part
+ SET record = target_record
+ WHERE id = source_part.id;
+ END IF;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- Find multi_home items attached to the source ...
+ FOR multi_home IN SELECT * FROM biblio.peer_bib_copy_map WHERE peer_record = source_record LOOP
+ -- ... and move them to the target record
+ UPDATE biblio.peer_bib_copy_map
+ SET peer_record = target_record
+ WHERE id = multi_home.id;
+
+ moved_objects := moved_objects + 1;
+ END LOOP;
+
+ -- And delete mappings where the item's home bib was merged with the peer bib
+ DELETE FROM biblio.peer_bib_copy_map WHERE peer_record = (
+ SELECT (SELECT record FROM asset.call_number WHERE id = call_number)
+ FROM asset.copy WHERE id = target_copy
+ );
+
+ -- Finally, "delete" the source record
+ DELETE FROM biblio.record_entry WHERE id = source_record;
+
+ -- That's all, folks!
+ RETURN moved_objects;
+END;
+$func$ LANGUAGE plpgsql;
+
+COMMIT;
commit 0ee3e8acd2c6c8698f982396ecf206ebd629132e
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Tue Nov 7 15:21:57 2017 -0500
LP#1145213: fix some typos
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/t/lp1145213_test_func_asset.merge_record_assets.pg b/Open-ILS/src/sql/Pg/t/lp1145213_test_func_asset.merge_record_assets.pg
index c49b3a4..c6adcb3 100644
--- a/Open-ILS/src/sql/Pg/t/lp1145213_test_func_asset.merge_record_assets.pg
+++ b/Open-ILS/src/sql/Pg/t/lp1145213_test_func_asset.merge_record_assets.pg
@@ -78,14 +78,14 @@ SELECT is(
SELECT is(
(SELECT count(*) FROM asset.call_number WHERE record=60001 AND not deleted=true)::INT,
0::INT,
- 'LP 1145213 asset.merge_record_assets() all call_numbers should point to bib rec #60,000 '
+ 'LP 1145213 asset.merge_record_assets() all call_numbers should point to bib record #60,000 '
);
-- test copies to make sure none point to stale acn
SELECT is(
(SELECT count(*) from asset.copy where call_number=1000002)::INT,
0::INT,
- 'LP 1145213 asset.merge_record_assets() all copies should point to acn #999999 which is for bibre #60,000 '
+ 'LP 1145213 asset.merge_record_assets() all copies should point to acn #999999 which is for bib record #60,000 '
);
SELECT * FROM finish();
commit 2ccdbe6d9ac0da150be426e517e4ca23c0d0a045
Author: Cesar Velez <cesar.velez at equinoxinitiative.org>
Date: Fri Sep 1 10:29:36 2017 -0400
LP#1145213: add pgTAP test
This tests the changes to the asset.merge_record_assets() function.
Signed-off-by: Cesar Velez <cesar.velez at equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/t/lp1145213_test_func_asset.merge_record_assets.pg b/Open-ILS/src/sql/Pg/t/lp1145213_test_func_asset.merge_record_assets.pg
new file mode 100644
index 0000000..c49b3a4
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/t/lp1145213_test_func_asset.merge_record_assets.pg
@@ -0,0 +1,94 @@
+BEGIN;
+
+SELECT plan(5);
+
+----------------------------------
+--
+-- Setup Test environment and data
+--
+----------------------------------
+
+-- create mock bib records to be merged:
+-- Data:
+-- bib 60000 (new lead), org 4 acn 'F Cline' copy 1
+-- bib 60001 (merged from target), org 5 acn 'JF cline' copy 2, org 6 acn 'JF Cline' copy 3, org 4 acn 'F Cline' copy 4
+--
+-- copy 2 ACN
+
+-- create bib 60,000
+INSERT into biblio.record_entry (id, marc, last_xact_id)
+ VALUES (60000,
+ $$
+ <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"><leader>00934njm a2200241 a 4500</leader><controlfield tag="001">03-0003745</controlfield><controlfield tag="005">19991118131708.0</controlfield><controlfield tag="008">971016n nyuuuu eng </controlfield><datafield tag="050" ind1=" " ind2=" "><subfield code="a">4539</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Bartók, Béla,</subfield><subfield code="d">1881-1945.</subfield></datafield><datafield tag="240" ind1=" " ind2=" "><subfield code="t">Concertos,</subfield><subfield code="m">piano,</subfield><subfield code="n">no. 1,</subfield><subfield code="n">Sz. 83</subfield><subfield code="f">(1926) </subfield><subfield code="a">Concertos,</subfield><subfield code="m">piano,</subfield><subfield code="n">no. 1,</subfield><subfie
ld code="n">Sz. 83,</subfield><subfield code="n">(1926)</subfield></datafield><datafield tag="245" ind1=" " ind2=" "><subfield code="a">Piano concerto no. 1 (1926) ; Rhapsody, op. 1 (1904)</subfield></datafield><datafield tag="260" ind1=" " ind2=" "><subfield code="a">New York, NY :</subfield><subfield code="b">Vox</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">1 sound disc :</subfield><subfield code="b">33 1/3 rpm, stereo.</subfield></datafield><datafield tag="349" ind1=" " ind2=" "><subfield code="a">PHONO RECORD</subfield></datafield><datafield tag="511" ind1=" " ind2=" "><subfield code="a">György Sándor, piano ; Sudwest[rund]funkorchester, Baden-Baden ; Rolf Reinhardt, conductor.</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Sándor, György,</subfield><subfield code="d">1912-</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Reinhardt, Rolf</subfield></data
field><datafield tag="710" ind1=" " ind2=" "><subfield code="a">Sudwestrundfunkorchester (Baden-Baden, Germany)</subfield></datafield><datafield tag="730" ind1=" " ind2=" "><subfield code="a">Rhapsodies,</subfield><subfield code="m">piano, orchestra,</subfield><subfield code="n">op. 1,</subfield><subfield code="n">Sz. 27,</subfield><subfield code="n">(1904)</subfield></datafield><datafield tag="901" ind1=" " ind2=" "><subfield code="a">a339398</subfield><subfield code="b">Sirsi_Auto</subfield><subfield code="c">339398</subfield></datafield></record>
+ $$,
+ 'PGTAP'
+ );
+
+
+-- create bib 60,001
+INSERT into biblio.record_entry (id, marc, last_xact_id)
+ VALUES (60001,
+ $$
+ <record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd" xmlns="http://www.loc.gov/MARC21/slim"><leader>00863njm a2200253 a 4500</leader><controlfield tag="001">03-0004689</controlfield><controlfield tag="005">19991127191346.0</controlfield><controlfield tag="008">971027r19631952nyuuuu eng </controlfield><datafield tag="050" ind1=" " ind2=" "><subfield code="a">4578</subfield></datafield><datafield tag="100" ind1="1" ind2=" "><subfield code="a">Telemann, Georg Philipp,</subfield><subfield code="d">1681-1767</subfield></datafield><datafield tag="245" ind1=" " ind2=" "><subfield code="a">Viola concerto in G major</subfield></datafield><datafield tag="260" ind1=" " ind2=" "><subfield code="a">New York, NY :</subfield><subfield code="b">Vox,</subfield><subfield code="c">1963</subfield></datafield><datafield tag="300" ind1=" " ind2=" "><subfield code="a">1 sound d
isc :</subfield><subfield code="b">33 1/3 rpm, mono.</subfield></datafield><datafield tag="349" ind1=" " ind2=" "><subfield code="a">PHONO RECORD</subfield></datafield><datafield tag="505" ind1=" " ind2=" "><subfield code="a">Viola concerto / Telemann -- Viola concerto in D major / Stamitz.</subfield></datafield><datafield tag="511" ind1=" " ind2=" "><subfield code="a">Heinz Wigand, viola ; Pro Musica Orchestra, Stuttgart ; Rolf Reinhardt, conductor.</subfield></datafield><datafield tag="650" ind1=" " ind2="0"><subfield code="a">Concertos (Viola)</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Stamitz, Carl,</subfield><subfield code="d">1745-1801</subfield></datafield><datafield tag="700" ind1="1" ind2=" "><subfield code="a">Reinhardt, Rolf</subfield></datafield><datafield tag="700" ind1=" " ind2=" "><subfield code="a">Wigand, Heinz</subfield></datafield><datafield tag="710" ind1="2" ind2=" "><subfield code="a">Pro Musica Orchestra (Stuttgart)
</subfield></datafield><datafield tag="901" ind1=" " ind2=" "><subfield code="a">a340312</subfield><subfield code="b">Sirsi_Auto</subfield><subfield code="c">340312</subfield></datafield></record>
+ $$,
+ 'PGTAP'
+ );
+
+
+INSERT into asset.call_number(id, record, creator, editor, owning_lib, label, label_class, prefix)
+ VALUES (999999, 60000, 1, 1, 4, 'Cline', 1, 9986),
+ (1000000,60001, 1, 1, 5, 'Cline', 1, 9987),
+ (1000001,60001, 1, 1, 6, 'Cline', 1, 9988),
+ (1000002,60001, 1, 1, 4, 'Cline', 1, 9986);
+
+INSERT into asset.call_number_prefix(id, owning_lib, label) VALUES
+ (9986, 4, 'F'),
+ (9987, 5, 'F'),
+ (9988, 6, 'JF');
+
+-- circ_lib for copy == the same as acn
+INSERT INTO asset.copy(id, circ_lib, creator, call_number, editor, copy_number, loan_duration, fine_level, barcode) VALUES
+ (905555, 4, 1, 999999, 1, 1, 1, 1, '1copycopycopy'),
+ (906666, 5, 1, 1000000, 1, 1, 1, 1, '2copycopycopy'),
+ (907777, 6, 1, 1000001, 1, 1, 1, 1, '3copycopycopy'),
+ (908888, 4, 1, 1000002, 1, 1, 1, 1, '4copycopycopy');
+
+-----------------------------------
+-- Test asset.merge_record_assets()
+-----------------------------------
+
+-- do merge
+SELECT is(asset.merge_record_assets(60000, 60001), 4, 'Record assets merged!');
+
+-- check if copy 4's acn was updated
+SELECT is(
+ (SELECT call_number from asset.copy where id=908888)::BIGINT,
+ 999999::BIGINT,
+ 'LP 1145213 asset.merge_record_assets() messing up call numbers. copy 4 should have acn -> 999999'
+);
+
+-- acn #1,000,002 should be deleted
+SELECT is(
+ (SELECT deleted FROM asset.call_number WHERE id=1000002)::BOOLEAN,
+ TRUE,
+ 'LP 1145213 asset.merge_record_assets() should have deleted acn #1000002'
+);
+
+-- all non-deleted acn should point to source bib record #60,000
+SELECT is(
+ (SELECT count(*) FROM asset.call_number WHERE record=60001 AND not deleted=true)::INT,
+ 0::INT,
+ 'LP 1145213 asset.merge_record_assets() all call_numbers should point to bib rec #60,000 '
+);
+
+-- test copies to make sure none point to stale acn
+SELECT is(
+ (SELECT count(*) from asset.copy where call_number=1000002)::INT,
+ 0::INT,
+ 'LP 1145213 asset.merge_record_assets() all copies should point to acn #999999 which is for bibre #60,000 '
+);
+
+SELECT * FROM finish();
+
+ROLLBACK;
+
commit d2c8443068061879747750df023ff7cf4631425d
Author: Rogan Hamby <rogan.hamby at gmail.com>
Date: Wed Aug 9 08:50:41 2017 -0400
LP#1145213: improvements to record merge
This patch checks for suffix and prefix of call number before merging
assets and ensures that unused call number records are marked
deleted.
To test:
[0] Apply the patch.
[1] Attempt a record merge where each record has a volumes with the
same call number label and owning library but different
affixes. Verify that the volumes and their associated copies
are not merged onto the same volume..
[2] Attempt a merge with records having matching volumes. Verify
that the copies are moved to one volume and that the other is
marked deleted.
Signed-off-by: Rogan Hamby <rhamby at equinoxinitiative.org>
Signed-off-by: Cesar Velez <cesar.velez at equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/999.functions.global.sql b/Open-ILS/src/sql/Pg/999.functions.global.sql
index a42bf69..dc72926 100644
--- a/Open-ILS/src/sql/Pg/999.functions.global.sql
+++ b/Open-ILS/src/sql/Pg/999.functions.global.sql
@@ -1061,6 +1061,8 @@ BEGIN
SELECT INTO target_cn *
FROM asset.call_number
WHERE label = source_cn.label
+ AND prefix = source_cn.prefix
+ AND suffix = source_cn.suffix
AND owning_lib = source_cn.owning_lib
AND record = target_record
AND NOT deleted;
@@ -1082,6 +1084,8 @@ BEGIN
moved_objects := moved_objects + 1;
END LOOP;
+
+ UPDATE asset.call_number SET deleted = TRUE WHERE id = source_cn.id;
-- ... if not ...
ELSE
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/999.functions.global.sql | 4 +
...p1145213_test_func_asset.merge_record_assets.pg | 94 ++++++++++++++++++++
...numbers.sql => 1079.schema.fix_asset_merge.sql} | 27 +++---
4 files changed, 112 insertions(+), 15 deletions(-)
create mode 100644 Open-ILS/src/sql/Pg/t/lp1145213_test_func_asset.merge_record_assets.pg
copy Open-ILS/src/sql/Pg/upgrade/{0761.function.merge_record_assets_deleted_call_numbers.sql => 1079.schema.fix_asset_merge.sql} (91%)
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list