[Bug 26076] New: Paying selected accountlines in full may result in the error "You must pay a value less than or equal to $x"
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Bug ID: 26076 Summary: Paying selected accountlines in full may result in the error "You must pay a value less than or equal to $x" 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: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE -- 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=26076 Kyle M Hall <kyle@bywatersolutions.com> 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=26076 --- Comment #1 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 107471 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107471&action=edit Bug 26076: Paying selected accountlines in full may result in the error "You must pay a value less than or equal to $x" This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE Test Plan: 1) Apply this patch 2) Restart all the things! 3) Verify that "Write off selected" functions as usual -- 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=26076 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.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=26076 Amit Gupta <amitddng135@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amit.gupta@informaticsgloba | |l.com, | |amitddng135@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #2 from Amit Gupta <amitddng135@gmail.com> --- (In reply to Kyle M Hall from comment #1)
Created attachment 107471 [details] [review] Bug 26076: Paying selected accountlines in full may result in the error "You must pay a value less than or equal to $x"
This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE
Test Plan: 1) Apply this patch 2) Restart all the things! 3) Verify that "Write off selected" functions as usual
Hi Kyle, I am unable to reproduce the issue. I have checked multiple float values for ex: 114.25, 102.21, 41.36. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> ---
I am unable to reproduce the issue. I have checked multiple float values for ex: 114.25, 102.21, 41.36.
Same here. The bug clearly exists as I demonstrated in the video, but I can't reproduce it on demand either. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Amit Gupta <amitddng135@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #107471|0 |1 is obsolete| | --- Comment #4 from Amit Gupta <amitddng135@gmail.com> --- Created attachment 107503 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107503&action=edit Bug 26076: Paying selected accountlines in full may result in the error "You must pay a value less than or equal to $x" I have given the signoff but unable reproduce the issue. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Amit Gupta <amitddng135@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #5 from Amit Gupta <amitddng135@gmail.com> --- (In reply to Kyle M Hall from comment #3)
I am unable to reproduce the issue. I have checked multiple float values for ex: 114.25, 102.21, 41.36.
Same here. The bug clearly exists as I demonstrated in the video, but I can't reproduce it on demand either.
Adding Katrin -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Amit Gupta <amitddng135@gmail.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=26076 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joonas.kylmala@helsinki.fi --- Comment #6 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- How to reproduce: 1) Create manual invoice => amount 1.00 2) Create manual credit => amount 0.011111 3) Make a payment => Click Apply -0.01 4) Click "Pay amount" and then on the next page "Confirm" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #7 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- What I described in comment #6 could be of the same origin as the summation issue originally described here, maybe because in db we have 6 decimals and in GUI only 2 decimals? The proposed fix might solve that one case and we could apply this patch to fix that, but I would just like to have the commit message in that case still be fixed, now it describes the bug and not the change, please see <https://wiki.koha-community.org/wiki/Commit_messages#Examples>. Marking this FQA until the commit message is fixed (or a more generic patch is submitted to solve this class of bugs). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #8 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- What I gather, the issue I mentioned in comment #6 seems to be just weird behaviour caused by not having RoundFinesAtPayment systempref enabled and not related to this. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #107503|0 |1 is obsolete| | --- Comment #9 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 107516 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107516&action=edit Bug 26076: Sum the amount due in the database query instead of a loop in Perl This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE Test Plan: 1) Apply this patch 2) Restart all the things! 3) Verify that "Write off selected" functions as usual Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #10 from Kyle M Hall <kyle@bywatersolutions.com> --- I should also note that the library in my video has RoundFinesAtPayment disabled. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #11 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- Thanks for the commit message fix, Kyle! I was about to pass QA for this... But then I ended up with this error on my last test: DBIx::Class::Storage::DBI::_dbh_execute(): Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause at /kohadevbox/koha/members/paycollect.pl line 157 at /usr/share/perl5/DBIx/Class/Exception.pm line 77 Without the patch provided here the error doesn't happen. How to reproduce: 0) Apply patch provided in this bug report & restart plack 1) Have RoundFinesAtPayment = No (not sure this is relevant though) 2) Create 3 manual invoices with the amount of 3.33 3) Make a payment > write off selected 4) The error should appear. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #12 from Kyle M Hall <kyle@bywatersolutions.com> --- (In reply to Joonas Kylmälä from comment #11)
Thanks for the commit message fix, Kyle! I was about to pass QA for this... But then I ended up with this error on my last test:
DBIx::Class::Storage::DBI::_dbh_execute(): Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause at /kohadevbox/koha/members/paycollect.pl line 157 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
Without the patch provided here the error doesn't happen. How to reproduce:
0) Apply patch provided in this bug report & restart plack 1) Have RoundFinesAtPayment = No (not sure this is relevant though) 2) Create 3 manual invoices with the amount of 3.33 3) Make a payment > write off selected 4) The error should appear.
Interesting, I have no idea why I didn't get this error in my testing! Followup incoming! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #107516|0 |1 is obsolete| | --- Comment #13 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 107589 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107589&action=edit Bug 26076: (QA Follow up) Prevent error by using a fresh resultset -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #107589|0 |1 is obsolete| | --- Comment #14 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 107590 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107590&action=edit Bug 26076: Sum the amount due in the database query instead of a loop in Perl This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE Test Plan: 1) Apply this patch 2) Restart all the things! 3) Verify that "Write off selected" functions as usual Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #15 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 107591 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=107591&action=edit Bug 26076: (QA Follow up) Prevent error by using a fresh resultset -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #16 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I was able to reproduce the error: When adding the manual invoices for testing, enter values with more than 2 decimals. But it only prevents me from paying when the amount outstanding and the amount being paid are off by one cent. I believe this patch doesn't hurt things, but it would be great to see what's going on in the db when this error appears. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #17 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Found Joonas comment now: (In reply to Joonas Kylmälä from comment #6)
How to reproduce: 1) Create manual invoice => amount 1.00 2) Create manual credit => amount 0.011111 3) Make a payment => Click Apply -0.01 4) Click "Pay amount" and then on the next page "Confirm"
Following this test plan, I can still not pay the remaining fine off, the error is as before: You must pay a value less than or equal to 0.99. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Joonas Kylmälä <joonas.kylmala@helsinki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #18 from Joonas Kylmälä <joonas.kylmala@helsinki.fi> --- (In reply to Katrin Fischer from comment #17)
Found Joonas comment now:
(In reply to Joonas Kylmälä from comment #6)
How to reproduce: 1) Create manual invoice => amount 1.00 2) Create manual credit => amount 0.011111 3) Make a payment => Click Apply -0.01 4) Click "Pay amount" and then on the next page "Confirm"
Following this test plan, I can still not pay the remaining fine off, the error is as before:
You must pay a value less than or equal to 0.99.
Katrin, this error above I erroneously identified of being related to this. The error Kyle reported here was a rounding error and this error I put steps to reproduce intentionally creates more decimals than the intranet interface can show or accepts payments for. Even if the intranet interface was fixed the rounding error would still be there. Moving back to "Signed off". -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #19 from Katrin Fischer <katrin.fischer@bsz-bw.de> ---
You must pay a value less than or equal to 0.99.
Katrin, this error above I erroneously identified of being related to this. The error Kyle reported here was a rounding error and this error I put steps to reproduce intentionally creates more decimals than the intranet interface can show or accepts payments for. Even if the intranet interface was fixed the rounding error would still be there. Moving back to "Signed off".
Thx Joonas. So we still have no way to recreate the rounding issue, is that correct? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 --- Comment #20 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Joonas, I think you are in deeper here than me - could you check the follow-up and finish up here? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #107590|0 |1 is obsolete| | --- Comment #21 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 108938 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108938&action=edit Bug 26076: Sum the amount due in the database query instead of a loop in Perl This appears to be a bug due to inaccuracies in floating point math. I've been unable to reproduce it on demand. Sometimes when using the "Write off selected" button, Koha will give the error that the payment is more than the amount owed, even though they are the same. The solution I've implemented is to move the summation from Perl code to the database query. This video demonstrates the issue and afterward, shows the error goes away after the patch is applied: https://monosnap.com/file/pG69HC7iI9mU9kkuoCtbkVzVTffKlE Test Plan: 1) Apply this patch 2) Restart all the things! 3) Verify that "Write off selected" functions as usual Signed-off-by: Amit Gupta <amit.gupta@informaticsglobal.com> 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=26076 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #107591|0 |1 is obsolete| | --- Comment #22 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 108939 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=108939&action=edit Bug 26076: (QA Follow up) Prevent error by using a fresh resultset 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=26076 --- Comment #23 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- As the error has proven hard to replicate I am passing this mostly on base of regression testing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |23788 CC| |jonathan.druart@bugs.koha-c | |ommunity.org Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23788 [Bug 23788] Writing off multiple fees allows 'overpayment' of those fees -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |20.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=26076 --- Comment #24 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Pushed to master for 20.11, thanks to everybody involved! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=24855 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable CC| |lucas@bywatersolutions.com Version(s)|20.11.00 |20.11.00, 20.05.04 released in| | --- Comment #25 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 20.05.x for 20.05.04 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Pushed to oldstable Version(s)|20.11.00, 20.05.04 |20.11.00, 20.05.04, released in| |19.11.10 CC| |aleisha@catalyst.net.nz --- Comment #26 from Aleisha Amohia <aleisha@catalyst.net.nz> --- backported to 19.11.x for 19.11.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net --- Comment #27 from Victor Grousset/tuxayo <victor@tuxayo.net> --- Not backported to oldoldstable (19.05.x). Feel free to ask if it's needed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=26536 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26076 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |26536 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26536 [Bug 26536] "Writeoff/Pay selected" deducts from old unpaid debts first -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org