View | Details | Raw Unified | Return to bug 36515
Collapse All | Expand All

(-)a/Koha/SimpleMARC.pm (-6 / +7 lines)
Lines 135-146 sub copy_and_replace_field { Link Here
135
135
136
    if ( ! ( $record && $fromFieldName && $toFieldName ) ) { return; }
136
    if ( ! ( $record && $fromFieldName && $toFieldName ) ) { return; }
137
137
138
    if (
138
    if (    ( !defined $fromSubfieldName or $fromSubfieldName eq '' )
139
        ( !defined $fromSubfieldName or $fromSubfieldName eq '' )
139
        and ( !defined $toSubfieldName or $toSubfieldName eq '' ) )
140
        and ( !defined $toSubfieldName or $toSubfieldName eq '' )
140
    {
141
    ) {
142
        _copy_move_field(
141
        _copy_move_field(
143
            {   record        => $record,
142
            {
143
                record        => $record,
144
                from_field    => $fromFieldName,
144
                from_field    => $fromFieldName,
145
                to_field      => $toFieldName,
145
                to_field      => $toFieldName,
146
                regex         => $regex,
146
                regex         => $regex,
Lines 150-156 sub copy_and_replace_field { Link Here
150
        );
150
        );
151
    } else {
151
    } else {
152
        _copy_move_subfield(
152
        _copy_move_subfield(
153
            {   record        => $record,
153
            {
154
                record        => $record,
154
                from_field    => $fromFieldName,
155
                from_field    => $fromFieldName,
155
                from_subfield => $fromSubfieldName,
156
                from_subfield => $fromSubfieldName,
156
                to_field      => $toFieldName,
157
                to_field      => $toFieldName,
(-)a/t/SimpleMARC.t (-8 / +2 lines)
Lines 1526-1539 subtest 'copy_and_replace_field' => sub { Link Here
1526
        );
1526
        );
1527
1527
1528
        # Copy control field to subfield
1528
        # Copy control field to subfield
1529
        copy_and_replace_field(
1529
        copy_and_replace_field( { record => $record, from_field => '001', to_field => '099', to_subfield => 'a' } );
1530
            { record => $record, from_field => '001', to_field => '099', to_subfield   => 'a' } );
1531
        is_deeply(
1530
        is_deeply(
1532
            [
1531
            [ read_field( { record => $record, field => '099', subfield => 'a' } ) ],
1533
                read_field(
1534
                    { record => $record, field => '099', subfield => 'a' }
1535
                )
1536
            ],
1537
            ['4815162342'],
1532
            ['4815162342'],
1538
            'Copy and replace - Update a subfield with content of control field'
1533
            'Copy and replace - Update a subfield with content of control field'
1539
        );
1534
        );
1540
- 

Return to bug 36515