Bugzilla – Attachment 49484 Details for
Bug 15741
Incorrect rounding in total fines calculations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 15741: Fix rounding in total fines calculations
PASSED-QA-Bug-15741-Fix-rounding-in-total-fines-ca.patch (text/plain), 1.34 KB, created by
Katrin Fischer
on 2016-03-23 22:45:57 UTC
(
hide
)
Description:
[PASSED QA] Bug 15741: Fix rounding in total fines calculations
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2016-03-23 22:45:57 UTC
Size:
1.34 KB
patch
obsolete
>From 3b7c865ff87a882aea4c0e2be5539a09bf46f779 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 8 Mar 2016 11:58:24 +0000 >Subject: [PATCH] [PASSED QA] Bug 15741: Fix rounding in total fines > calculations > >C4::Members::GetMemberAccountRecords wrongly casts float to integer >It's common to use sprintf in Perl to do this job. > >% perl -e 'print int(1000*64.60)."\n"'; >64599 >% perl -e 'print sprintf("%.0f", 1000*64.60)."\n"'; >64600 > >Test plan: >1) Create manual invoice for 64.60 (or 1.14, 1.36, ...) >2) Try to pay it using "Pay amount" or "Pay selected" buttons > >Signed-off-by: Sally Healey <sally.healey@cheshiresharedservices.gov.uk> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Members.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index ac64477..60af264 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -1062,7 +1062,7 @@ sub GetMemberAccountRecords { > } > $acctlines[$numlines] = $data; > $numlines++; >- $total += int(1000 * $data->{'amountoutstanding'}); # convert float to integer to avoid round-off errors >+ $total += sprintf "%.0f", 1000*$data->{amountoutstanding}; # convert float to integer to avoid round-off errors > } > $total /= 1000; > return ( $total, \@acctlines,$numlines); >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15741
:
48776
|
49087
|
49484
|
49495
|
49496