Bug 17380: Graceful resolution of missing reporting tag in merge
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 4 Jul 2017 12:31:21 +0000 (14:31 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 12 Sep 2017 15:07:47 +0000 (12:07 -0300)
commit434162c1756b16b5fc715fd1cb762aaf8aff7b2b
treef2eb54af0294adaac1e502372e211a941327d600
parentdb35492c795540d6c3b10f7cba18698aeb84a816
Bug 17380: Graceful resolution of missing reporting tag in merge

Altough this patch deals with a mostly hypothetical case and this report
makes it practically impossible anymore to merge with records in the
Default framework (having no reporting tag), we can make the code of
sub merge still a bit more robust here.

If you would merge biblio records from one authtype to another and the new
framework would not have a reporting tag, before this patch the result would
be data loss. Merge would handle this request as a delete. This patch makes
merge handle it differently: instead of clearing the biblio records, it
keeps $a and $9 in order to make a future corrective merge possible.

Note: The additional condition on line 1468 for $tags_using_authtype
makes sure that we do not select all fields when the authtype should
unexpectedly be empty string (Default). This prevents crashing on
a "Control fields do not have subfields" error.

Test plan:
[1] Run t/db_dependent/Authorities/Merge.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/AuthoritiesMarc.pm
t/db_dependent/Authority/Merge.t