Bugzilla – Attachment 101665 Details for
Bug 24900
Fix 'MARC modification templates' to not assume that 'from field' will match 'conditional field'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24900: Some fixes to how MARC modification template actions work
Bug-24900-Some-fixes-to-how-MARC-modification-temp.patch (text/plain), 3.29 KB, created by
Aleisha Amohia
on 2020-03-25 02:04:44 UTC
(
hide
)
Description:
Bug 24900: Some fixes to how MARC modification template actions work
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2020-03-25 02:04:44 UTC
Size:
3.29 KB
patch
obsolete
>From 057afcfa8791a949d1371d722d85300c92b1cc74 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 19 Mar 2020 04:37:34 +0000 >Subject: [PATCH] Bug 24900: Some fixes to how MARC modification template > actions work > >CASE 1: Delete field 020 if field 020$z exists >BROKEN BEHAVIOUR (before patch): 020$z field was deleted, even though we > wanted all 020 fields to be deleted >EXPECTED BEHAVIOUR (corrected by patch): all 020 fields are deleted > >CASE 2: Delete 1st field 020 if 651$z exists >BROKEN BEHAVIOUR (before patch): deletes the 2nd instance of 020 instead > of 1st >EXPECTED BEHAVIOUR (corrected by patch): deletes the 1st instance of 020 > >CASE 3: Delete 1st field 020 if 020$z exists >BROKEN BEHAVIOUR (before patch): deletes the 3rd instance of 020 which > contains subfield z >EXPECTED BEHAVIOUR (corrected by patch): deletes the 1st instance of 020 > >CASE 4: Delete 1st field 020 if 651$z matches Berlin. (must include '.') >BROKEN BEHAVIOUR (before patch): deletes the 2nd instance of 020 >EXPECTED BEHAVIOUR (corrected by patch): deletes the 1st instance of 020 > >CASE 5: Delete 1st field 020 if 020$z matches 9781460708385 >BROKEN BEHAVIOUR (before patch): deletes the 3rd instance of 020 which > contains subfield z >EXPECTED BEHAVIOUR (corrected by patch): deletes the 1st instance of 020 > >Sponsored-by: Catalyst IT >--- > C4/MarcModificationTemplates.pm | 24 +++++++++--------------- > 1 file changed, 9 insertions(+), 15 deletions(-) > >diff --git a/C4/MarcModificationTemplates.pm b/C4/MarcModificationTemplates.pm >index 54846e5956..c80aa84b40 100644 >--- a/C4/MarcModificationTemplates.pm >+++ b/C4/MarcModificationTemplates.pm >@@ -573,21 +573,9 @@ sub ModifyRecordWithTemplate { > subfield => $conditional_subfield, > is_regex => $conditional_regex, > }); >- my $all_fields = [ >- 1 .. scalar @{ >- field_exists( >- { >- record => $record, >- field => $conditional_field, >- subfield => $conditional_subfield >- } >- ) >- } >- ]; >- $field_numbers = [Koha::MoreUtils::singleton ( @$field_numbers, @$all_fields ) ]; > $do = $conditional eq 'if' >- ? @$field_numbers >- : not @$field_numbers; >+ ? not @$field_numbers >+ : @$field_numbers; > } > } > >@@ -600,7 +588,13 @@ sub ModifyRecordWithTemplate { > if ( @$field_numbers > 0 ) { > if ( $field_number == 1 ) { > # We want only the first matching >- $field_numbers = [ $field_numbers->[0] ]; >+ $field_numbers = [ 1 ]; >+ } else { >+ $field_numbers = field_exists({ >+ record => $record, >+ field => $from_field, >+ subfield => $from_subfield, >+ }); > } > } > # There was no condition >-- >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 24900
:
100992
|
100993
|
101665
|
101666
|
101970
|
102121