[open-ils-commits] [GIT] Evergreen ILS branch rel_2_11 updated. 560e0d9cdb78f6704ef840b5db73a5e4ced7ba8c

Evergreen Git git at git.evergreen-ils.org
Tue Apr 18 11:10:44 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, rel_2_11 has been updated
       via  560e0d9cdb78f6704ef840b5db73a5e4ced7ba8c (commit)
       via  0120746cf09b68cc10ccc17e0e1e4f3e64b356a9 (commit)
      from  a0f74d7c0816ee141a92c7747188ce4665b18b44 (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 560e0d9cdb78f6704ef840b5db73a5e4ced7ba8c
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 0120746cf09b68cc10ccc17e0e1e4f3e64b356a9
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 fb71a23..298efbc 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm
@@ -3328,16 +3328,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