From e9c0a11d41f107425d7f53dcc09e57e3e00ee608 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 30 Sep 2010 08:03:16 +0000 Subject: [PATCH] Bug 5264 (Retain additional bibliographic subfields when merging authorities) [for master only] The current code in AuthoritiesMarc.pm rewrites all subfields from the report tag in the authority record to fields in related bibliographic records when merging authorities. Additional subfields in the biblio records (e.g. relator code or term) are lost in the process. This patch retains the original algorithm but restores the additional subfields from the original biblio record when rewriting the linked marc fields. The problem also exists in 3.0. Two separate patches have been submitted. Signed-off-by: Galen Charlton --- C4/AuthoritiesMarc.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index f6c9d35d77..b4a0d786a8 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -1327,9 +1327,17 @@ sub merge { my $tag=$field->tag(); if ($auth_number==$mergefrom) { my $field_to=MARC::Field->new(($tag_to?$tag_to:$tag),$field->indicator(1),$field->indicator(2),"9"=>$mergeto); + my $exclude='9'; foreach my $subfield (@record_to) { $field_to->add_subfields($subfield->[0] =>$subfield->[1]); + $exclude.= $subfield->[0]; } + $exclude='['.$exclude.']'; +# add subfields in $field not included in @record_to + my @restore= grep {$_->[0]!~/$exclude/} $field->subfields(); + foreach my $subfield (@restore) { + $field_to->add_subfields($subfield->[0] =>$subfield->[1]); + } $marcrecord->delete_field($field); $marcrecord->insert_grouped_field($field_to); $update=1; -- 2.39.5