[open-ils-commits] ***SPAM*** [GIT] Evergreen ILS branch master updated. 4159da23f671663ffaf3d40227b2228e28f69006

Evergreen Git git at git.evergreen-ils.org
Wed Nov 20 10:57:01 EST 2013


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  4159da23f671663ffaf3d40227b2228e28f69006 (commit)
       via  18812d0ae7de3cc62caf0e00fd284e706a940f03 (commit)
      from  49a6922daf40f29726df34d008d81efe677016f5 (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 4159da23f671663ffaf3d40227b2228e28f69006
Author: Bill Erickson <berick at esilibrary.com>
Date:   Fri Nov 15 17:06:53 2013 -0500

    LP#1251774 exit and alert on multiple payments per xact
    
    If more than one payment for a transaction is received, exit the API
    call early and return a MULTIPLE_PAYMENTS_FOR_XACT event.
    
    Signed-off-by: Bill Erickson <berick at esilibrary.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

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 c127d75..a6220ed 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
@@ -170,7 +170,10 @@ sub make_payments {
     my @unique_xact_payments;
     for my $pay (@{$payments->{payments}}) {
         my $xact_id = $pay->[0];
-        next if (exists($xacts{$xact_id}));
+        if (exists($xacts{$xact_id})) {
+            $e->rollback;
+            return OpenILS::Event->new('MULTIPLE_PAYMENTS_FOR_XACT');
+        }
 
         my $xact = $e->retrieve_money_billable_transaction_summary($xact_id)
             or return $e->die_event;

commit 18812d0ae7de3cc62caf0e00fd284e706a940f03
Author: Mike Rylander <mrylander at gmail.com>
Date:   Fri Nov 15 16:40:36 2013 -0500

    Enforce one-payment-per-xact-per-call
    
    There is no legitimate reason for a transaction to receive more than
    one payment per call to open-ils.circ open-ils.circ.money.payment,
    but we have seen the staff client generate such a data structure. This
    leads to seemingly duplicate payments, and is bad all around.  So,
    we will enforce the restriction by taking only the first payment per
    xact in the list of payments.
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Bill Erickson <berick at esilibrary.com>

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 b46e578..c127d75 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
@@ -162,8 +162,16 @@ sub make_payments {
     # first collect the transactions and make sure the transaction
     # user matches the requested user
     my %xacts;
+
+    # We rewrite the payments array for sanity's sake, to avoid more
+    # than one payment per transaction per call, which is not legitimate
+    # but has been seen in the wild coming from the staff client.  This
+    # is presumably a staff client (xulrunner) bug.
+    my @unique_xact_payments;
     for my $pay (@{$payments->{payments}}) {
         my $xact_id = $pay->[0];
+        next if (exists($xacts{$xact_id}));
+
         my $xact = $e->retrieve_money_billable_transaction_summary($xact_id)
             or return $e->die_event;
         
@@ -173,7 +181,9 @@ sub make_payments {
         }
 
         $xacts{$xact_id} = $xact;
+        push @unique_xact_payments, $pay;
     }
+    $payments->{payments} = \@unique_xact_payments;
 
     my @payment_objs;
 

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

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


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list