[open-ils-commits] [GIT] Evergreen ILS branch master updated. 687da46854a5ef887e97363713d814c5750a6c1e

Evergreen Git git at git.evergreen-ils.org
Tue Apr 18 11:09:22 EDT 2017


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  687da46854a5ef887e97363713d814c5750a6c1e (commit)
       via  4ccad960faa0a3bb32518881031fc3ab7d732320 (commit)
      from  6173680e927ddc76081a2c116c0407b71a08b37b (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 687da46854a5ef887e97363713d814c5750a6c1e
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Tue Apr 18 11:06:03 2017 -0400

    LP#1670407 Add tests for xact_finish close/re-open
    
    Since this bug came about due to negative balance changes (and it was
    easier), this commit extends the existing negative balances test suite
    to include basic tests for checking both xact_finish conditions.
    
    One of these tests fails without the fix from the previous commit.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/perlmods/live_t/09-lp1198465_neg_balances.t b/Open-ILS/src/perlmods/live_t/09-lp1198465_neg_balances.t
index 3ee0576..0190f28 100644
--- a/Open-ILS/src/perlmods/live_t/09-lp1198465_neg_balances.t
+++ b/Open-ILS/src/perlmods/live_t/09-lp1198465_neg_balances.t
@@ -1,6 +1,6 @@
 #!perl
 
-use Test::More tests => 127;
+use Test::More tests => 129;
 
 diag("Test features of Conditional Negative Balances code.");
 
@@ -531,6 +531,11 @@ is(
     'Remaining balance of 0.00 after payment'
 );
 
+ok(
+    $summary->xact_finish ne '',
+    'xact_finish is set due to 0.00 balance'
+);
+
 ### check-in the lost copy
 
 $item_req = $storage_ses->request('open-ils.storage.direct.asset.copy.retrieve', $item_id);
@@ -576,6 +581,11 @@ is(
     'Patron has a negative balance (credit) of 50.00 due to overpayment'
 );
 
+ok(
+    !defined($summary->xact_finish),
+    'xact_finish is not set due to non-zero balance'
+);
+
 
 ##############################
 # 14. RERUN of Case 12. Test negative balance settings on fines

commit 4ccad960faa0a3bb32518881031fc3ab7d732320
Author: Bill Erickson <berickxx at gmail.com>
Date:   Tue Mar 28 14:15:44 2017 -0400

    LP#1670407 Lost checkin re-opens transaction
    
    Avoid re-closing a circulation that was re-opened during checkin because
    it acquired a non-zero balance.  This is typically caused by, for
    example, voiding a lost item fee during checkin and/or generating
    overdues for lost-then-found items.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
index 6c035a8..e12828c 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
@@ -3332,16 +3332,34 @@ sub checkin_handle_circ_start {
 
 sub checkin_handle_circ_finish {
     my $self = shift;
+    my $e = $self->editor;
     my $circ = $self->circ;
 
-    # see if there are any fines owed on this circ.  if not, close it
-    my ($obt) = $U->fetch_mbts($circ->id, $self->editor);
-    $circ->xact_finish('now') if( $obt and $obt->balance_owed == 0 );
+    # Do one last check before the final circulation update to see 
+    # if the xact_finish value should be set or not.
+    #
+    # The underlying money.billable_xact may have been updated to
+    # reflect a change in xact_finish during checkin bills handling, 
+    # however we can't simply refresh the circulation from the DB,
+    # because other changes may be pending.  Instead, reproduce the
+    # xact_finish check here.  It won't hurt to do it again.
 
-    $logger->debug("circulator: ".$obt->balance_owed." is owed on this circulation");
+    my $sum = $e->retrieve_money_billable_transaction_summary($circ->id);
+    if ($sum) { # is this test still needed?
 
-    return $self->bail_on_events($self->editor->event)
-        unless $self->editor->update_action_circulation($circ);
+        my $balance = $sum->balance_owed;
+
+        if ($balance == 0) {
+            $circ->xact_finish('now');
+        } else {
+            $circ->clear_xact_finish;
+        }
+
+        $logger->info("circulator: $balance is owed on this circulation");
+    }
+
+    return $self->bail_on_events($e->event)
+        unless $e->update_action_circulation($circ);
 
     return undef;
 }

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

Summary of changes:
 .../lib/OpenILS/Application/Circ/Circulate.pm      |   30 ++++++++++++++++----
 .../perlmods/live_t/09-lp1198465_neg_balances.t    |   12 +++++++-
 2 files changed, 35 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list