Bugzilla – Attachment 86051 Details for
Bug 17140
Incorrect rounding in total fines calculations, part 2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17140: fix rounding errors when paying fines
Bug-17140-fix-rounding-errors-when-paying-fines.patch (text/plain), 2.12 KB, created by
Josef Moravec
on 2019-03-05 10:54:57 UTC
(
hide
)
Description:
Bug 17140: fix rounding errors when paying fines
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2019-03-05 10:54:57 UTC
Size:
2.12 KB
patch
obsolete
>From 0a6eff16e7fc9e3fb837bde76db369914bf99cca Mon Sep 17 00:00:00 2001 >From: Blou <philippe.blouin@inlibro.com> >Date: Fri, 21 Dec 2018 10:33:29 -0500 >Subject: [PATCH] Bug 17140: fix rounding errors when paying fines > >Whenever a fine (accountlines in DB) has a precision longer than two floating points, it becomes very hard for a user to clear it. >Ex: 1.035 will be displayed as 1.04 or 1.03 depending on the screen. But entering any of those value in Pay Fine will not clear it. >The user has no way to know the exact value to enter. > >This fix makes sure that the intent of the user is met, by matching the EXACT needed sum when the difference is less than 0.01. > >TEST >1) Create a 1.035 fine > - Go to a Patron screen > - Fines tab on the left > - Create manual invoice >2) go to Pay fines, click Pay amount on bottom left. >3) It will show 1.03 as Total, and as Collect from patron. Click confirm. >4) An error message will appear. >5) Apply patch, do again. > >Signed-off-by: Hayley Mapley <hayleymapley@catalyst.net.nz> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > members/pay.pl | 1 + > members/paycollect.pl | 1 + > 2 files changed, 2 insertions(+) > >diff --git a/members/pay.pl b/members/pay.pl >index 848141906e..4a8dc00e40 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -97,6 +97,7 @@ elsif ( $input->param('confirm_writeoff') ) { > > my $accountline = Koha::Account::Lines->find( $accountlines_id ); > >+ $amount = $accountline->amountoutstanding if (abs($amount - $accountline->amountoutstanding) < 0.01); > if ( $amount > $accountline->amountoutstanding ) { > print $input->redirect( "/cgi-bin/koha/members/paycollect.pl?" > . "borrowernumber=$borrowernumber" >diff --git a/members/paycollect.pl b/members/paycollect.pl >index abd96b5de3..1442d67ed1 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -106,6 +106,7 @@ if ( $individual || $writeoff ) { > } > > if ( $total_paid and $total_paid ne '0.00' ) { >+ $total_paid = $total_due if (abs($total_paid - $total_due) < 0.01); > if ( $total_paid < 0 or $total_paid > $total_due ) { > $template->param( > error_over => 1, >-- >2.11.0
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 17140
:
54542
|
54565
|
54566
|
54611
|
54642
|
54643
|
82375
|
83467
|
86044
|
86051
|
93553
|
93554
|
93678
|
93715
|
93716
|
93717