From 1854cc4bfac6ac8be56f1504cc4a66c3e95522cb Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Thu, 18 Aug 2016 15:17:58 +0300 Subject: [PATCH] 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 --- C4/Members.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Members.pm b/C4/Members.pm index 061172f..8596e4d 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1026,6 +1026,7 @@ sub GetMemberAccountRecords { $total += sprintf "%.0f", 1000*$data->{amountoutstanding}; # convert float to integer to avoid round-off errors } $total /= 1000; + $total = 0 + sprintf "%.6f", $total; # fix rounding error return ( $total, \@acctlines,$numlines); } -- 1.9.1