[Bug 25533] New: Perl "not numeric" warning on the "Holds" page
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Bug ID: 25533 Summary: Perl "not numeric" warning on the "Holds" page Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: trivial Priority: P5 - low Component: Hold requests Assignee: slavashishkin@gmail.com Reporter: stalkernoid@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, nugged@gmail.com Perl warning on the intranet "Holds" page (/cgi-bin/koha/reserve/request.pl): Argument "" isn't numeric in numeric gt (>) at .../C4/Reserves.pm line 2233. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 --- Comment #1 from Slava Shishkin <slavashishkin@gmail.com> --- Created attachment 105101 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105101&action=edit Bug 25533: Fix for 'Argument "" isn't numeric' warning Perl warning on the intranet "Holds" page (/cgi-bin/koha/reserve/request.pl) Argument "" isn't numeric in numeric gt (>) at .../C4/Reserves.pm line 2233. Fixed by assigning 0 for $holds_per_record when it has value that can be considered as false. To test: 1) Ensure that values of "Holds per record" is set to Unlimited on /cgi-bin/koha/admin/smart-rules.pl 2) Go to the intranet page (/cgi-bin/koha/reserve/request.pl). 3) Open item record, like /cgi-bin/koha/reserve/request.pl?biblionumber=1&borrowernumber=1 4) Observe the warning in the log file. 5) Apply patch. 6) Repeat steps 2 and 3. 7) Check that previous warning was suppressed. Mentored-by: Peter Vashchuk <stalkernoid@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Slava Shishkin <slavashishkin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Andrew Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25790 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790 [Bug 25790] [OMNIBUS] warnings removal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Emmi Takkinen <emmi.takkinen@outlook.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #105101|0 |1 is obsolete| | CC| |emmi.takkinen@outlook.com --- Comment #2 from Emmi Takkinen <emmi.takkinen@outlook.com> --- Created attachment 105995 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=105995&action=edit Bug 25533: Fix for 'Argument "" isn't numeric' warning Perl warning on the intranet "Holds" page (/cgi-bin/koha/reserve/request.pl) Argument "" isn't numeric in numeric gt (>) at .../C4/Reserves.pm line 2233. Fixed by assigning 0 for $holds_per_record when it has value that can be considered as false. To test: 1) Ensure that values of "Holds per record" is set to Unlimited on /cgi-bin/koha/admin/smart-rules.pl 2) Go to the intranet page (/cgi-bin/koha/reserve/request.pl). 3) Open item record, like /cgi-bin/koha/reserve/request.pl?biblionumber=1&borrowernumber=1 4) Observe the warning in the log file. 5) Apply patch. 6) Repeat steps 2 and 3. 7) Check that previous warning was suppressed. Mentored-by: Peter Vashchuk <stalkernoid@gmail.com> Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Emmi Takkinen <emmi.takkinen@outlook.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl Status|Signed Off |Failed QA --- Comment #3 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Thanks for your patch ! You remove the warning, but are you interpreting the value correctly? - my $holds_per_record = $rule ? $rule->{holds_per_record} : 0; + my $holds_per_record = $rule ? $rule->{holds_per_record} || 0 : 0; $max = $holds_per_record if $holds_per_record > $max; If space or empty string means Unlimited and we replace it by 0, would our compares be correct ? Note that perl now does the same thing but removing the warn will only hide the problem you found in this code ! I see that code is calculating the number of remaining holds: my $remaining_holds_for_record = $max_holds_for_record - $holds->count(); If max is 0 but should mean Unlimited, this definitely goes wrong ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- (In reply to Marcel de Rooy from comment #3)
Thanks for your patch ! You remove the warning, but are you interpreting the value correctly?
- my $holds_per_record = $rule ? $rule->{holds_per_record} : 0; + my $holds_per_record = $rule ? $rule->{holds_per_record} || 0 : 0; $max = $holds_per_record if $holds_per_record > $max;
If space or empty string means Unlimited and we replace it by 0, would our compares be correct ? Note that perl now does the same thing but removing the warn will only hide the problem you found in this code ! I see that code is calculating the number of remaining holds:
my $remaining_holds_for_record = $max_holds_for_record - $holds->count();
If max is 0 but should mean Unlimited, this definitely goes wrong ?
Good catch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 --- Comment #5 from Andrew Nugged <nugged@gmail.com> --- Yes, we will re-investigate and analyze/argue or re-create the fix, few days please :). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|25790 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790 [Bug 25790] [OMNIBUS] warnings removal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |25790 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25790 [Bug 25790] [OMNIBUS] warnings removal -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25533 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Andrii Nugged from comment #5)
Yes, we will re-investigate and analyze/argue or re-create the fix, few days please :).
Ping? -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org