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@equinoxinitiative.org>
Signed-off-by: Cesar Velez <cesar.velez@equinoxinitiative.org>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
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;
moved_objects := moved_objects + 1;
END LOOP;
+
+ UPDATE asset.call_number SET deleted = TRUE WHERE id = source_cn.id;
-- ... if not ...
ELSE