Bugzilla – Attachment 106621 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: (QA follow-up)
Bug-24480-QA-follow-up.patch (text/plain), 8.27 KB, created by
Arthur Suzuki
on 2020-07-07 00:32:42 UTC
(
hide
)
Description:
Bug 24480: (QA follow-up)
Filename:
MIME Type:
Creator:
Arthur Suzuki
Created:
2020-07-07 00:32:42 UTC
Size:
8.27 KB
patch
obsolete
>From aff48ab836aedd4314fd5bf7b9751968f3ab74f4 Mon Sep 17 00:00:00 2001 >From: Arthur Suzuki <arthur.suzuki@biblibre.com> >Date: Tue, 7 Jul 2020 02:29:22 +0200 >Subject: [PATCH] Bug 24480: (QA follow-up) > >--- > Koha/SimpleMARC.pm | 13 +++++++------ > t/SimpleMARC.t | 32 ++++++++++++++++---------------- > 2 files changed, 23 insertions(+), 22 deletions(-) > >diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm >index 3fb7d6ee29..c90ba89164 100644 >--- a/Koha/SimpleMARC.pm >+++ b/Koha/SimpleMARC.pm >@@ -582,6 +582,13 @@ sub _copy_move_field { > @from_fields = map { $_ <= @from_fields ? $from_fields[ $_ - 1 ] : () } @$field_numbers; > } > >+ if ( $action eq 'replace' ) { >+ my @to_fields = $record->field( $toFieldName ); >+ for my $to_field ( @to_fields ) { >+ $record->delete_field( $to_field ); >+ } >+ } >+ > 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,12 +602,6 @@ sub _copy_move_field { > if ( $action eq 'move' ) { > $record->delete_field( $from_field ) > } >- elsif ( $action eq 'replace' ) { >- my @to_fields = $record->field( $toFieldName ); >- if ( @to_fields ) { >- $record->delete_field( $to_fields[0] ); >- } >- } > $record->insert_grouped_field( $new_field ); > } > } >diff --git a/t/SimpleMARC.t b/t/SimpleMARC.t >index 4fd8933b29..893f1c8f19 100644 >--- a/t/SimpleMARC.t >+++ b/t/SimpleMARC.t >@@ -384,7 +384,7 @@ subtest 'copy_field' => sub { > read_field( { record => $record, field => '651', subfield => 'a' } ); > is_deeply( > \@fields_651a, >- [ 'Computer programming.', 'Computer algorithms.' ], >+ [ 'Computer algorithms.' , 'Computer programming.' ], > 'Copy multivalued field' > ); > delete_field( { record => $record, field => '651' } ); >@@ -445,7 +445,7 @@ subtest 'copy_field' => sub { > read_field( { record => $record, field => '651', subfield => 'a' } ); > is_deeply( > \@fields_651a, >- [ 'The art of programming.', 'The art of algorithms.' ], >+ [ 'The art of algorithms.', 'The art of programming.' ], > 'Copy field using regex' > ); > delete_field( { record => $record, field => '651' } ); >@@ -464,7 +464,7 @@ subtest 'copy_field' => sub { > read_field( { record => $record, field => '651', subfield => 'a' } ); > is_deeply( > \@fields_651a, >- [ 'The mistake of programming.', 'The mistake of algorithms.' ], >+ [ 'The mistake of algorithms.', 'The mistake of programming.' ], > 'Copy fields using regex on existing fields' > ); > delete_field( { record => $record, field => '651' } ); >@@ -483,7 +483,7 @@ subtest 'copy_field' => sub { > read_field( { record => $record, field => '651', subfield => 'a' } ); > is_deeply( > \@fields_651a, >- [ 'The art of programming.', 'The art of algorithms.', ], >+ [ 'The art of algorithms.', 'The art of programming.', ], > 'Copy all fields using regex' > ); > delete_field( { record => $record, field => '651' } ); >@@ -531,7 +531,7 @@ subtest 'copy_field' => sub { > read_field( { record => $record, field => '652', subfield => 'a' } ); > is_deeply( > \@fields_652a, >- [ 'Cfoomputer programming.', 'Cfoomputer algorithms.' ], >+ [ 'Cfoomputer algorithms.', 'Cfoomputer programming.' ], > 'Copy field using regex' > ); > >@@ -549,7 +549,7 @@ subtest 'copy_field' => sub { > read_field( { record => $record, field => '653', subfield => 'a' } ); > is_deeply( > \@fields_653a, >- [ 'Cfoomputer prfoogramming.', 'Cfoomputer algfoorithms.' ], >+ [ 'Cfoomputer algfoorithms.', 'Cfoomputer prfoogramming.' ], > 'Copy field using regex' > ); > >@@ -567,7 +567,7 @@ subtest 'copy_field' => sub { > read_field( { record => $record, field => '654', subfield => 'a' } ); > is_deeply( > \@fields_654a, >- [ 'Cfoomputer programming.', 'Cfoomputer algorithms.' ], >+ [ 'Cfoomputer algorithms.', 'Cfoomputer programming.' ], > 'Copy field using regex' > ); > >@@ -585,7 +585,7 @@ subtest 'copy_field' => sub { > read_field( { record => $record, field => '655', subfield => 'a' } ); > is_deeply( > \@fields_655a, >- [ 'Cfoomputer prfoogramming.', 'Cfoomputer algfoorithms.' ], >+ [ 'Cfoomputer algfoorithms.', 'Cfoomputer prfoogramming.' ], > 'Copy field using regex' > ); > >@@ -958,7 +958,7 @@ subtest 'copy_and_replace_field' => sub { > read_field( { record => $record, field => '651', subfield => 'a' } ); > is_deeply( > \@fields_651a, >- [ 'Computer programming.', 'Computer algorithms.' ], >+ [ 'Computer algorithms.', 'Computer programming.' ], > 'Copy and replace multivalued field (same as copy)' > ); > delete_field( { record => $record, field => '651' } ); >@@ -1018,7 +1018,7 @@ subtest 'copy_and_replace_field' => sub { > read_field( { record => $record, field => '651', subfield => 'a' } ); > is_deeply( > \@fields_651a, >- [ 'The art of programming.', 'The art of algorithms.' ], >+ [ 'The art of algorithms.', 'The art of programming.' ], > 'Copy and replace field using regex (same as copy)' > ); > delete_field( { record => $record, field => '651' } ); >@@ -1037,7 +1037,7 @@ subtest 'copy_and_replace_field' => sub { > read_field( { record => $record, field => '651', subfield => 'a' } ); > is_deeply( > \@fields_651a, >- [ 'The mistake of programming.', 'The mistake of algorithms.' ], >+ [ 'The mistake of algorithms.', 'The mistake of programming.' ], > 'Copy and replace fields using regex on existing fields (same as copy)' > ); > delete_field( { record => $record, field => '651' } ); >@@ -1056,7 +1056,7 @@ subtest 'copy_and_replace_field' => sub { > read_field( { record => $record, field => '651', subfield => 'a' } ); > is_deeply( > \@fields_651a, >- [ 'The art of programming.', 'The art of algorithms.', ], >+ [ 'The art of algorithms.', 'The art of programming.', ], > 'Copy and replace all fields using regex (same as copy)' > ); > delete_field( { record => $record, field => '651' } ); >@@ -1104,7 +1104,7 @@ subtest 'copy_and_replace_field' => sub { > read_field( { record => $record, field => '652', subfield => 'a' } ); > is_deeply( > \@fields_652a, >- [ 'Cfoomputer programming.', 'Cfoomputer algorithms.' ], >+ [ 'Cfoomputer algorithms.', 'Cfoomputer programming.' ], > 'Copy and replace field using regex (same as copy)' > ); > >@@ -1122,7 +1122,7 @@ subtest 'copy_and_replace_field' => sub { > read_field( { record => $record, field => '653', subfield => 'a' } ); > is_deeply( > \@fields_653a, >- [ 'Cfoomputer prfoogramming.', 'Cfoomputer algfoorithms.' ], >+ [ 'Cfoomputer algfoorithms.', 'Cfoomputer prfoogramming.' ], > 'Copy and replace field using regex (same as copy)' > ); > >@@ -1140,7 +1140,7 @@ subtest 'copy_and_replace_field' => sub { > read_field( { record => $record, field => '654', subfield => 'a' } ); > is_deeply( > \@fields_654a, >- [ 'Cfoomputer programming.', 'Cfoomputer algorithms.' ], >+ [ 'Cfoomputer algorithms.', 'Cfoomputer programming.' ], > 'Copy and replace field using regex (same as copy)' > ); > >@@ -1158,7 +1158,7 @@ subtest 'copy_and_replace_field' => sub { > read_field( { record => $record, field => '655', subfield => 'a' } ); > is_deeply( > \@fields_655a, >- [ 'Cfoomputer prfoogramming.', 'Cfoomputer algfoorithms.' ], >+ [ 'Cfoomputer algfoorithms.', 'Cfoomputer prfoogramming.' ], > 'Copy and replace field using regex (same as copy)' > ); > >-- >2.11.0
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