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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
f1e1eaa328
commit
92fbb1f3d0
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue