[open-ils-commits] [GIT] Evergreen ILS branch rel_2_9 updated. 00b1e695be7e693903630fe86eabdb8624f5c663

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, rel_2_9 has been updated
       via  00b1e695be7e693903630fe86eabdb8624f5c663 (commit)
      from  5f9ab6499c3539fd84b6517bca25ff59614a78fc (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 00b1e695be7e693903630fe86eabdb8624f5c663
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 2cd07f8..ca692fb 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);
 
@@ -399,6 +400,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