[open-ils-commits] [GIT] Evergreen ILS branch master updated. d7fba543e4306114f5f78561e7448364438c09b5

Evergreen Git git at git.evergreen-ils.org
Sat Feb 27 18:07:45 EST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  d7fba543e4306114f5f78561e7448364438c09b5 (commit)
      from  7a6c4d7da0ec5fa1e8babce91d236638660b083e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d7fba543e4306114f5f78561e7448364438c09b5
Author: Bill Erickson <berickxx at gmail.com>
Date:   Tue Jul 14 14:25:34 2015 -0400

    LP#1474566 Avoid credit card payment rounding
    
    Calculate total amount for credit payment as integers to avoid rounding
    errors w/ large sets of small billings.
    
    E.g. avoid trying to pay a fine of 9.999999999999 for a set of fines
    which should add up to 10.00.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Ben Shum <ben at evergreener.net>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
index a558777..666b402 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
@@ -321,7 +321,8 @@ sub make_payments {
         $amount =~ s/\$//og; # just to be safe
         my $trans = $xacts{$transid};
 
-        $total_paid += $amount;
+        # add amounts as integers
+        $total_paid += (100 * $amount);
 
         my $org_id = $U->xact_org($transid, $e);
 
@@ -396,6 +397,9 @@ sub make_payments {
 
     } # all payment objects have been created and inserted. 
 
+    # return to decimal format, forcing X.YY format for consistency.
+    $total_paid = sprintf("%.2f", $total_paid / 100);
+
     #### NO WRITES TO THE DB ABOVE THIS LINE -- THEY'LL ONLY BE DISCARDED  ###
     $e->rollback;
 

-----------------------------------------------------------------------

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Circ/Money.pm |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list