|
Lines 1447-1454
sub merge {
Link Here
|
| 1447 |
# We only need it in loose merge mode; replaces the former $exclude |
1447 |
# We only need it in loose merge mode; replaces the former $exclude |
| 1448 |
? {} |
1448 |
? {} |
| 1449 |
: { map { ( $_->[0], 1 ); } ( @record_from, @record_to ) }; |
1449 |
: { map { ( $_->[0], 1 ); } ( @record_from, @record_to ) }; |
| 1450 |
# And we need to add $9 in order not to duplicate |
|
|
| 1451 |
$skip_subfields->{9} = 1 if !$overwrite; |
| 1452 |
|
1450 |
|
| 1453 |
my $counteditedbiblio = 0; |
1451 |
my $counteditedbiblio = 0; |
| 1454 |
foreach my $biblionumber ( @biblionumbers ) { |
1452 |
foreach my $biblionumber ( @biblionumbers ) { |
|
Lines 1477-1494
sub merge {
Link Here
|
| 1477 |
$newtag, |
1475 |
$newtag, |
| 1478 |
$field->indicator(1), |
1476 |
$field->indicator(1), |
| 1479 |
$field->indicator(2), |
1477 |
$field->indicator(2), |
| 1480 |
"9" => $mergeto, |
1478 |
9 => $mergeto, # Needed to create field, will be moved |
| 1481 |
); |
1479 |
); |
| 1482 |
foreach my $subfield ( grep { $_->[0] ne '9' } @record_to ) { |
1480 |
my ( @prefix, @postfix ); |
| 1483 |
$field_to->add_subfields( $subfield->[0] => $subfield->[1] ); |
|
|
| 1484 |
} |
| 1485 |
if ( !$overwrite ) { |
1481 |
if ( !$overwrite ) { |
| 1486 |
# add subfields back in loose mode, check skip_subfields |
1482 |
# add subfields back in loose mode, check skip_subfields |
|
|
1483 |
# The first extra subfields will be in front of the |
| 1484 |
# controlled block, the rest at the end. |
| 1485 |
my $prefix_flag = 1; |
| 1487 |
foreach my $subfield ( $field->subfields ) { |
1486 |
foreach my $subfield ( $field->subfields ) { |
| 1488 |
next if $skip_subfields->{ $subfield->[0] }; |
1487 |
next if $subfield->[0] eq '9'; # skip but leave flag |
| 1489 |
$field_to->add_subfields( $subfield->[0], $subfield->[1] ); |
1488 |
if ( $skip_subfields->{ $subfield->[0] } ) { |
|
|
1489 |
# This marks the beginning of the controlled block |
| 1490 |
$prefix_flag = 0; |
| 1491 |
next; |
| 1492 |
} |
| 1493 |
if ($prefix_flag) { |
| 1494 |
push @prefix, [ $subfield->[0], $subfield->[1] ]; |
| 1495 |
} else { |
| 1496 |
push @postfix, [ $subfield->[0], $subfield->[1] ]; |
| 1497 |
} |
| 1490 |
} |
1498 |
} |
| 1491 |
} |
1499 |
} |
|
|
1500 |
foreach my $subfield ( @prefix, @record_to, @postfix ) { |
| 1501 |
$field_to->add_subfields($subfield->[0] => $subfield->[1]); |
| 1502 |
} |
| 1503 |
# Move $9 to the end |
| 1504 |
$field_to->delete_subfield( code => '9' ); |
| 1505 |
$field_to->add_subfields( 9 => $mergeto ); |
| 1506 |
|
| 1492 |
if ($tags_new && @$tags_new) { |
1507 |
if ($tags_new && @$tags_new) { |
| 1493 |
$marcrecord->delete_field($field); |
1508 |
$marcrecord->delete_field($field); |
| 1494 |
append_fields_ordered( $marcrecord, $field_to ); |
1509 |
append_fields_ordered( $marcrecord, $field_to ); |
| 1495 |
- |
|
|