[Bug 14145] New: Noisy warns in admin/preferences.pl
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Bug ID: 14145 Summary: Noisy warns in admin/preferences.pl Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: System Administration Assignee: koha-bugs@lists.koha-community.org Reporter: aleishaamohia@hotmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com 'Odd number elements in anonymous hash' warns on lines 116 and 121 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Aleisha Amohia <aleishaamohia@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 --- Comment #1 from Aleisha Amohia <aleishaamohia@hotmail.com> --- Created attachment 38838 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=38838&action=edit Bug 14145: Noisy warns in admin/preferences.pl This patch silences the warns on lines 116 and 121 by referring to the chunk variable name (type) rather than what I assume is the string 'multiple'. I don't know that this is the best solution for this, but the warns are gone and the page seems to work still. To test: 1) Go to Admin -> System Preferences and click on the OPAC tab 2) Notice the warns in the error log 3) Apply the patch and refresh page 4) Notice page still works but no warns in error log -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 --- Comment #2 from Aleisha Amohia <aleishaamohia@hotmail.com> --- Created attachment 38839 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=38839&action=edit Bug 14145: Noisy warns in admin/preferences.pl on Enhanced Content tab 'Use of uninitialized value $value in split' on line 109, fixed by setting $value to an empty string. To test: 1) Go to Admin -> System preferences 2) Click on Enhanced content tab 3) Notice warns in error log 4) Apply patch and refresh page 5) Notice page still works but no warns in error log -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 --- Comment #3 from M. Tompsett <mtompset@hotmail.com> --- Created attachment 38999 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=38999&action=edit Bug 14145: Nicer counter-patch The problem with the odd number of hashes happens when not everything is selected. The grep returns undef, because it isn't found in @values. By turning the grep into a ternary-operator truth value, we can set a value (1 or 0) expressly. The next problem is when nothing is selected in these multiple lists, $value is undefined, so you can't split it. By splitting the definition of @values from the actual splitting, we can split only if $value is defined, thus eliminating the warning message. TEST PLAN --------- 1) back up your koha error log file 2) blank your koha error log file 3) log in to the staff client 4) Home -> Koha administration -> Global system preferences 5) Click on every tab, EXCEPT local use. 6) notice the koha error log file has warnings. 7) blank the koha error log file again 8) apply this patch 9) Click on every tab, EXCEPT local use, again. 10) notice the koha error log file has no warnings. 11) koha qa test tools. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtompset@hotmail.com --- Comment #4 from M. Tompsett <mtompset@hotmail.com> --- To sign off this bug either: 1) sign off the first two and obsolete my counter patch OR 2) sign off my counter patch and obsolete the first two. Though, I personally am confused by some of the changes in the first two patches, so that is why I wrote the counter patch. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 M. Tompsett <mtompset@hotmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |minor Assignee|koha-bugs@lists.koha-commun |mtompset@hotmail.com |ity.org | Version|unspecified |master -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 --- Comment #5 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 38838 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=38838 Bug 14145: Noisy warns in admin/preferences.pl Review of attachment 38838: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=14145&attachment=38838) ----------------------------------------------------------------- ::: admin/preferences.pl @@ +46,4 @@
my $tab_template = C4::Templates::gettemplate( 'admin/preferences/' . $tab . '.pref', 'intranet', $input );
my $active_currency = GetCurrency(); + my $local_currency;;
Double ;;'s? @@ +112,5 @@
sort { $a->{'text'} cmp $b->{'text'} } map { my $option_value = $_; { + text => $options{type}->{$option_value},
This works, because the $options{type} doesn't exist, so two undefs reduces the list size by an even number for the failed grep too. There is no reason to change 'multiple' to 'type'. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 --- Comment #6 from M. Tompsett <mtompset@hotmail.com> --- Comment on attachment 38839 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=38839 Bug 14145: Noisy warns in admin/preferences.pl on Enhanced Content tab Review of attachment 38839: --> (http://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=14145&attachment=38839) ----------------------------------------------------------------- ::: admin/preferences.pl @@ +62,4 @@
my $name = $options{'pref'}; my $chunk = { name => $name, value => $value, type => $options{'type'} || 'input', class => $options{'class'} };; + $value //= '';
If $value is undef, then the question is what else is undef in the list above? $options{'pref'}? $options{'class'}? Because otherwise line 64 would be barfing errors too about uneven lists. Perhaps there is something here to fix? Neither my counter patch nor this would fix it. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #38999|0 |1 is obsolete| | --- Comment #7 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 39051 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=39051&action=edit [SIGNED-OFF] Bug 14145: Noisy warns in admin/preferences.pl The problem with the odd number of hashes happens when not everything is selected. The grep returns undef, because it isn't found in @values. By turning the grep into a ternary-operator truth value, we can set a value (1 or 0) expressly. The next problem is when nothing is selected in these multiple lists, $value is undefined, so you can't split it. By splitting the definition of @values from the actual splitting, we can split only if $value is defined, thus eliminating the warning message. TEST PLAN --------- 1) back up your koha error log file 2) blank your koha error log file 3) log in to the staff client 4) Home -> Koha administration -> Global system preferences 5) Click on every tab, EXCEPT local use. 6) notice the koha error log file has warnings. 7) blank the koha error log file again 8) apply this patch 9) Click on every tab, EXCEPT local use, again. 10) notice the koha error log file has no warnings. 11) koha qa test tools. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> I like more this version Works as described No koha-qa errors -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bgkriegel@gmail.com Attachment #38838|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #38839|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 --- Comment #8 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 39384 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=39384&action=edit Bug 14145: Noisy warns in admin/preferences.pl The problem with the odd number of hashes happens when not everything is selected. The grep returns undef, because it isn't found in @values. By turning the grep into a ternary-operator truth value, we can set a value (1 or 0) expressly. The next problem is when nothing is selected in these multiple lists, $value is undefined, so you can't split it. By splitting the definition of @values from the actual splitting, we can split only if $value is defined, thus eliminating the warning message. TEST PLAN --------- 1) back up your koha error log file 2) blank your koha error log file 3) log in to the staff client 4) Home -> Koha administration -> Global system preferences 5) Click on every tab, EXCEPT local use. 6) notice the koha error log file has warnings. 7) blank the koha error log file again 8) apply this patch 9) Click on every tab, EXCEPT local use, again. 10) notice the koha error log file has no warnings. 11) koha qa test tools. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> I like more this version Works as described No koha-qa errors Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> To reproduce: go on the OPAC tab, OpacAdvSearchMoreOptions or OpacAdvSearchOptions should not have all options selected. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com Attachment #39051|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14145 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #9 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patch pushed to master. Thanks Mark! -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org