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

(-)a/Koha/SimpleMARC.pm (-9 / +9 lines)
Lines 575-587 sub _copy_move_field { Link Here
575
        @from_fields = map { $_ <= @from_fields ? $from_fields[ $_ - 1 ] : () } @$field_numbers;
575
        @from_fields = map { $_ <= @from_fields ? $from_fields[ $_ - 1 ] : () } @$field_numbers;
576
    }
576
    }
577
577
578
    if ( $action eq 'replace' ) {
578
    my @new_fields;
579
        my @to_fields = $record->field( $toFieldName );
580
        for my $to_field ( @to_fields ) {
581
            $record->delete_field( $to_field );
582
        }
583
    }
584
585
    for my $from_field ( @from_fields ) {
579
    for my $from_field ( @from_fields ) {
586
        my $new_field = $from_field->clone;
580
        my $new_field = $from_field->clone;
587
        $new_field->{_tag} = $toFieldName; # Should be replaced by set_tag, introduced by MARC::Field 2.0.4
581
        $new_field->{_tag} = $toFieldName; # Should be replaced by set_tag, introduced by MARC::Field 2.0.4
Lines 595-602 sub _copy_move_field { Link Here
595
        if ( $action eq 'move' ) {
589
        if ( $action eq 'move' ) {
596
            $record->delete_field( $from_field )
590
            $record->delete_field( $from_field )
597
        }
591
        }
598
        $record->insert_grouped_field( $new_field );
592
        elsif ( $action eq 'replace' ) {
593
            my @to_fields = $record->field( $toFieldName );
594
            if( @to_fields ) {
595
                $record->delete_field( $to_fields[0] );
596
            }
597
        }
598
        unshift @new_fields, $new_field;
599
    }
599
    }
600
    $record->insert_fields_ordered( @new_fields );
600
}
601
}
601
602
602
sub _copy_move_subfield {
603
sub _copy_move_subfield {
603
- 

Return to bug 24480