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 <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Frédérick 2013-11-27 12:30:55 -05:00 committed by Kyle M Hall
parent ffe1f6555c
commit 79c81920ab
1 changed files with 2 additions and 1 deletions

View File

@ -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]);
}