Bugzilla – Attachment 112187 Details for
Bug 26784
Editing a MARC modification template is noisy
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26784: Silence warns about comparing undefined values for MARC modification templates
Bug-26784-Silence-warns-about-comparing-undefined-.patch (text/plain), 2.73 KB, created by
Nick Clemens (kidclamp)
on 2020-10-22 12:38:39 UTC
(
hide
)
Description:
Bug 26784: Silence warns about comparing undefined values for MARC modification templates
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-10-22 12:38:39 UTC
Size:
2.73 KB
patch
obsolete
>From 970b473b9746643d7b3aecd0694a88e63cf32c4d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 22 Oct 2020 12:36:13 +0000 >Subject: [PATCH] Bug 26784: Silence warns about comparing undefined values for > MARC modification templates > >This patch simply checks if conditionals are defined before comparing > >We don't need to check actions because you cannot save an action without an action :-) > >To test: >1 - Define several actions for a MARC modification template >2 - Ensure you have actions with no conditionals >3 - Tail the intranet logs >4 - Browse to Tools->MARC modification templates >5 - Click 'Edit actions' for the template you setup above >6 - Note warns like: > [2020/10/22 12:30:18] [WARN] Use of uninitialized value in string eq at /kohadevbox/koha/tools/marc_modification_templates.pl line 127. >7 - Apply patch >8 - Restart all the things >9 - Edit actions again and note no more warns >--- > tools/marc_modification_templates.pl | 18 +++++++++++------- > 1 file changed, 11 insertions(+), 7 deletions(-) > >diff --git a/tools/marc_modification_templates.pl b/tools/marc_modification_templates.pl >index 27ace821e8..69bea401d2 100755 >--- a/tools/marc_modification_templates.pl >+++ b/tools/marc_modification_templates.pl >@@ -121,13 +121,17 @@ foreach my $action ( @actions ) { > $action->{'action_copy_field'} = ( $action->{'action'} eq 'copy_field' ); > $action->{'action_copy_and_replace_field'} = ( $action->{'action'} eq 'copy_and_replace_field' ); > >- $action->{'conditional_if'} = ( $action->{'conditional'} eq 'if' ); >- $action->{'conditional_unless'} = ( $action->{'conditional'} eq 'unless' ); >- >- $action->{'conditional_comparison_exists'} = ( $action->{'conditional_comparison'} eq 'exists' ); >- $action->{'conditional_comparison_not_exists'} = ( $action->{'conditional_comparison'} eq 'not_exists' ); >- $action->{'conditional_comparison_equals'} = ( $action->{'conditional_comparison'} eq 'equals' ); >- $action->{'conditional_comparison_not_equals'} = ( $action->{'conditional_comparison'} eq 'not_equals' ); >+ if( defined $action->{'conditional'} ){ >+ $action->{'conditional_if'} = ( $action->{'conditional'} eq 'if' ); >+ $action->{'conditional_unless'} = ( $action->{'conditional'} eq 'unless' ); >+ } >+ >+ if( defined $action->{'conditional_comparison'} ){ >+ $action->{'conditional_comparison_exists'} = ( $action->{'conditional_comparison'} eq 'exists' ); >+ $action->{'conditional_comparison_not_exists'} = ( $action->{'conditional_comparison'} eq 'not_exists' ); >+ $action->{'conditional_comparison_equals'} = ( $action->{'conditional_comparison'} eq 'equals' ); >+ $action->{'conditional_comparison_not_equals'} = ( $action->{'conditional_comparison'} eq 'not_equals' ); >+ } > } > > $template->param( >-- >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 26784
:
112187
|
112408
|
112432