|
Lines 671-680
sub _copy_move_subfield {
Link Here
|
| 671 |
} |
671 |
} |
| 672 |
_modify_values( { values => \@values, regex => $regex } ); |
672 |
_modify_values( { values => \@values, regex => $regex } ); |
| 673 |
my $dont_erase = $action eq 'copy' ? 1 : 0; |
673 |
my $dont_erase = $action eq 'copy' ? 1 : 0; |
|
|
674 |
|
| 675 |
# Find which source fields actually have the subfield to determine target field numbers |
| 676 |
my @target_field_numbers; |
| 677 |
if ( $fromFieldName eq $toFieldName && @values ) { |
| 678 |
|
| 679 |
# For same-field operations, find fields that have the source subfield |
| 680 |
@target_field_numbers = |
| 681 |
@{ field_exists( { record => $record, field => $fromFieldName, subfield => $fromSubfieldName } ) }; |
| 682 |
if (@$field_numbers) { |
| 683 |
|
| 684 |
# If specific field numbers were requested, intersect them with fields that have the subfield |
| 685 |
my %requested = map { $_ => 1 } @$field_numbers; |
| 686 |
@target_field_numbers = grep { $requested{$_} } @target_field_numbers; |
| 687 |
} |
| 688 |
} |
| 689 |
|
| 674 |
_update_subfield( |
690 |
_update_subfield( |
| 675 |
{ |
691 |
{ |
| 676 |
record => $record, field => $toFieldName, subfield => $toSubfieldName, values => \@values, |
692 |
record => $record, |
| 677 |
dont_erase => $dont_erase |
693 |
field => $toFieldName, |
|
|
694 |
subfield => $toSubfieldName, |
| 695 |
values => \@values, |
| 696 |
dont_erase => $dont_erase, |
| 697 |
field_numbers => @target_field_numbers ? \@target_field_numbers : $field_numbers |
| 678 |
} |
698 |
} |
| 679 |
); |
699 |
); |
| 680 |
|
700 |
|
| 681 |
- |
|
|