added some more detailed logging
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 8 Nov 2006 19:17:37 +0000 (19:17 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 8 Nov 2006 19:17:37 +0000 (19:17 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6566 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Money.pm

index eb9fdd3..a7f728f 100644 (file)
@@ -85,7 +85,8 @@ sub make_payments {
                $trans = $self->fetch_mbts($client, $login, $transid);
                return $trans if $U->event_code($trans);
 
-               $logger->info("payment method retrieved transaction [$transid] with balance_owed = " . $trans->balance_owed);
+               $logger->info("payment: processing transaction [$transid] with balance_owed = ". 
+                       $trans->balance_owed. ",  payment amount = $amount, and payment type = $type");
 
                if($trans->usr != $userid) { # Do we need to restrict this in some way ??
                        $logger->info( " * User $userid is making a payment for " . 
@@ -100,6 +101,8 @@ sub make_payments {
 
                # A negative payment is a refund.  
                if( $amount < 0 ) {
+                       
+                       $logger->info("payment: received a negative payment (refund) of $amount");
 
                        # If the refund causes the transaction balance to exceed 0 dollars, 
                        # we are in effect loaning the patron money.  This is not allowed.
@@ -112,7 +115,6 @@ sub make_payments {
                        my $desk_total = 0;
                        my $desk_payments = $e->search_money_desk_payment(
                                { xact => $transid, voided => 'f' });
-                       #$desk_total += $_->amount_collected for @$desk_payments;
                        $desk_total += $_->amount for @$desk_payments;
 
                        if( (-$amount) > $desk_total ) {
@@ -144,11 +146,12 @@ sub make_payments {
 
                        # Any overpay on this transaction goes directly into patron credit 
                        $cred = -$cred;
+
+                       $logger->info("payment: amount ($amount) exceeds transaction balance of ".
+                               $trans->balance_owed.".  Applying patron credit of $cred");
+
                        $credit += $cred;
-                       $logger->activity("user ".$user->id." applying credit ".
-                               "of $cred on transaction ".$trans->id. " because of overpayment");
 
-                       $logger->debug("Transactin " . $trans->id . ' is complete');
                        $trans = $session->request(
                                "open-ils.storage.direct.money.billable_transaction.retrieve", $transid )->gather(1);
 
@@ -167,9 +170,6 @@ sub make_payments {
                        }
                }
 
-
-               $logger->debug("Creating new $payobj for \$$amount\n");
-
                my $s = $session->request(
                        "open-ils.storage.direct.money.$type.create", $payobj )->gather(1);
                if(!$s) { throw OpenSRF::EX::ERROR ("Error creating new $type"); }