[Bug 17140] New: Incorrect rounding in total fines calculations, part 2
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Bug ID: 17140 Summary: Incorrect rounding in total fines calculations, part 2 Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: larit@student.uef.fi QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com Bug 15741 fixes some rounding issues but not all, for example trying to paying a fine of 1.14 still does not work (also 1.39). To replicate bug: 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." -- 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=17140 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |15741 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15741 [Bug 15741] Incorrect rounding in total fines calculations -- 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=17140 --- Comment #1 from Lari Taskula <larit@student.uef.fi> --- Created attachment 54542 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54542&action=edit Bug 17140: Test to cover more rounding issues in fines calculations To test: 1. Run t/db_dependent/Members.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=17140 --- Comment #2 from Lari Taskula <larit@student.uef.fi> --- Created attachment 54565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54565&action=edit Bug 17140: Fix rounding in total fines calculations, part 2 This patch fixes still occuring issue with total fines calculations. To test: 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. Run t/db_dependent/Members.t 7. Observe failure in a test case 8. Apply patch. 7. Repeat step 3 and 4 8. Observe that payment goes through 9. Run t/db_dependent/Members.t 10. Observe test passing -- 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=17140 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- 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=17140 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54565|0 |1 is obsolete| | --- Comment #3 from Lari Taskula <larit@student.uef.fi> --- Created attachment 54566 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54566&action=edit Bug 17140: Fix rounding in total fines calculations, part 2 This patch fixes still occuring issue with total fines calculations. To test: 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. Run t/db_dependent/Members.t 7. Observe failure in a test case 8. Apply patch. 9. Repeat step 3 and 4 10. Observe that payment goes through 11. Run t/db_dependent/Members.t 12. Observe test passing -- 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=17140 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch -- 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=17140 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #4 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I think we should remove the * 1000 / 1000 -- 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=17140 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |larit@student.uef.fi |ity.org | Severity|enhancement |normal -- 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=17140 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |veron@veron.ch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Jacek Ablewicz <abl@biblos.pk.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |abl@biblos.pk.edu.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54566|0 |1 is obsolete| | --- Comment #5 from Lari Taskula <larit@student.uef.fi> --- Created attachment 54611 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54611&action=edit Bug 17140: Fix rounding in total fines calculations, part 2 This patch fixes still occuring rounding issue with total fines calculations. To test: 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. Run t/db_dependent/Members.t 7. Observe failure in a test case 8. Apply patch. 9. Repeat step 3 and 4 10. Observe that payment goes through 11. Run t/db_dependent/Members.t 12. Observe test passing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #6 from Lari Taskula <larit@student.uef.fi> --- Is the precision of 2 decimal places enough? I saw it is used in boraccount.pl, pay.pl and moremember.pl and maybe this discussion has been had before? I think there can still be weird cases if you add a fine of 5.005 or anything that has more than 2 decimal places. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Marc Véron <veron@veron.ch> 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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #7 from Marc Véron <veron@veron.ch> --- In table accountlines, definition of amount is decimal 28,6 http://schema.koha-community.org/tables/accountlines.html I am able to enter a manual invoice like 0.008 (displays as 0.01) or 0.004 (displays as 0.00) The table then contains: mysql> select amount from accountlines where borrowernumber = 13; +----------+ | amount | +----------+ | 0.008000 | | 0.004000 | +----------+ The 'Pay fines' tab shows an amount of 0.01 and an amount of 0.00 I payed the first one (0.01), it asked 0.01 mysql> select amount from accountlines where borrowernumber = 13; +-----------+ | amount | +-----------+ | 0.008000 | | 0.004000 | | -0.010000 | +-----------+ The 'Pay fines tab then shows an amount of 0.00 If I want to pay using 'Pay' on the line, it asks for 0.00, but obviously it is not possible to pay the amount. Same with 'Pay amount' Now I add manual invoices, let's say 3 times 0.003 mysql> select amount from accountlines where borrowernumber = 13; +-----------+ | amount | +-----------+ | 0.008000 | | 0.004000 | | -0.010000 | | 0.003000 | | 0.003000 | | 0.003000 | +-----------+ The Account tab shows all 0.00 in 'Outstanding' column, but a 'Total due' of 0.01 A similar situation occurs with Rental discounts in Circulation and fines rules (smart-rules.pl), e.g. values like 2.961000 That will lead to confusion... What to do? Maybe the following: - Define a systemwide decimal precision for data entry of amounts? - Maybe depending on the decimal places in syspref CurrencyFormat? - Make Rental discounts round to that precision? - Allow 'Price' plug-in to override if more precision is necessary, e.g. for calculating / displaying taxes in acquisition? (Koha/Number/Price.pm) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Prices should be stored with a big precision (6 is largely enough) and displayed with 2 decimals. That is how it's done in the acq module and almost everywhere else I think. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #9 from Jacek Ablewicz <abl@biblos.pk.edu.pl> --- (In reply to Jonathan Druart from comment #8)
Prices should be stored with a big precision (6 is largely enough) and displayed with 2 decimals.
Hm, maybe charges / fines should be treated a bit differently.. When there is a fine like 1.342, and it displays as 1.32, how do you know what exact amount to enter to make account balanced? Doing a math (comparisons etc.) with amounts casted to .2f would solve some kinds of this problems (I think that's like accountants do it [on Discovery Channel]) to solve < .01 difference problems on invoices etc. Fine calculations in Koha a mostly done in floating-point - it's probably good enough for 99.9(9) of cases (~16 significant decimal digits precision with 64bit floats) as long as you are doing a casting (btw, to .2f or .6f ?) in most important places. Mysql calculations for decimal(x,y) are allegedly precise, though, and fine calculations in koha are not always floating-point, e.g. in GetMemberIssuesAndFines(): SELECT SUM(amountoutstanding) FROM accountlines Storing all fines/charges amounts rounded to .2f and doing most of the math in .2 precision is tempting (but that alone would not be enough to prevent all kinds of such problems) - hopefully nobody is using bitcoin as a main currency in Koha.. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #10 from Jacek Ablewicz <abl@biblos.pk.edu.pl> --- (In reply to Jonathan Druart from comment #4)
I think we should remove the * 1000 / 1000
+1, it isn't really serving any useful purpose, it's not warranted that the result of the multiplication will be an integer anyway. BTW, there is another one like that (*100, /100) in GetBorNotifyAcctRecord(). Still with an int() thing, which is definitely incorrect. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #11 from Marc Véron <veron@veron.ch> --- Created attachment 54642 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54642&action=edit Illustration of precision problem with calculated rental fees and manual invoices I made some screenshots to explain what I mean. (Screenshots made with patch applied). I still think that - it should not be possible to manually enter values like 1.003 (manual invoices, payment, credit, item rental fees, others?) - a calculated rental fee (from item rental fee and patron category discount) should be rounded to 2 decimals Otherwise, after payement, you will have remainders in the database that lead to strange behaviour (see attachment). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #12 from Marc Véron <veron@veron.ch> --- Created attachment 54643 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54643&action=edit Screenshots with some notes added Added the same screenshots with some notes on them. See comment #11 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Alex Buckley <alexbuckley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alexbuckley@catalyst.net.nz Status|Needs Signoff |Failed QA --- Comment #13 from Alex Buckley <alexbuckley@catalyst.net.nz> --- Running step 4 after applying the patch still throws the error ' You must pay a value less than or equal to 1.14.'. i.e. the payment does not go through after this patch is applied. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Marc Véron <veron@veron.ch> 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=17140 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mtompset@hotmail.com --- Comment #14 from Nick Clemens <nick@bywatersolutions.com> --- *** Bug 18481 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com --- Comment #15 from Nick Clemens <nick@bywatersolutions.com> --- *** Bug 18487 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |barton@bywatersolutions.com | |, cbrannon@cdalibrary.org, | |michael@bywatersolutions.co | |m -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 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=17140 Marc Véron <veron@veron.ch> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=15741 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Lisette Scheer <lisetteslatah@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lisetteslatah@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Brian <bklein@dubuque.lib.ia.us> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bklein@dubuque.lib.ia.us --- Comment #16 from Brian <bklein@dubuque.lib.ia.us> --- Has there been any more updates on bug 17140? Carnegie Stout Team. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Martha Fuerst <mfuerst@hmcpl.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mfuerst@hmcpl.org --- Comment #17 from Martha Fuerst <mfuerst@hmcpl.org> --- This is still a problem in 18.05. We have a workaroud (pay the fine in chunks), but if you pick the wrong chunks, it can still be an issue. Would love a fix. Thanks! -Marti Fuerst, Huntsville Madison-County Library System -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Barton Chittenden <barton@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |major --- Comment #18 from Barton Chittenden <barton@bywatersolutions.com> --- I'm changing the urgency to 'Major' -- this deals with fines, and is an issue that circulation staff will be hitting frequently. ByWater has multiple independent reports of this. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #19 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I am not sure if Lari is still actively developing on Koha? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|larit@live.fi |koha-bugs@lists.koha-commun | |ity.org --- Comment #20 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I confirmed with Lari that he is no longer doing Koha development - I am changing the assignee to default so someone else might pick it up. -- 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=17140 --- Comment #21 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 82375 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82375&action=edit Demonstration of List::Util->sum0 vs MySQL sum + 0 Run this file to compare the total when summing a list versus getting the sum from the DB and adding 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=17140 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |In Discussion --- Comment #22 from Nick Clemens <nick@bywatersolutions.com> --- I think this is resolved somewhat by bug 21673 - it changes the method for summing which seems to resolve the issue. The separate issue of 'partial cent' fines still exists, we should probably display all digits to 6 decimals and allow partial cent payments, but I think 21673 should be considered for backport to resolve rounding issues -- 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=17140 --- Comment #23 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Nick Clemens from comment #22)
I think this is resolved somewhat by bug 21673 - it changes the method for summing which seems to resolve the issue.
The separate issue of 'partial cent' fines still exists, we should probably display all digits to 6 decimals and allow partial cent payments, but I think 21673 should be considered for backport to resolve rounding issues
I don't like the idea of displaying 6 decimals really... -- 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=17140 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=21673 -- 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=17140 Christopher Davis <cgdavis@uintah.utah.gov> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |cgdavis@uintah.utah.gov -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Blou <philippe.blouin@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |philippe.blouin@inlibro.com Assignee|koha-bugs@lists.koha-commun |philippe.blouin@inlibro.com |ity.org | --- Comment #24 from Blou <philippe.blouin@inlibro.com> --- 6 decimal is ugly. We should never show technolgies' failings to the user. Just to confirm that Bug 21673 does not fix this issue. At least my client's version of it, which is trying to pay a 1.035 fine displayed as 1.04. I'll assign myself the issue and fix it tomorrow. IMO, we should solve this with common sense and not an accounting mentality. For 1.035, we display 1.04, as it should. Then on payment, we validate if there's a difference of less than 0.01. If so then AmountPaid = AmountNeededToBePaid. Just before the comparison. Anyway, accountants HATE those remaining cents at the end of the year. -- 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=17140 --- Comment #25 from Blou <philippe.blouin@inlibro.com> --- Created attachment 83467 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=83467&action=edit Bug 17140: fix rounding errors when paying fines Whenever a fine (accountlines in DB) has a precision longer than two floating points, it becomes very hard for a user to clear it. Ex: 1.035 will be displayed as 1.04 or 1.03 depending on the screen. But entering any of those value in Pay Fine will not clear it. The user has no way to know the exact value to enter. This fix makes sure that the intent of the user is met, by matching the EXACT needed sum when the difference is less than 0.01. TEST 1) Create a 1.035 fine - Go to a Patron screen - Fines tab on the left - Create manual invoice 2) go to Pay fines, click Pay amount on bottom left. 3) It will show 1.03 as Total, and as Collect from patron. Click confirm. 4) An error message will appear. 5) Apply patch, do again. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Blou <philippe.blouin@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff --- Comment #26 from Blou <philippe.blouin@inlibro.com> --- This patch does not fix the incongruities of having the 1.035 fine display as 1.04 in some screen and 1.03 in others. But this simple patch (independant from the others offered, careful when applying), does fix the impossible payment situation in a very elegant way. I think. :-) This is the most important. Trying to fix all the displays for quarter cents, or all input methods if you manage, would still leave clients just migrating with funky data in the situation of not being able to clear the fine. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Hayley Mapley <hayleymapley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hayleymapley@catalyst.net.n | |z Status|Needs Signoff |Patch doesn't apply --- Comment #27 from Hayley Mapley <hayleymapley@catalyst.net.nz> --- Patch 54542 did not apply cleanly. Marking as Patch doesn't apply. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #28 from Blou <philippe.blouin@inlibro.com> --- Hi Hayley, Have you tried applying only 83467 (the last one), which is separated from the others (see my previous comments)? Or maybe its solution is not what you're looking for... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Hayley Mapley <hayleymapley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff --- Comment #29 from Hayley Mapley <hayleymapley@catalyst.net.nz> --- (In reply to Blou from comment #28)
Hi Hayley, Have you tried applying only 83467 (the last one), which is separated from the others (see my previous comments)? Or maybe its solution is not what you're looking for...
Hi Blou, My bad! I missed your comment. Will try to sign off today. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Hayley Mapley <hayleymapley@catalyst.net.nz> 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=17140 Hayley Mapley <hayleymapley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #83467|0 |1 is obsolete| | --- Comment #30 from Hayley Mapley <hayleymapley@catalyst.net.nz> --- Created attachment 86044 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86044&action=edit Bug 17140: fix rounding errors when paying fines Whenever a fine (accountlines in DB) has a precision longer than two floating points, it becomes very hard for a user to clear it. Ex: 1.035 will be displayed as 1.04 or 1.03 depending on the screen. But entering any of those value in Pay Fine will not clear it. The user has no way to know the exact value to enter. This fix makes sure that the intent of the user is met, by matching the EXACT needed sum when the difference is less than 0.01. TEST 1) Create a 1.035 fine - Go to a Patron screen - Fines tab on the left - Create manual invoice 2) go to Pay fines, click Pay amount on bottom left. 3) It will show 1.03 as Total, and as Collect from patron. Click confirm. 4) An error message will appear. 5) Apply patch, do again. Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josef.moravec@gmail.com Attachment #54542|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=17140 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54611|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=17140 --- Comment #31 from Josef Moravec <josef.moravec@gmail.com> --- I obsoleted first two patches, they do not apply anymore, the updated part of code was refactored and the original issue from comment 1 is fixed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #86044|0 |1 is obsolete| | --- Comment #32 from Josef Moravec <josef.moravec@gmail.com> --- Created attachment 86051 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86051&action=edit Bug 17140: fix rounding errors when paying fines Whenever a fine (accountlines in DB) has a precision longer than two floating points, it becomes very hard for a user to clear it. Ex: 1.035 will be displayed as 1.04 or 1.03 depending on the screen. But entering any of those value in Pay Fine will not clear it. The user has no way to know the exact value to enter. This fix makes sure that the intent of the user is met, by matching the EXACT needed sum when the difference is less than 0.01. TEST 1) Create a 1.035 fine - Go to a Patron screen - Fines tab on the left - Create manual invoice 2) go to Pay fines, click Pay amount on bottom left. 3) It will show 1.03 as Total, and as Collect from patron. Click confirm. 4) An error message will appear. 5) Apply patch, do again. Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |josef.moravec@gmail.com |y.org | Status|Signed Off |Passed QA --- Comment #33 from Josef Moravec <josef.moravec@gmail.com> --- I am passing it QA, as it is at least quick fix of long standing issue. It definitely could be done better, but it would need more refactoring and maybe some architectural changes I think. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #34 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- I am not against a quick fix, but things are weird (with or without the patch): Add a 1.035 fine, you see: https://snag.gy/hmFX51.jpg Go to make a payment, you see: https://snag.gy/0MuCxY.jpg Click "Pay", you see: https://snag.gy/bA5O3C.jpg If we push this as it, we should ask have people to focus on a global solution. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Josef Moravec <josef.moravec@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Failed QA --- Comment #35 from Josef Moravec <josef.moravec@gmail.com> --- (In reply to Jonathan Druart from comment #34)
I am not against a quick fix, but things are weird (with or without the patch):
Add a 1.035 fine, you see: https://snag.gy/hmFX51.jpg
Go to make a payment, you see: https://snag.gy/0MuCxY.jpg
Click "Pay", you see: https://snag.gy/bA5O3C.jpg
If we push this as it, we should ask have people to focus on a global solution.
Yes, it is definitely bad, and I thought, that we should push this and work on better general solutions, but thinking about this again: we should not push this, because it silently pay different amount then expected. The quick fix should be just show warning there is something wrong with some advice probably (like, writeoff an debit when it looks like zero, maybe...) Or, if we are able to fix it right until 19.05, then we should do it... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #36 from Blou <philippe.blouin@inlibro.com> --- To quote "if we are able to fix it right until 19.05, then we should do it..." This was opened in 2016, so good luck with that. It IS a complicated issue to fix right. The patch allows librarian to move ahead when this occurs whereas a popup will just tell them they are not crazy, but leave them helpless again. In our production environments, it has occured a few times (to much frustration and bewilderment, and never a complaint since we put the patch on, even though the discremencies in the UI a quite obvious). -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #37 from Josef Moravec <josef.moravec@gmail.com> --- (In reply to Blou from comment #36)
To quote "if we are able to fix it right until 19.05, then we should do it..."
This was opened in 2016, so good luck with that. It IS a complicated issue to fix right.
The patch allows librarian to move ahead when this occurs whereas a popup will just tell them they are not crazy, but leave them helpless again.
In our production environments, it has occured a few times (to much frustration and bewilderment, and never a complaint since we put the patch on, even though the discremencies in the UI a quite obvious).
I understand you.... But your patch could lead to bugs in fine reports, couldn't it? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #38 from Blou <philippe.blouin@inlibro.com> --- Interesting. Showing the extent of what to consider for a complete solution. That said, I wouldn't call it a "bug". The report would still work, but have a 0.005 discrepancy somewhere, right? To which I would oppose a 9$ discrepency because the staff could never enter the payment made by the borrower in the other case. I'm not particularly attached to this solution, I argue for the sake of the staff users who have encountered the problem, and I believe this is the lesser of two evils (the other one being the status quo). If Evil is against your policy, that's ok too... :-) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 koha-US bug tracker <bugzilla@koha-us.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@koha-us.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |caroline.cyr-la-rose@inlibr | |o.com --- Comment #39 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- We had a client who had a problem that I think is related to this one, but I'm not sure. The accidentally entered 0.251 in the circulation rules fines instead of 0.25. When the patron wanted to pay, it was impossible. There's nothing in the interface that suggests there was a third decimal because the display is truncated (or rounded?) to two decimals. But when going into the database, we noticed there were three decimals. Here is how to reproduce on master : (0. In Administration > System preferences, make sure your finesMode syspref is set to Calculate and charge) 1. Go to Administration > Circulation and fines rules and add or modify an existing rule to enter 0.251 in the fines. 2. Save your rule (2.5 *Notice the fine displayed is only 0.25*, and if you try to edit your rule again, it still displays only 0.25 even though in the database, is is saved as 0.251000; if you click edit, don't click save again because it will save it as two decimals, which is fine IRL, but the test won't work) 3. Check out an item to a patron with a due date in the past (using Checkout settings) 4. Run fines.pl 5. Go to the patron's accounting tab *Notice the fines are rounded/truncated to 2 decimals* (but if you look in the database, they have three decimals) 6. Try to pay the fines that have the three decimals (in master the payment is not blocked whereas in 18.05 there is an error message) 7. Notice the fine is still in the accounts to pay but the amount oustanding is 0, if you go in the db, you will see that there is still some money owed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Blou <philippe.blouin@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off --- Comment #40 from Blou <philippe.blouin@inlibro.com> --- 19.05 came and went. So will 19.11... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|josef.moravec@gmail.com |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_19_11_candidate 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=17140 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #86051|0 |1 is obsolete| | --- Comment #41 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 93553 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93553&action=edit Bug 17140: fix rounding errors when paying fines Whenever a fine (accountlines in DB) has a precision longer than two floating points, it becomes very hard for a user to clear it. Ex: 1.035 will be displayed as 1.04 or 1.03 depending on the screen. But entering any of those value in Pay Fine will not clear it. The user has no way to know the exact value to enter. This fix makes sure that the intent of the user is met, by matching the EXACT needed sum when the difference is less than 0.01. TEST 1) Create a 1.035 fine - Go to a Patron screen - Fines tab on the left - Create manual invoice 2) go to Pay fines, click Pay amount on bottom left. 3) It will show 1.03 as Total, and as Collect from patron. Click confirm. 4) An error message will appear. 5) Apply patch, do again. Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #42 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 93554 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93554&action=edit Bug 17140: Make rounding syspref controlled Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |23728 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23728 [Bug 23728] Rounding code should be moved to a Koha module so code can be centralised -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 --- Comment #43 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 93678 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93678&action=edit Bug 17140: Atomic update file -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Jesse Maseto <jesse@bywatersolutions.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=17140 Jesse Maseto <jesse@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #93553|0 |1 is obsolete| | --- Comment #44 from Jesse Maseto <jesse@bywatersolutions.com> --- Created attachment 93715 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93715&action=edit Works. Thanks all. -JesseM Bug 17140: fix rounding errors when paying fines Whenever a fine (accountlines in DB) has a precision longer than two floating points, it becomes very hard for a user to clear it. Ex: 1.035 will be displayed as 1.04 or 1.03 depending on the screen. But entering any of those value in Pay Fine will not clear it. The user has no way to know the exact value to enter. This fix makes sure that the intent of the user is met, by matching the EXACT needed sum when the difference is less than 0.01. TEST 1) Create a 1.035 fine - Go to a Patron screen - Fines tab on the left - Create manual invoice 2) go to Pay fines, click Pay amount on bottom left. 3) It will show 1.03 as Total, and as Collect from patron. Click confirm. 4) An error message will appear. 5) Apply patch, do again. Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Jesse Maseto <jesse@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #93554|0 |1 is obsolete| | --- Comment #45 from Jesse Maseto <jesse@bywatersolutions.com> --- Created attachment 93716 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93716&action=edit Bug 17140: Make rounding syspref controlled Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Jesse Maseto <jesse@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #93678|0 |1 is obsolete| | --- Comment #46 from Jesse Maseto <jesse@bywatersolutions.com> --- Created attachment 93717 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=93717&action=edit Bug 17140: Atomic update file Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=17140 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |19.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=17140 --- Comment #47 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work! Pushed to master for 19.11.00 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |Manual, | |release-notes-needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rel_19_11_candidate | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m Version(s)|19.11.00 |19.11.00,19.05.05 released in| | Status|Pushed to master |Pushed to stable --- Comment #48 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- Pushed to 19.05.x for 19.05.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 koha-US bug tracker <bugzilla@koha-us.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|bugzilla@koha-us.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|release-notes-needed | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org