From: erickson Date: Wed, 25 Jul 2007 16:26:20 +0000 (+0000) Subject: backporting xact-reopen logic to set-lost: svn merge -r7581:7582 svn://svn.open-ils... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8fef29a7ca0efe4361bda6232a9b3db301f1e95e;p=Evergreen.git backporting xact-reopen logic to set-lost: svn merge -r7581:7582 svn://svn.open-ils.org/ILS/trunk git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_2@7583 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm index c57f9a6ff6..3bb45be0e2 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ.pm @@ -311,15 +311,15 @@ sub new_set_circ_lost { return $evt if $evt; } + my $evt = reopen_xact($e, $circ->id); + return $evt if $evt; + $e->commit; return 1; } - -sub create_bill { - my( $e, $amount, $type, $xactid ) = @_; - - $logger->info("The system is charging $amount [$type] on xact $xactid"); +sub reopen_xact { + my($e, $xactid) = @_; # ----------------------------------------------------------------- # make sure the transaction is not closed @@ -328,13 +328,20 @@ sub create_bill { 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