[open-ils-commits] [GIT] Evergreen ILS branch rel_3_1 updated. b97395add56ec5d0be5378b75973beb7dbb8a611

Evergreen Git git at git.evergreen-ils.org
Wed Aug 29 10:36:35 EDT 2018


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_3_1 has been updated
       via  b97395add56ec5d0be5378b75973beb7dbb8a611 (commit)
       via  95a75e5bd18e2ebd61de8069bda6739899e02698 (commit)
      from  206ae778b88d211908a355c5af42a13f9bf1b15b (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 b97395add56ec5d0be5378b75973beb7dbb8a611
Author: Bill Erickson <berickxx at gmail.com>
Date:   Fri Jul 27 14:30:07 2018 -0400

    LP#978095 ACQ use last-canceled copy reason if best
    
    Only use an alternate keep-debits cancel reason if the currently
    canceled copy is not using a keep-debits reason.
    
    Also clarify in the docs that if another keep-debits reason is selected,
    it's essentially chosen at random, not necessarily the "last" copy.
    
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
index 7215e05..42fbebb 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
@@ -3272,16 +3272,15 @@ sub autocancel_lineitem {
     foreach my $lid ( @{ $all_lids } ) {
         if (! $lid->cancel_reason ) {
             $all_lids_are_canceled = 0;
-        }
-        if ($lid->cancel_reason) {
-            if ($U->is_true($lid->cancel_reason->keep_debits)) {
+        } elsif (
+            !$U->is_true($candidate_cancel_reason->keep_debits) &&
+             $U->is_true($lid->cancel_reason->keep_debits)) {
                 $candidate_cancel_reason = $lid->cancel_reason;
-            }
         }
     }
     my $cancel_result;
     if ($all_lids_are_canceled) {
-        eval { $cancel_result = cancel_lineitem($mgr, $li_id, $candidate_cancel_reason); };
+        $cancel_result = cancel_lineitem($mgr, $li_id, $candidate_cancel_reason);
     }
     return $cancel_result;
 }
diff --git a/docs/RELEASE_NOTES_NEXT/Acquisitions/autocancel_lineitems_when_all_copies_are_canceled.adoc b/docs/RELEASE_NOTES_NEXT/Acquisitions/autocancel_lineitems_when_all_copies_are_canceled.adoc
index e84e519..8067867 100644
--- a/docs/RELEASE_NOTES_NEXT/Acquisitions/autocancel_lineitems_when_all_copies_are_canceled.adoc
+++ b/docs/RELEASE_NOTES_NEXT/Acquisitions/autocancel_lineitems_when_all_copies_are_canceled.adoc
@@ -1,3 +1,13 @@
 Auto-Cancel Lineitems When All Copies Are Canceled
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-When a copy (lineitem detail) is canceled through the Acquisitions interface, the parent lineitem is also canceled if all copies for that lineitem are also canceled.  The cancel reason given will be taken from the last copy with a cancel reason where Keep Debits is true, or failing that, the cancel reason used for the copy just canceled.
+When a copy (lineitem detail) is canceled through the Acquisitions interface, 
+the parent lineitem is also canceled if all copies for that lineitem are also 
+canceled.  The cancel reason given will come from:
+
+1. The cancel reason for the just-canceled copy if it's a Keep Debits true 
+   cancel reason.
+2. The cancel reason from any other copy on the lineitem that has a Keep 
+   Debits true cancel reason.
+3. The cancel reason for the just-canceled copy if no copies have a Keep
+   Debits true cancel reason.
+  

commit 95a75e5bd18e2ebd61de8069bda6739899e02698
Author: Jason Etheridge <jason at EquinoxInitiative.org>
Date:   Fri Feb 2 11:30:36 2018 -0500

    lp978095 auto-canceling lineitems
    
    "Acq: lineitems display as "on order" even after all copies have been cancelled"
    
    When a copy (lineitem detail) on a lineitem is canceled through the UI, all of
    the sibling copies are examined, and if they also happen to be canceled, then a
    cancel attempt is made on the parent lineitem.
    
    The cancel reason fed to the lineitem cancelation attempt will be the last
    cancel reason on an examined sibling lineitem where Keep Debits is True, or
    failing that, the cancel reason used wih the copy just canceled.
    
    The UI will refresh to the lineitem view when such an auto-cancelation happens.
    
    Signed-off-by: Jason Etheridge <jason at EquinoxInitiative.org>
    Signed-off-by: Bill Erickson <berickxx at gmail.com>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
index 3eae860..7215e05 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
@@ -3253,6 +3253,38 @@ sub cancel_lineitem {
     return $result;
 }
 
+sub autocancel_lineitem {
+    my $mgr = shift;
+    my $lid_id = shift;
+    my $candidate_cancel_reason = shift;
+
+    my $lid = $mgr->editor->search_acq_lineitem_detail({id => $lid_id});
+    my $li_id = $lid->[0]->lineitem;
+
+    my $all_lids = $mgr->editor->search_acq_lineitem_detail([{
+        lineitem => $li_id
+    },{
+        flesh => 1,
+        flesh_fields => { acqlid => ['cancel_reason'] }
+    }]);
+
+    my $all_lids_are_canceled = 1;
+    foreach my $lid ( @{ $all_lids } ) {
+        if (! $lid->cancel_reason ) {
+            $all_lids_are_canceled = 0;
+        }
+        if ($lid->cancel_reason) {
+            if ($U->is_true($lid->cancel_reason->keep_debits)) {
+                $candidate_cancel_reason = $lid->cancel_reason;
+            }
+        }
+    }
+    my $cancel_result;
+    if ($all_lids_are_canceled) {
+        eval { $cancel_result = cancel_lineitem($mgr, $li_id, $candidate_cancel_reason); };
+    }
+    return $cancel_result;
+}
 
 __PACKAGE__->register_method(
     method => "cancel_lineitem_detail_api",
@@ -3294,6 +3326,10 @@ sub cancel_lineitem_detail_api {
         return new OpenILS::Event("ACQ_ALREADY_CANCELED");
     }
 
+    if (defined autocancel_lineitem($mgr,$lid_id,$cancel_reason)) {
+        $$result{'li_update_needed'} = 1;
+    }
+
     $e->commit or return $e->die_event;
 
     # XXX create lineitem detail status events?
diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js
index 7c19fef..40347fc 100644
--- a/Open-ILS/web/js/ui/default/acq/common/li_table.js
+++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js
@@ -2663,6 +2663,9 @@ function AcqLiTable() {
                                     r.lid[id].cancel_reason
                                 );
                                 self.updateLidState(self.copyCache[id]);
+                                if (r.li_update_needed) {
+                                    location.href = location.href; // sledgehammer
+                                }
                             }
                         }
                     }
diff --git a/docs/RELEASE_NOTES_NEXT/Acquisitions/autocancel_lineitems_when_all_copies_are_canceled.adoc b/docs/RELEASE_NOTES_NEXT/Acquisitions/autocancel_lineitems_when_all_copies_are_canceled.adoc
new file mode 100644
index 0000000..e84e519
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Acquisitions/autocancel_lineitems_when_all_copies_are_canceled.adoc
@@ -0,0 +1,3 @@
+Auto-Cancel Lineitems When All Copies Are Canceled
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+When a copy (lineitem detail) is canceled through the Acquisitions interface, the parent lineitem is also canceled if all copies for that lineitem are also canceled.  The cancel reason given will be taken from the last copy with a cancel reason where Keep Debits is true, or failing that, the cancel reason used for the copy just canceled.

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

Summary of changes:
 .../perlmods/lib/OpenILS/Application/Acq/Order.pm  |   35 ++++++++++++++++++++
 Open-ILS/web/js/ui/default/acq/common/li_table.js  |    3 ++
 ...cel_lineitems_when_all_copies_are_canceled.adoc |   13 +++++++
 3 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 docs/RELEASE_NOTES_NEXT/Acquisitions/autocancel_lineitems_when_all_copies_are_canceled.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list