Lines 85-152
sub copy_field {
Link Here
|
85 |
if ( ! ( $record && $fromFieldName && $toFieldName ) ) { return; } |
85 |
if ( ! ( $record && $fromFieldName && $toFieldName ) ) { return; } |
86 |
|
86 |
|
87 |
|
87 |
|
88 |
if ( not $fromSubfieldName or $fromSubfieldName eq '' |
88 |
if ( not $fromSubfieldName |
89 |
or not $toSubfieldName or $toSubfieldName eq '' |
89 |
or $fromSubfieldName eq '' |
90 |
) { |
90 |
or not $toSubfieldName |
91 |
_copy_field({ |
91 |
or $toSubfieldName eq '' ) { |
92 |
record => $record, |
92 |
_copy_move_field( |
93 |
from_field => $fromFieldName, |
93 |
{ record => $record, |
94 |
to_field => $toFieldName, |
94 |
from_field => $fromFieldName, |
95 |
regex => $regex, |
95 |
to_field => $toFieldName, |
96 |
field_numbers => $field_numbers, |
96 |
regex => $regex, |
97 |
}); |
97 |
field_numbers => $field_numbers, |
|
|
98 |
action => 'copy', |
99 |
} |
100 |
); |
98 |
} else { |
101 |
} else { |
99 |
_copy_subfield({ |
102 |
_copy_move_subfield( |
100 |
record => $record, |
103 |
{ record => $record, |
101 |
from_field => $fromFieldName, |
104 |
from_field => $fromFieldName, |
102 |
from_subfield => $fromSubfieldName, |
105 |
from_subfield => $fromSubfieldName, |
103 |
to_field => $toFieldName, |
106 |
to_field => $toFieldName, |
104 |
to_subfield => $toSubfieldName, |
107 |
to_subfield => $toSubfieldName, |
105 |
regex => $regex, |
108 |
regex => $regex, |
106 |
field_numbers => $field_numbers, |
109 |
field_numbers => $field_numbers, |
107 |
}); |
110 |
action => 'copy', |
|
|
111 |
} |
112 |
); |
108 |
} |
113 |
} |
109 |
|
|
|
110 |
} |
111 |
|
112 |
sub _copy_field { |
113 |
my ( $params ) = @_; |
114 |
my $record = $params->{record}; |
115 |
my $fromFieldName = $params->{from_field}; |
116 |
my $toFieldName = $params->{to_field}; |
117 |
my $regex = $params->{regex}; |
118 |
my $field_numbers = $params->{field_numbers} // []; |
119 |
|
120 |
_copy_move_field({ |
121 |
record => $record, |
122 |
from_field => $fromFieldName, |
123 |
to_field => $toFieldName, |
124 |
regex => $regex, |
125 |
field_numbers => $field_numbers, |
126 |
action => 'copy', |
127 |
}); |
128 |
} |
129 |
|
130 |
sub _copy_subfield { |
131 |
my ( $params ) = @_; |
132 |
my $record = $params->{record}; |
133 |
my $fromFieldName = $params->{from_field}; |
134 |
my $fromSubfieldName = $params->{from_subfield}; |
135 |
my $toFieldName = $params->{to_field}; |
136 |
my $toSubfieldName = $params->{to_subfield}; |
137 |
my $regex = $params->{regex}; |
138 |
my $field_numbers = $params->{field_numbers} // []; |
139 |
|
140 |
_copy_move_subfield({ |
141 |
record => $record, |
142 |
from_field => $fromFieldName, |
143 |
from_subfield => $fromSubfieldName, |
144 |
to_field => $toFieldName, |
145 |
to_subfield => $toSubfieldName, |
146 |
regex => $regex, |
147 |
field_numbers => $field_numbers, |
148 |
action => 'copy', |
149 |
}); |
150 |
} |
114 |
} |
151 |
|
115 |
|
152 |
sub update_field { |
116 |
sub update_field { |
Lines 416-484
sub move_field {
Link Here
|
416 |
my $regex = $params->{regex}; |
380 |
my $regex = $params->{regex}; |
417 |
my $field_numbers = $params->{field_numbers} // []; |
381 |
my $field_numbers = $params->{field_numbers} // []; |
418 |
|
382 |
|
419 |
if ( not $fromSubfieldName or $fromSubfieldName eq '' |
383 |
if ( not $fromSubfieldName |
420 |
or not $toSubfieldName or $toSubfieldName eq '' |
384 |
or $fromSubfieldName eq '' |
421 |
) { |
385 |
or not $toSubfieldName |
422 |
_move_field({ |
386 |
or $toSubfieldName eq '' ) { |
423 |
record => $record, |
387 |
_copy_move_field( |
424 |
from_field => $fromFieldName, |
388 |
{ record => $record, |
425 |
to_field => $toFieldName, |
389 |
from_field => $fromFieldName, |
426 |
regex => $regex, |
390 |
to_field => $toFieldName, |
427 |
field_numbers => $field_numbers, |
391 |
regex => $regex, |
428 |
}); |
392 |
field_numbers => $field_numbers, |
|
|
393 |
action => 'move', |
394 |
} |
395 |
); |
429 |
} else { |
396 |
} else { |
430 |
_move_subfield({ |
397 |
_copy_move_subfield( |
431 |
record => $record, |
398 |
{ record => $record, |
432 |
from_field => $fromFieldName, |
399 |
from_field => $fromFieldName, |
433 |
from_subfield => $fromSubfieldName, |
400 |
from_subfield => $fromSubfieldName, |
434 |
to_field => $toFieldName, |
401 |
to_field => $toFieldName, |
435 |
to_subfield => $toSubfieldName, |
402 |
to_subfield => $toSubfieldName, |
436 |
regex => $regex, |
403 |
regex => $regex, |
437 |
field_numbers => $field_numbers, |
404 |
field_numbers => $field_numbers, |
438 |
}); |
405 |
action => 'move', |
|
|
406 |
} |
407 |
); |
439 |
} |
408 |
} |
440 |
} |
409 |
} |
441 |
|
410 |
|
442 |
sub _move_field { |
|
|
443 |
my ( $params ) = @_; |
444 |
my $record = $params->{record}; |
445 |
my $fromFieldName = $params->{from_field}; |
446 |
my $toFieldName = $params->{to_field}; |
447 |
my $regex = $params->{regex}; |
448 |
my $field_numbers = $params->{field_numbers} // []; |
449 |
|
450 |
_copy_move_field({ |
451 |
record => $record, |
452 |
from_field => $fromFieldName, |
453 |
to_field => $toFieldName, |
454 |
regex => $regex, |
455 |
field_numbers => $field_numbers, |
456 |
action => 'move', |
457 |
}); |
458 |
} |
459 |
|
460 |
sub _move_subfield { |
461 |
my ( $params ) = @_; |
462 |
my $record = $params->{record}; |
463 |
my $fromFieldName = $params->{from_field}; |
464 |
my $fromSubfieldName = $params->{from_subfield}; |
465 |
my $toFieldName = $params->{to_field}; |
466 |
my $toSubfieldName = $params->{to_subfield}; |
467 |
my $regex = $params->{regex}; |
468 |
my $field_numbers = $params->{field_numbers} // []; |
469 |
|
470 |
_copy_move_subfield({ |
471 |
record => $record, |
472 |
from_field => $fromFieldName, |
473 |
from_subfield => $fromSubfieldName, |
474 |
to_field => $toFieldName, |
475 |
to_subfield => $toSubfieldName, |
476 |
regex => $regex, |
477 |
field_numbers => $field_numbers, |
478 |
action => 'move', |
479 |
}); |
480 |
} |
481 |
|
482 |
=head2 _delete_field |
411 |
=head2 _delete_field |
483 |
|
412 |
|
484 |
_delete_field( $record, $fieldName[, $subfieldName [, $n ] ] ); |
413 |
_delete_field( $record, $fieldName[, $subfieldName [, $n ] ] ); |
485 |
- |
|
|