Bug 31644: Check if subfield defined, not for truth

To test:
1 - Define a new MARC Modification template with actions:
        Copy field 600$a to 942$0
2 - Define a new record like:
    LDR 00334nam a22001217a 4500
    003 ff
    005 20201102111604.0
    008 201102b        xxu||||| |||| 00| 0 eng d
    040 _ _ ‡cvsd
    100 1 _ ‡012345‡aKnuth, Donal Ervin‡d1938
    245 _ _ ‡012345‡aThe aty of computer programming‡cDonald E. Knuth
    600 _ 0 ‡042‡aComputer programming‡9462
3 - Modify this record using the template above
4 - Note that entire  field is copied to 942
5 - Apply patch
6 - Now only subfield 0 is copied

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2022-09-28 18:53:28 +00:00 committed by Tomas Cohen Arazi
parent 4ab009cc9a
commit 2f61afa9c5
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 2 additions and 2 deletions

View File

@ -92,9 +92,9 @@ sub copy_field {
if ( ! ( $record && $fromFieldName && $toFieldName ) ) { return; }
if ( not $fromSubfieldName
if ( not defined $fromSubfieldName
or $fromSubfieldName eq ''
or not $toSubfieldName
or not defined $toSubfieldName
or $toSubfieldName eq '' ) {
_copy_move_field(
{ record => $record,