not closing circs on all fines voided if it is still open
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 8 Aug 2006 21:34:35 +0000 (21:34 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 8 Aug 2006 21:34:35 +0000 (21:34 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5386 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index 6f221c6..4e3d760 100644 (file)
@@ -371,6 +371,7 @@ sub void_bill {
        # ------------------------------------------------------------------------------
        my $xact = $e->retrieve_money_billable_transaction($bill->xact)
                or return $e->event;
+
        $U->update_patron_penalties(
                authtoken => $authtoken,
                patronid  => $xact->usr,
@@ -379,53 +380,26 @@ sub void_bill {
        return 1;
 }
 
-# refactored below XXX
-sub ___check_open_xact {
+sub _check_open_xact {
        my( $editor, $xactid ) = @_;
 
        # Grab the transaction
        my $xact = $editor->retrieve_money_billable_transaction($xactid)
                or return $editor->event;
 
-       # if it's still open, good.
-       return undef unless $xact->xact_finish;
-
-       $logger->info("re-opening transaction ".$xact->id);
-       my $finish = $xact->xact_finish;
-
-       # clear the transaction finish time
-       $xact->clear_xact_finish;
-       $editor->update_money_billable_transaction($xact);
-
        # grab the summary and see how much is owed on this transaction
        my $summary = $editor->retrieve_money_open_billable_transaction_summary($xactid)
                or return $editor->event;
 
-       if( $summary->balance_owed == 0 ) {
-               # if nothing is owed, re-close the transaction
-               $xact->xact_finish($finish);
-               $editor->update_money_billable_transaction($xact);
-       }
-
-       return undef;
-}
-
-
+       # grab the circulation if it is a circ;
+       my $circ = $editor->retrieve_action_circulation($xactid);
 
-sub _check_open_xact {
-       my( $editor, $xactid ) = @_;
-
-       # Grab the transaction
-       my $xact = $editor->retrieve_money_billable_transaction($xactid)
-               or return $editor->event;
-
-       # grab the summary and see how much is owed on this transaction
-       my $summary = $editor->retrieve_money_open_billable_transaction_summary($xactid)
-               or return $editor->event;
+       # If nothing is owed on the transaction but it is still open
+       # and this transaction is not an open circulation, close it
+       if( 
+               ( $summary->balance_owed == 0 and ! $xact->xact_finish ) and
+               ( !$circ or $circ->stop_fines )) {
 
-       # If nothing is owed on the transaction but xact_finish has
-       # not been set, set it and update
-       if( $summary->balance_owed == 0 and ! $xact->xact_finish ) {
                $logger->info("closing transaction ".$xact->id. ' becauase balance_owed == 0');
                $xact->xact_finish('now');
                $editor->update_money_billable_transaction($xact)