From 23ac984823301a9026059247d6e1adc45eccc145 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 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 --- C4/Members.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 061172f..51a857d 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -1023,9 +1023,8 @@ sub GetMemberAccountRecords { } $acctlines[$numlines] = $data; $numlines++; - $total += sprintf "%.0f", 1000*$data->{amountoutstanding}; # convert float to integer to avoid round-off errors + $total += sprintf '%.2f', $data->{amountoutstanding}; } - $total /= 1000; return ( $total, \@acctlines,$numlines); } -- 1.9.1