Lines 1518-1523
sub merge {
Link Here
|
1518 |
my $auth_number=$field->subfield("9"); |
1518 |
my $auth_number=$field->subfield("9"); |
1519 |
my $tag=$field->tag(); |
1519 |
my $tag=$field->tag(); |
1520 |
if ($auth_number==$mergefrom) { |
1520 |
if ($auth_number==$mergefrom) { |
|
|
1521 |
# If merging distinct authorities, |
1522 |
# look if field to add already exists in the record |
1523 |
# in order to avoid a duplicate. |
1524 |
my $field_to_exists; |
1525 |
if ( $mergefrom != $mergeto ) { |
1526 |
foreach ( $marcrecord->field( $tag_to ? $tag_to : $tag ) ) { |
1527 |
if ( $_->subfield('9') && $_->subfield('9') == $mergeto ) { |
1528 |
$field_to_exists = 1; |
1529 |
last; |
1530 |
} |
1531 |
} |
1532 |
} |
1533 |
# Go editing |
1534 |
$marcrecord->delete_field($field); |
1535 |
unless ($field_to_exists) { |
1521 |
my $field_to=MARC::Field->new(($tag_to?$tag_to:$tag),$field->indicator(1),$field->indicator(2),"9"=>$mergeto); |
1536 |
my $field_to=MARC::Field->new(($tag_to?$tag_to:$tag),$field->indicator(1),$field->indicator(2),"9"=>$mergeto); |
1522 |
my $exclude='9'; |
1537 |
my $exclude='9'; |
1523 |
foreach my $subfield (grep {$_->[0] ne '9'} @record_to) { |
1538 |
foreach my $subfield (grep {$_->[0] ne '9'} @record_to) { |
Lines 1530-1537
sub merge {
Link Here
|
1530 |
foreach my $subfield (@restore) { |
1545 |
foreach my $subfield (@restore) { |
1531 |
$field_to->add_subfields($subfield->[0] =>$subfield->[1]); |
1546 |
$field_to->add_subfields($subfield->[0] =>$subfield->[1]); |
1532 |
} |
1547 |
} |
1533 |
$marcrecord->delete_field($field); |
1548 |
$marcrecord->insert_grouped_field($field_to); |
1534 |
$marcrecord->insert_grouped_field($field_to); |
1549 |
} |
1535 |
$update=1; |
1550 |
$update=1; |
1536 |
} |
1551 |
} |
1537 |
}#for each tag |
1552 |
}#for each tag |
1538 |
- |
|
|