Bugzilla – Attachment 150665 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.85 KB, created by
Nick Clemens (kidclamp)
on 2023-05-04 13:43:53 UTC
(
hide
)
Description:
Bug 24480: Fix insert_fields_ordered instead of append_fields in SimpleMARC
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-05-04 13:43:53 UTC
Size:
2.85 KB
patch
obsolete
>From ddbc6c95585695084a6d2c2ac1e7e49afea0a05e 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 > >Signed-off-by: Kelly <kelly@bywatersolutions.com> >--- > Koha/SimpleMARC.pm | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > >diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm >index 5aab1285d7..0c95ccf804 100644 >--- a/Koha/SimpleMARC.pm >+++ b/Koha/SimpleMARC.pm >@@ -208,12 +208,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 ); > } > } > } >@@ -236,7 +236,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"; >@@ -279,7 +279,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 ); > } > } > } >@@ -575,7 +575,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 >@@ -595,9 +594,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.30.2
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