[Bug 30788] New: Argument "" isn't numeric in multiplication (*) at /usr/share/koha/lib/C4/Overdues.pm
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Bug ID: 30788 Summary: Argument "" isn't numeric in multiplication (*) at /usr/share/koha/lib/C4/Overdues.pm Change sponsored?: --- Product: Koha Version: 20.11 Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: katrin.fischer@bsz-bw.de QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz Blocks: 25790 Argument "" isn't numeric in multiplication (*) at /usr/share/koha/lib/C4/Overdues.pm when fines.pl is run. The lines vary a little between our 20.11.17 and master. It's in CalcFine: In 20.11.7 it's here: 265: $amount = $charge_periods * $issuing_rule->{fine}; That would make it this line in master: 279: $amount = $charge_periods * $issuing_rule->{fine}; I think it might be linked to cases where fine is empty but an interval is defined? In the database rule_name = fine shows empty and NULL values. I think with issuingrules we used to have a numeric data type so that might be a side effect of the migration. This is quite noisy. 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. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com --- Comment #1 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- I think this is a possible fix: diff --git a/C4/Overdues.pm b/C4/Overdues.pm index 5db9c220416..a31d2b4f7ba 100644 --- a/C4/Overdues.pm +++ b/C4/Overdues.pm @@ -274,7 +274,7 @@ sub CalcFine { # biblio-level recall $amount = $charge_periods * $issuing_rule->{recall_overdue_fine}; } - if ( scalar @recalls == 0 ) { + if ( scalar @recalls == 0 && $issuing_rule->{fine}) { # no recall, use normal fine amount $amount = $charge_periods * $issuing_rule->{fine}; } Are you expecting a suspension (days) but no fine ($) with this rule? -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Suspensions have a different rule for their interval, so it's not about this here. I think maybe we need to treat empty/null as 0, because with your fix the fine I believe the fine might not be recalculated. Use case would be: - There is an older fine > 0 - Library changes circulation rules to fine = 0 - fines.pl is rerun and reduces existing fines to 0 This works now (we have used it) and it should work after fixing the warn as well. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #3 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- After discussing with Joubu we agreed the fix should not change things, there is also: my $amount = 0; -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 135225 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135225&action=edit Bug 30788: Fix warning in Overdues.pm when fine is empty in circ rules Argument "" isn't numeric in multiplication (*) at /usr/share/koha/lib/C4/Overdues.pm To test: * Create a issuing rule where fine is empty, but a fine interval is set. Fine amount: empty To do this, remove the 0 displayed in the input field before saving. Fine charging interval: 5 or any other numeric value When to charge: Start of interval Fine grace period: 0 * Check out an item with the due date yester (use specify due date) * Run misc/cronjobs/fines.pl -v * You should see above warn in the output * Apply patch * Rerun fines.pl, there should be no warn. * Run: t/db_dependent/Circulation/CalcFine.t t/db_dependent/Fines.t t/db_dependent/Circulation.t t/db_dependent/Overdues.t -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 135226 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135226&action=edit Bug 30788: Unit test Run: prove t/db_dependent/Circulation/CalcFine.t -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|20.11 |master Assignee|koha-bugs@lists.koha-commun |katrin.fischer@bsz-bw.de |ity.org | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135225|0 |1 is obsolete| | --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 135227 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135227&action=edit Bug 30788: Fix warning in Overdues.pm when fine is empty in circ rules Argument "" isn't numeric in multiplication (*) at /usr/share/koha/lib/C4/Overdues.pm To test: * Create a issuing rule where fine is empty, but a fine interval is set. Fine amount: empty To do this, remove the 0 displayed in the input field before saving. Fine charging interval: 5 or any other numeric value When to charge: Start of interval Fine grace period: 0 * Check out an item with the due date yester (use specify due date) * Run misc/cronjobs/fines.pl -v * You should see above warn in the output * Apply patch * Rerun fines.pl, there should be no warn. * Run: t/db_dependent/Circulation/CalcFine.t t/db_dependent/Fines.t t/db_dependent/Circulation.t t/db_dependent/Overdues.t Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135226|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 135228 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135228&action=edit Bug 30788: Unit test Run: prove t/db_dependent/Circulation/CalcFine.t Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Works great and is a nice cleanup. Unit tests are present and passing and QA script is happy (now that I fixed the first commit author to match the second commit author) Going for a straight to QA on this. Passed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #9 from David Nind <david@davidnind.com> --- For me, this test was failing: prove t/db_dependent/Circulation/CalcFine.t t/db_dependent/Circulation/CalcFine.t .. 1/5 # Looks like you planned 2 tests but ran 1. # Failed test 'Test with fine amount empty' # at t/db_dependent/Circulation/CalcFine.t line 142. t/db_dependent/Circulation/CalcFine.t .. 5/5 # Looks like you failed 1 test of 5. t/db_dependent/Circulation/CalcFine.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/5 subtests Test Summary Report ------------------- t/db_dependent/Circulation/CalcFine.t (Wstat: 256 Tests: 5 Failed: 1) Failed test: 2 Non-zero exit status: 1 Files=1, Tests=5, 4 wallclock secs ( 0.03 usr 0.01 sys + 2.78 cusr 0.26 csys = 3.08 CPU) Result: FAIL -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #10 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 135229 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135229&action=edit Bug 30788: Fix number of tests -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #11 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Forgot to commit a last minute change - just the number of tests needed to be fixed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi David, thx for testing! I think we overlapped, could you have a go with the follow-up patch? It should fix exactly that problem. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #13 from David Nind <david@davidnind.com> --- Just retested - everything passes now. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |martin.renvoize@ptfs-europe |y.org |.com CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135228|0 |1 is obsolete| | Attachment #135229|0 |1 is obsolete| | --- Comment #14 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 135554 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135554&action=edit Bug 30788: Unit test Run: prove t/db_dependent/Circulation/CalcFine.t Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 --- Comment #15 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 22.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Version(s)|22.11.00 |22.11.00, 22.05.01 released in| | Status|Pushed to master |Pushed to stable --- Comment #16 from Lucas Gass <lucas@bywatersolutions.com> --- Pushed to 22.05.x for 22.05.01 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |arthur.suzuki@biblibre.com Status|Pushed to stable |RESOLVED --- Comment #17 from Arthur Suzuki <arthur.suzuki@biblibre.com> --- this patch depends on recalls, released in 22.05 (bz19532) won't backport. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Arthur Suzuki <arthur.suzuki@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |19532 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19532 [Bug 19532] Recalls for Koha -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30788 Bug 30788 depends on bug 19532, which changed state. Bug 19532 Summary: Recalls for Koha https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19532 What |Removed |Added ---------------------------------------------------------------------------- Status|Needs documenting |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org