Bugzilla – Attachment 97944 Details for
Bug 24480
Fields added with MARC modifications templates are not added in an ordered way
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24480: Fix insert_fields_ordered instead of append_fields in SimpleMARC
Bug-24480-Fix-insertfieldsordered-instead-of-appen.patch (text/plain), 2.80 KB, created by
Arthur Suzuki
on 2020-01-25 22:36:27 UTC
(
hide
)
Description:
Bug 24480: Fix insert_fields_ordered instead of append_fields in SimpleMARC
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2020-01-25 22:36:27 UTC
Size:
2.80 KB
patch
obsolete
>From 08b4a450e7af593e37982f72ca3e96abef59e200 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Fri, 17 Jan 2020 10:26:58 +0100 >Subject: [PATCH] Bug 24480: Fix insert_fields_ordered instead of append_fields > in SimpleMARC > >Test plan : > - create a marc modification template which add a new field to a record > - apply that template to some records > - verify that the new field is always appended at the bottom of the record, even if some fields are higher. > - apply patch > - apply template to another set of records > - verify the added field is now ordered within the already existing fields in the records >--- > Koha/SimpleMARC.pm | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > >diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm >index 5a916bdb03..be9282d15c 100644 >--- a/Koha/SimpleMARC.pm >+++ b/Koha/SimpleMARC.pm >@@ -202,12 +202,12 @@ sub add_field { > if ( $fieldName > 10 ) { > foreach my $value ( @values ) { > my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $value ); >- $record->append_fields( $field ); >+ $record->insert_fields_ordered( $field ); > } > } else { > foreach my $value ( @values ) { > my $field = MARC::Field->new( $fieldName, $value ); >- $record->append_fields( $field ); >+ $record->insert_fields_ordered( $field ); > } > } > } >@@ -230,7 +230,7 @@ sub _update_field { > if ( $fieldName < 10 ) { > foreach my $value ( @values ) { > my $field = MARC::Field->new( $fieldName, $value ); >- $record->append_fields( $field ); >+ $record->insert_fields_ordered( $field ); > } > } else { > warn "Invalid operation, trying to add a new field without subfield"; >@@ -273,7 +273,7 @@ sub _update_subfield { > ## Field does not exist, create it. > foreach my $value ( @values ) { > my $field = MARC::Field->new( $fieldName, '', '', "$subfieldName" => $values[$i++] ); >- $record->append_fields( $field ); >+ $record->insert_fields_ordered( $field ); > } > } > } >@@ -568,7 +568,6 @@ sub _copy_move_field { > @from_fields = map { $_ <= @from_fields ? $from_fields[ $_ - 1 ] : () } @$field_numbers; > } > >- my @new_fields; > for my $from_field ( @from_fields ) { > my $new_field = $from_field->clone; > $new_field->{_tag} = $toFieldName; # Should be replaced by set_tag, introduced by MARC::Field 2.0.4 >@@ -588,9 +587,8 @@ sub _copy_move_field { > $record->delete_field( $to_fields[0] ); > } > } >- push @new_fields, $new_field; >+ $record->insert_grouped_field( $new_field ); > } >- $record->append_fields( @new_fields ); > } > > sub _copy_move_subfield { >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24480
:
97695
|
97944
|
97945
|
98975
|
98976
|
106621
|
112311
|
112312
|
150665
|
150666
|
155714
|
155715
|
155716
|
155717
|
155721
|
155722
|
155723
|
155724
|
158130
|
158131
|
158132
|
158133