Bugzilla – Attachment 90684 Details for
Bug 22571
MARC modification templates do not handle control fields in conditional
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22571: Handle control fields in MMT for conditionals
Bug-22571-Handle-control-fields-in-MMT-for-conditi.patch (text/plain), 1.67 KB, created by
Mark Tompsett
on 2019-06-17 17:59:33 UTC
(
hide
)
Description:
Bug 22571: Handle control fields in MMT for conditionals
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2019-06-17 17:59:33 UTC
Size:
1.67 KB
patch
obsolete
>From db257b83090e596fa880a4aa73af31c9d603307a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Sun, 5 May 2019 12:41:46 -0500 >Subject: [PATCH] Bug 22571: Handle control fields in MMT for conditionals > >Control fields are not handled correctly by Koha::SimpleMARC when >comparaison (with or without regex) is done. > >Which means we did not support something like: >Do something if control field 008 equals or matches "a string" > >Test plan: >Create a new MARC modification template and a new action, like: >Add new field 100$a with value "foo bar" if 008 (or any other control >fields) matches (or equals) a regex >Then use the record mofication tool and confirm that the new field is >create if the regex matches 008 of the bib record > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > Koha/SimpleMARC.pm | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > >diff --git a/Koha/SimpleMARC.pm b/Koha/SimpleMARC.pm >index de76cd313e..5a916bdb03 100644 >--- a/Koha/SimpleMARC.pm >+++ b/Koha/SimpleMARC.pm >@@ -415,9 +415,15 @@ sub field_equals { > my @field_numbers = (); > my $current_field_number = 1; > FIELDS: for my $field ( $record->field( $fieldName ) ) { >- my @subfield_values = $subfieldName >- ? $field->subfield( $subfieldName ) >- : map { $_->[1] } $field->subfields; >+ my @subfield_values; >+ if ( $field->is_control_field ) { >+ push @subfield_values, $field->data; >+ } else { >+ @subfield_values = >+ $subfieldName >+ ? $field->subfield($subfieldName) >+ : map { $_->[1] } $field->subfields; >+ } > > SUBFIELDS: for my $subfield_value ( @subfield_values ) { > if ( >-- >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 22571
:
89362
|
89363
|
90683
|
90684
|
90685
|
90896
|
90897
|
90898