[Bug 15741] New: Incorrect rounding in total fines calculations
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Bug ID: 15741 Summary: Incorrect rounding in total fines calculations Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: abl@biblos.pk.edu.pl QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Our librarians discovered recently that recording payments for some specific fine amounts (64.60, for example) are not working properly - they are getting errors like: You must pay a value less than or equal to 64.60 It's not just 64.60, same thing happens for: 1.14 1.36 1.39 1.57 1.59 1.61 1.64 1.66 1.68 1.82 1.84 1.86 1.89 1.91 1.93 2.01 2.03 2.28 2.47 2.53 2.72 2.78 2.97 ... 32.30 64.10 64.60 65.10 128.20 128.70 129.20 129.70 130.20 130.70 ... and so on. This error seems to be caused by incorrect rounding in C4::Members::GetMemberAccountRecords(). To replicate: 1) Create manual invoice for 64.60 (or 1.14, 1.36, ...) 2) Try to pay it using "Pay amount" or "Pay selected" buttons As a temporary workaround, one may: - pay such amount in 2+ steps (eg. 64.00 + 0.60) - pay individual fines using 'Pay' button[s] on the left but, at first glance at least, an underlying problem for this error may possibly have some more severe consequences than just minor troubles with making payments - eg., if patron has 12+ fines (or credits) of such kind, total account balance calculation may be wrong as well. -- 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=15741 Jacek Ablewicz <abl@biblos.pk.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=3166 -- 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=15741 Jacek Ablewicz <abl@biblos.pk.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=3379 -- 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=15741 Jonathan Druart <jonathan.druart@bugs.koha-community.org> 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=15741 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 48776 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=48776&action=edit Bug 15741: Fix rounding in total fines calculations C4::Members::GetMemberAccountRecords wrongly casts float to integer It's common to use sprintf in Perl to do this job. % perl -e 'print int(1000*64.60)."\n"'; 64599 % perl -e 'print sprintf("%.0f", 1000*64.60)."\n"'; 64600 Test plan: 1) Create manual invoice for 64.60 (or 1.14, 1.36, ...) 2) Try to pay it using "Pay amount" or "Pay selected" buttons -- 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=15741 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Assignee|koha-bugs@lists.koha-commun |jonathan.druart@bugs.koha-c |ity.org |ommunity.org -- 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=15741 Sally Healey <sally.healey@cheshiresharedservices.gov.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sally.healey@cheshireshared | |services.gov.uk --- Comment #2 from Sally Healey <sally.healey@cheshiresharedservices.gov.uk> --- I was keen to sign this patch off, as this causes terrible problems for us. Test plan: 1) Create manual invoice for 64.60 (or 1.14, 1.36, ...) 2) Try to pay it using "Pay amount" or "Pay selected" buttons Using 'Pay Amount' button: 1) Create manual invoice for a single payment: 64.60 (or 1.14, 1.36, ...) 2) Pay it using 'Pay Amount' button Pass: this works as expected. 1) Create manual invoice for multiple lines which total: 64.60 (or 1.14, 1.36, ...) 2) Pay all lines using 'Pay Amount' button Pass: this works as expected. 1) Create manual invoice for multiple lines. 2) Decide to pay an amount which totals: 64.60 (or 1.14, 1.36, ...) 3) Pay using 'Pay Amount' button Pass: this works as expected. Using 'Pay Selected' button: 1) Create manual invoice for a single payment: 64.60 (or 1.14, 1.36, ...) 2) Pay it using 'Pay Selected' button Fail: 'You must pay a value less than or equal to 64.60 (or 1.14, 1.36, ...)' displays 1) Create manual invoice for multiple lines which total: 64.60 (or 1.14, 1.36, ...) 2) Pay all lines using 'Pay Selected' button Pass: this works as expected 1) Create manual invoice for multiple lines. 2) Choose some lines which total: 64.60 (or 1.14, 1.36, ...) 3) Pay chosen lines using 'Pay Selected' button Pass: the error line does not appear. However, there seems to be a major error with the 'Pay Selected' function, which is reported in the following bug: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15397 Can we sign off this patch as it mends the functionality of the 'Pay Amount' button and focus on the 'Pay Selected' issue in a different bug - which appears to be a much bigger problem? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Sally Healey from comment #2)
Can we sign off this patch as it mends the functionality of the 'Pay Amount' button and focus on the 'Pay Selected' issue in a different bug - which appears to be a much bigger problem?
Yes, definitely. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=15397 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 sandboxes@biblibre.com <sandboxes@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sandboxes@biblibre.com Status|Needs Signoff |Signed Off --- Comment #4 from sandboxes@biblibre.com <sandboxes@biblibre.com> --- Patch tested with a sandbox, by Sally Healey <sally.healey@cheshiresharedservices.gov.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 sandboxes@biblibre.com <sandboxes@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #48776|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 --- Comment #5 from sandboxes@biblibre.com <sandboxes@biblibre.com> --- Created attachment 49087 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=49087&action=edit Bug 15741: Fix rounding in total fines calculations C4::Members::GetMemberAccountRecords wrongly casts float to integer It's common to use sprintf in Perl to do this job. % perl -e 'print int(1000*64.60)."\n"'; 64599 % perl -e 'print sprintf("%.0f", 1000*64.60)."\n"'; 64600 Test plan: 1) Create manual invoice for 64.60 (or 1.14, 1.36, ...) 2) Try to pay it using "Pay amount" or "Pay selected" buttons Signed-off-by: Sally Healey <sally.healey@cheshiresharedservices.gov.uk> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #49087|0 |1 is obsolete| | --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 49484 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=49484&action=edit [PASSED QA] Bug 15741: Fix rounding in total fines calculations C4::Members::GetMemberAccountRecords wrongly casts float to integer It's common to use sprintf in Perl to do this job. % perl -e 'print int(1000*64.60)."\n"'; 64599 % perl -e 'print sprintf("%.0f", 1000*64.60)."\n"'; 64600 Test plan: 1) Create manual invoice for 64.60 (or 1.14, 1.36, ...) 2) Try to pay it using "Pay amount" or "Pay selected" buttons Signed-off-by: Sally Healey <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 --- Comment #7 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 49495 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=49495&action=edit Bug 15741: (regression tests) Rounding is not calculated correctly 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=15741 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #49484|0 |1 is obsolete| | --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 49496 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=49496&action=edit Bug 15741: Fix rounding in total fines calculations C4::Members::GetMemberAccountRecords wrongly casts float to integer It's common to use sprintf in Perl to do this job. % perl -e 'print int(1000*64.60)."\n"'; 64599 % perl -e 'print sprintf("%.0f", 1000*64.60)."\n"'; 64600 Test plan: 1) Create manual invoice for 64.60 (or 1.14, 1.36, ...) 2) Try to pay it using "Pay amount" or "Pay selected" buttons Signed-off-by: Sally Healey <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> 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=15741 Brendan Gallagher <brendan@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |brendan@bywatersolutions.co | |m Status|Passed QA |Pushed to Master --- Comment #9 from Brendan Gallagher <brendan@bywatersolutions.com> --- Pushed to Master - Should be in May 2016 release. Thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable CC| |julian.maurice@biblibre.com --- Comment #10 from Julian Maurice <julian.maurice@biblibre.com> --- Patches pushed to 3.22.x, will be in 3.22.6 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Frédéric Demians <frederic@tamil.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |frederic@tamil.fr --- Comment #11 from Frédéric Demians <frederic@tamil.fr> --- Pushed to 3.20.x, will be in 3.20.11. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |larit@student.uef.fi --- Comment #12 from Lari Taskula <larit@student.uef.fi> --- This bug still appears in master at "Pay amount" and "Pay selected" for payment of 1.14, but not with 64.60. To replicate: 1. Go to patron's fines tab, make sure there are no outstanding payments. 2. Via "Create manual invoice" tab, create one fine of 1.14 3. Go to Pay fines tab 4. Click "Pay amount" and confirm. 5. Observe error message "You must pay a value less than or equal to 1.14." 6. Go to Pay fines tab 7. Click "Pay selected" and confirm 8. Observe error message "You must pay a value less than or equal to 1.14." However, via individual row's "Pay" button it seems to work. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17140 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 [Bug 17140] Incorrect rounding in total fines calculations, part 2 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=18481 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=18736 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=17140 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org