[Koha-bugs] [Bug 24855] New: Lost items not marked returned when floating-point math causes amountoutstanding to be not-quite-zero

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Mar 11 21:10:36 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24855

            Bug ID: 24855
           Summary: Lost items not marked returned when floating-point
                    math causes amountoutstanding to be not-quite-zero
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: Fines and fees
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: andrew at bywatersolutions.com
        QA Contact: testopia at bugs.koha-community.org

Floating point math and a strict "if amountoutstand=0" result in things not
getting marked as returned when they should. I've had a hard time figuring out
exactly when this will go wrong, so I've got some very specific steps to
recreate. 

To test:
- set MarkLostItemsAsReturned to never mark items returned
- turn on Fines log
- find/create a patron with no outstanding fees or fines
- manually apply 8 overdue charges of $4.10
- create an item with a replacement cost of 6.99
- check item out to patron
- mark item lost, generating 6.99 lost fee for patron
- pay off entire balance using the Pay Amount button
- confirm patron no longer owes any fees, but item has not been marked as
returned when fee was paid off
- check fines log, see that the accountline for this lost fee recorded a
payment of "6.98999999999999" and a new amountoutstanding of
"7.105427357601e-15"

While we round these values to 4 decimal places in accountlines, that rounding
happens *after* Koha checks if amountoutstanding=0 when deciding whether or not
to mark the lost item returned.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list