From 07e28a8348636a5ab7c3819b34607490ea2d9fe8 Mon Sep 17 00:00:00 2001 From: Arthur Suzuki 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm index 5a916bdb03..0cf8621f02 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 ); } } } -- 2.20.1