Bug 17913: Use replace_with instead of insert_grouped_field
authorFrédéric Demians <f.demians@tamil.fr>
Mon, 3 Jan 2011 14:32:21 +0000 (16:32 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 20 Jan 2017 13:55:10 +0000 (13:55 +0000)
Original fix from a patch on bug 5572.
Amended by Marcel de Rooy January 2017.

Note: This does not yet resolve the field order when merging to another
auth type, but is a good start.

Test plan:
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: Julian Maurice <julian.maurice@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

C4/AuthoritiesMarc.pm

index e14c85f..9840d60 100644 (file)
@@ -1494,8 +1494,7 @@ sub merge {
                 foreach my $subfield (@restore) {
                    $field_to->add_subfields($subfield->[0] =>$subfield->[1]);
                }
-                $marcrecord->delete_field($field);
-                $marcrecord->insert_grouped_field($field_to);            
+            $field->replace_with($field_to);
                 $update=1;
                 }
             }#for each tag