[Koha-bugs] [Bug 3379] New: Rounding error for fines total in C4::Members::GetMemberAccountRecords
bugzilla-daemon at liblime.com
bugzilla-daemon at liblime.com
Tue Jun 30 20:43:03 CEST 2009
http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3379
Summary: Rounding error for fines total in
C4::Members::GetMemberAccountRecords
Product: Koha
Version: HEAD
Platform: Other
OS/Version: Linux - Debian
Status: NEW
Severity: minor
Priority: P4
Component: Staff Client
AssignedTo: dbavousett at ptfs.com
ReportedBy: dbavousett at ptfs.com
Estimated Hours: 0.0
Change sponsored?: ---
In this routine, perl retrieves all accountline records for a given borrower
from the database, and shoves them into rows for handing back. This works
fine, as does the count of rows. To return the total, however, it multiplies
each row's amountoutstanding by 100, sums, then after the loop, divides by 100.
Internal documentation suggests that this is to prevent rounding error.
However, the data is already stored as decimal(28,6), and when there are large
numbers of zero-balance items (thirty, in the example I discovered), this
behavior actually *causes* rounding errors, causing the total to be low by
0.01.
There are two possible ways of handling this, perhaps. Increase the
multiply-and-divide to 1000, or eliminate it altogether. The database
correctly returns the sum when asked for SUM(amountoutstanding) WHERE
borrowernumber=<foo>, which suggests to me that eliminating this bit of
fan-dancing is probably the Right Thing. Comments, please, but I intend to
patch it one way or the other in the next day or two.
--
Configure bugmail: http://bugs.koha.org/cgi-bin/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the Koha-bugs
mailing list