From e4619bebe79637565cb4245333cb8d129f45f9e5 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 23 Feb 2017 11:53:44 +0100 Subject: [PATCH] Bug 9988: Fix a small last minute bug in merge Content-Type: text/plain; charset=utf-8 When you postpone an 'authtype crossing' authority merge from A to B, the record for A will be deleted. In that case the condition for tags_new in sub merge does not work well. We should allow an empty authtypefrom here in order to get a new field belonging to authority B. Simply put, if we go from PERSO to CORPO, all linked records should go from X00 to X10 etc. Test plan: [1] Run Merge.t [2] Select two authorities of different type with linked records. [3] Set AuthorityMergeLimit to zero. And merge both auth records. Note: Do not select Default. See also bug 17380. [4] Run the cron job and check the linked records (especially the ones that were linked to the deleted record). Signed-off-by: Marcel de Rooy --- C4/AuthoritiesMarc.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index c196883..c2609a9 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1443,7 +1443,7 @@ sub merge { my $sql = "SELECT DISTINCT tagfield FROM marc_subfield_structure WHERE authtypecode=?"; my $tags_using_authtype = $authtypefrom ? $dbh->selectcol_arrayref( $sql, undef, ( $authtypefrom->authtypecode )) : $dbh->selectcol_arrayref( "SELECT DISTINCT tagfield FROM marc_subfield_structure WHERE authtypecode IS NOT NULL AND authtypecode<>''" ); my $tags_new; - if( $authtypefrom && $authtypeto && $authtypeto->authtypecode ne $authtypefrom->authtypecode ) { + if( $authtypeto && ( !$authtypefrom || $authtypeto->authtypecode ne $authtypefrom->authtypecode )) { $tags_new = $dbh->selectcol_arrayref( $sql, undef, ( $authtypeto->authtypecode )); } -- 2.1.4