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

(-)a/Koha/SimpleMARC.pm (-8 / +5 lines)
Lines 202-213 sub add_field { Link Here
202
    if ( $fieldName > 10 ) {
202
    if ( $fieldName > 10 ) {
203
        foreach my $value ( @values ) {
203
        foreach my $value ( @values ) {
204
            my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $value );
204
            my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $value );
205
            $record->append_fields( $field );
205
            $record->insert_fields_ordered( $field );
206
        }
206
        }
207
    } else {
207
    } else {
208
        foreach my $value ( @values ) {
208
        foreach my $value ( @values ) {
209
            my $field = MARC::Field->new( $fieldName, $value );
209
            my $field = MARC::Field->new( $fieldName, $value );
210
            $record->append_fields( $field );
210
            $record->insert_fields_ordered( $field );
211
        }
211
        }
212
    }
212
    }
213
}
213
}
Lines 230-236 sub _update_field { Link Here
230
        if ( $fieldName < 10 ) {
230
        if ( $fieldName < 10 ) {
231
            foreach my $value ( @values ) {
231
            foreach my $value ( @values ) {
232
                my $field = MARC::Field->new( $fieldName, $value );
232
                my $field = MARC::Field->new( $fieldName, $value );
233
                $record->append_fields( $field );
233
                $record->insert_fields_ordered( $field );
234
            }
234
            }
235
        } else {
235
        } else {
236
            warn "Invalid operation, trying to add a new field without subfield";
236
            warn "Invalid operation, trying to add a new field without subfield";
Lines 273-279 sub _update_subfield { Link Here
273
        ## Field does not exist, create it.
273
        ## Field does not exist, create it.
274
        foreach my $value ( @values ) {
274
        foreach my $value ( @values ) {
275
            my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $values[$i++] );
275
            my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $values[$i++] );
276
            $record->append_fields( $field );
276
            $record->insert_fields_ordered( $field );
277
        }
277
        }
278
    }
278
    }
279
}
279
}
Lines 568-574 sub _copy_move_field { Link Here
568
        @from_fields = map { $_ <= @from_fields ? $from_fields[ $_ - 1 ] : () } @$field_numbers;
568
        @from_fields = map { $_ <= @from_fields ? $from_fields[ $_ - 1 ] : () } @$field_numbers;
569
    }
569
    }
570
570
571
    my @new_fields;
572
    for my $from_field ( @from_fields ) {
571
    for my $from_field ( @from_fields ) {
573
        my $new_field = $from_field->clone;
572
        my $new_field = $from_field->clone;
574
        $new_field->{_tag} = $toFieldName; # Should be replaced by set_tag, introduced by MARC::Field 2.0.4
573
        $new_field->{_tag} = $toFieldName; # Should be replaced by set_tag, introduced by MARC::Field 2.0.4
Lines 588-596 sub _copy_move_field { Link Here
588
                $record->delete_field( $to_fields[0] );
587
                $record->delete_field( $to_fields[0] );
589
            }
588
            }
590
        }
589
        }
591
        push @new_fields, $new_field;
590
        $record->insert_grouped_field( $new_field );
592
    }
591
    }
593
    $record->append_fields( @new_fields );
594
}
592
}
595
593
596
sub _copy_move_subfield {
594
sub _copy_move_subfield {
597
- 

Return to bug 24480