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

(-)a/Koha/SimpleMARC.pm (-8 / +5 lines)
Lines 208-219 sub add_field { Link Here
208
    if ( $fieldName > 10 ) {
208
    if ( $fieldName > 10 ) {
209
        foreach my $value ( @values ) {
209
        foreach my $value ( @values ) {
210
            my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $value );
210
            my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $value );
211
            $record->append_fields( $field );
211
            $record->insert_fields_ordered( $field );
212
        }
212
        }
213
    } else {
213
    } else {
214
        foreach my $value ( @values ) {
214
        foreach my $value ( @values ) {
215
            my $field = MARC::Field->new( $fieldName, $value );
215
            my $field = MARC::Field->new( $fieldName, $value );
216
            $record->append_fields( $field );
216
            $record->insert_fields_ordered( $field );
217
        }
217
        }
218
    }
218
    }
219
}
219
}
Lines 236-242 sub _update_field { Link Here
236
        if ( $fieldName < 10 ) {
236
        if ( $fieldName < 10 ) {
237
            foreach my $value ( @values ) {
237
            foreach my $value ( @values ) {
238
                my $field = MARC::Field->new( $fieldName, $value );
238
                my $field = MARC::Field->new( $fieldName, $value );
239
                $record->append_fields( $field );
239
                $record->insert_fields_ordered( $field );
240
            }
240
            }
241
        } else {
241
        } else {
242
            warn "Invalid operation, trying to add a new field without subfield";
242
            warn "Invalid operation, trying to add a new field without subfield";
Lines 279-285 sub _update_subfield { Link Here
279
        ## Field does not exist, create it.
279
        ## Field does not exist, create it.
280
        foreach my $value ( @values ) {
280
        foreach my $value ( @values ) {
281
            my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $values[$i++] );
281
            my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $values[$i++] );
282
            $record->append_fields( $field );
282
            $record->insert_fields_ordered( $field );
283
        }
283
        }
284
    }
284
    }
285
}
285
}
Lines 575-581 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
    my @new_fields;
579
    for my $from_field ( @from_fields ) {
578
    for my $from_field ( @from_fields ) {
580
        my $new_field = $from_field->clone;
579
        my $new_field = $from_field->clone;
581
        $new_field->{_tag} = $toFieldName; # Should be replaced by set_tag, introduced by MARC::Field 2.0.4
580
        $new_field->{_tag} = $toFieldName; # Should be replaced by set_tag, introduced by MARC::Field 2.0.4
Lines 595-603 sub _copy_move_field { Link Here
595
                $record->delete_field( $to_fields[0] );
594
                $record->delete_field( $to_fields[0] );
596
            }
595
            }
597
        }
596
        }
598
        push @new_fields, $new_field;
597
        $record->insert_grouped_field( $new_field );
599
    }
598
    }
600
    $record->append_fields( @new_fields );
601
}
599
}
602
600
603
sub _copy_move_subfield {
601
sub _copy_move_subfield {
604
- 

Return to bug 24480