From 79c81920abe7f6821d49834e71a5c1649f2f615e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9rick?= Date: Wed, 27 Nov 2013 12:30:55 -0500 Subject: [PATCH] Bug 17913: Use AuthorityMergeMode pref in sub merge Original fix from a patch on bug 11315. Amended by Marcel de Rooy January 2017. Test plan: If you set mode to loose, the test will still pass. If you set mode to strict, one test will fail. (Fixed later.) Signed-off-by: Marcel de Rooy Signed-off-by: Josef Moravec Signed-off-by: Julian Maurice Signed-off-by: Kyle M Hall --- C4/AuthoritiesMarc.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index 9840d6041e..131bc07f5c 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1473,6 +1473,7 @@ sub merge { } # BulkEdit marc records # May be used as a template for a bulkedit field + my $overwrite = C4::Context->preference( 'AuthorityMergeMode' ) eq 'strict'; foreach my $marcrecord(@reccache){ my $update = 0; foreach my $tagfield (@tags_using_authtype){ @@ -1490,7 +1491,7 @@ sub merge { } $exclude='['.$exclude.']'; # add subfields in $field not included in @record_to - my @restore= grep {$_->[0]!~/$exclude/} $field->subfields(); + my @restore= $overwrite ? () : grep {$_->[0]!~/$exclude/} $field->subfields(); foreach my $subfield (@restore) { $field_to->add_subfields($subfield->[0] =>$subfield->[1]); } -- 2.39.5