Bugzilla – Attachment 25497 Details for
Bug 11479
Remove experimental given/when from C4::MarcModificationTemplates
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11479 Remove experimental given/when keywords
Bug-11479-Remove-experimental-givenwhen-keywords.patch (text/plain), 4.69 KB, created by
Jonathan Druart
on 2014-02-20 13:25:34 UTC
(
hide
)
Description:
Bug 11479 Remove experimental given/when keywords
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-02-20 13:25:34 UTC
Size:
4.69 KB
patch
obsolete
>From 3b61ecc2ef2bd51f0034408a1b10783d31119a31 Mon Sep 17 00:00:00 2001 >From: Colin Campbell <colin.campbell@ptfs-europe.com> >Date: Mon, 6 Jan 2014 12:06:29 +0000 >Subject: [PATCH] Bug 11479 Remove experimental given/when keywords > >Replace constructs using given and when by if/else >feature now generates compilation warnings in 5.18 >and is liable to change behaviour > >replaced the construcrs with if/else >reformatted the if branching using perltidy >to remove the now redundant indent > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > C4/MarcModificationTemplates.pm | 90 ++++++++++++++++++++++----------------- > 1 file changed, 50 insertions(+), 40 deletions(-) > >diff --git a/C4/MarcModificationTemplates.pm b/C4/MarcModificationTemplates.pm >index 50b77df..65b5292 100644 >--- a/C4/MarcModificationTemplates.pm >+++ b/C4/MarcModificationTemplates.pm >@@ -547,49 +547,59 @@ sub ModifyRecordWithTemplate { > ); > > my $do = 1; >- if ( $conditional ) { >- for ( $conditional_comparison ) { >- when ( /^exists$/ ) { >- my $exists = field_exists( $record, $conditional_field, $conditional_subfield ); >- $do = $conditional eq 'if' >- ? $exists >- : not $exists; >- } >- when ( /^not_exists$/ ) { >- my $exists = field_exists( $record, $conditional_field, $conditional_subfield ); >- $do = $conditional eq 'if' >- ? not $exists >- : $exists; >- } >- when ( /^equals$/ ) { >- my $equals = field_equals( $record, $conditional_value, $conditional_field, $conditional_subfield, $conditional_regex ); >- $do = $conditional eq 'if' >- ? $equals >- : not $equals; >- } >- when ( /^not_equals$/ ) { >- my $equals = field_equals( $record, $conditional_value, $conditional_field, $conditional_subfield, $conditional_regex ); >- $do = $conditional eq 'if' >- ? not $equals >- : $equals; >- } >+ if ($conditional) { >+ if ( $conditional_comparison eq 'exists' ) { >+ my $exists = field_exists( $record, $conditional_field, >+ $conditional_subfield ); >+ $do = >+ $conditional eq 'if' >+ ? $exists >+ : not $exists; >+ } >+ elsif ( $conditional_comparison eq 'not_exists' ) { >+ my $exists = field_exists( $record, $conditional_field, >+ $conditional_subfield ); >+ $do = >+ $conditional eq 'if' >+ ? not $exists >+ : $exists; >+ } >+ elsif ( $conditional_comparison eq 'equals' ) { >+ my $equals = field_equals( >+ $record, $conditional_value, >+ $conditional_field, $conditional_subfield, >+ $conditional_regex >+ ); >+ $do = >+ $conditional eq 'if' >+ ? $equals >+ : not $equals; >+ } >+ elsif ( $conditional_comparison eq 'not_equals' ) { >+ my $equals = field_equals( >+ $record, $conditional_value, >+ $conditional_field, $conditional_subfield, >+ $conditional_regex >+ ); >+ $do = >+ $conditional eq 'if' >+ ? not $equals >+ : $equals; > } > } > >- if ( $do ) { >- for ( $action ) { >- when ( /^copy_field$/ ) { >- copy_field( @params ); >- } >- when ( /^update_field$/ ) { >- update_field( @params ); >- } >- when ( /^move_field$/ ) { >- move_field( @params ); >- } >- when ( /^delete_field$/ ) { >- delete_field( @params ); >- } >+ if ($do) { >+ if ( $action eq 'copy_field' ) { >+ copy_field(@params); >+ } >+ elsif ( $action eq 'update_field' ) { >+ update_field(@params); >+ } >+ elsif ( $action eq 'move_field' ) { >+ move_field(@params); >+ } >+ elsif ( $action eq 'delete_field' ) { >+ delete_field(@params); > } > } > >-- >1.7.10.4
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 11479
:
23930
|
25356
| 25497