[open-ils-commits] r7583 - branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jul 25 12:27:19 EDT 2007


Author: erickson
Date: 2007-07-25 12:26:20 -0400 (Wed, 25 Jul 2007)
New Revision: 7583

Modified:
   branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
Log:
backporting xact-reopen logic to set-lost: svn merge -r7581:7582 svn://svn.open-ils.org/ILS/trunk

Modified: branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm
===================================================================
--- branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2007-07-25 16:24:17 UTC (rev 7582)
+++ branches/rel_1_2/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm	2007-07-25 16:26:20 UTC (rev 7583)
@@ -311,16 +311,16 @@
         return $evt if $evt;
     }
 
+    my $evt = reopen_xact($e, $circ->id);
+    return $evt if $evt;
+
     $e->commit;
     return 1;
 }
 
+sub reopen_xact {
+    my($e, $xactid) = @_;
 
-sub create_bill {
-	my( $e, $amount, $type, $xactid ) = @_;
-
-	$logger->info("The system is charging $amount [$type] on xact $xactid");
-
     # -----------------------------------------------------------------
     # make sure the transaction is not closed
     my $xact = $e->retrieve_money_billable_transaction($xactid)
@@ -328,14 +328,21 @@
 
     if( $xact->xact_finish ) {
         my ($mbts) = $U->fetch_mbts($xactid, $e);
-        if( ($mbts->balance_owed + $amount) != 0 ) {
-            $logger->info("* re-opening xact $xactid");
+        if( $mbts->balance_owed != 0 ) {
+            $logger->info("* re-opening xact $xactid, orig xact_finish is ".$xact->xact_finish);
             $xact->clear_xact_finish;
             $e->update_money_billable_transaction($xact)
                 or return $e->die_event;
         } 
     }
+}
 
+
+sub create_bill {
+	my( $e, $amount, $type, $xactid ) = @_;
+
+	$logger->info("The system is charging $amount [$type] on xact $xactid");
+
     # -----------------------------------------------------------------
     # now create the billing
 	my $bill = Fieldmapper::money::billing->new;



More information about the open-ils-commits mailing list