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

Evergreen Git git at git.evergreen-ils.org
Wed Jul 25 10:23:37 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  43770422fa0acd5895a248f80ad53116cdb4d12a (commit)
      from  7623db0636d014f4fd8e1f470aaf6c9e29bc3ee8 (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 43770422fa0acd5895a248f80ad53116cdb4d12a
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Fri Jul 6 11:47:42 2018 -0400

    LP#1414197 Serial Item Delete Improvements
    
    If a serial item is received, then deleted without any further status,
    it can leave the system in an inconsistent state:
    
    1) If from a multi-item unit, the unit contents are not updated.
    2) If from a single-item unit, the unit is not deleted.
    3) If the last holding of its kind, holdings summaries are not updated.
    
    Since 'resetting' items has all the necessary logic to handle the above
    needs, this commit runs each deleted item through the reset code before
    doing the actual delete.  This also gives the benefit of keeping the
    logic centralized for future fixes/enhancements.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm
index f0b10d2..dfe9878 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm
@@ -258,6 +258,7 @@ sub fleshed_item_alter {
     my %found_sdist_ids;
     my %found_sstr_ids;
     my %siss_to_potentially_delete;
+    my @deleted_items;
     for my $item (@$items) {
         my $sstr_id = ref $item->stream ? $item->stream->id : $item->stream;
         if (!exists($found_sstr_ids{$sstr_id})) {
@@ -282,7 +283,9 @@ sub fleshed_item_alter {
         if( $item->isdeleted ) {
             my $siss_id = ref $item->issuance ? $item->issuance->id : $item->issuance;
             $siss_to_potentially_delete{$siss_id}++;
-            $evt = _delete_sitem( $editor, $override, $item);
+            # We don't want to do a bunch of resetting churn for multiple items
+            # in the same unit/dist, so just gather ids for now
+            push(@deleted_items, $item);
         } elsif( $item->isnew ) {
             # TODO: reconsider this
             # if the item has a new issuance, create the issuance first
@@ -297,6 +300,25 @@ sub fleshed_item_alter {
         }
     }
 
+    if (@deleted_items) {
+        # First, reset as a batch any assigned to units.  This cleans up units
+        # and rebuilds summaries as needed
+        #
+        # XXX: if we ever add a 'deleted' flag to items, we may want to
+        # preserve rather than reset the received information
+        my @unit_items = grep {$_->unit} @deleted_items;
+        my $reset_info = $self->method_lookup('open-ils.serial.reset_items')->run($auth, \@unit_items) if @unit_items;
+
+        # Next, do the actual deletes, unless we got an event
+        if ($U->event_code($reset_info)) {
+            $evt = $reset_info;
+        } else {
+            foreach my $item (@deleted_items) {
+                $evt = _delete_sitem( $editor, $override, $item);
+            }
+        }
+    }
+
     if( $evt ) {
         $logger->info("fleshed item-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
         $editor->rollback;
diff --git a/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js b/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js
index 5d9d376..25a2836 100644
--- a/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js
+++ b/Open-ILS/web/js/ui/default/staff/serials/directives/view-items-grid.js
@@ -89,10 +89,8 @@ function($scope , $q , egSerialsCoreSvc , egCore , egGridDataProvider , orderByF
         var list = [];
 
         angular.forEach(items, function (i) {
-            var obj = egCore.idl.fromHash('sitem',i);
+            var obj = egSerialsCoreSvc.itemMap[i.id];
             obj.isdeleted(1);
-            obj.stream(obj.stream().id); // API wants scalar or FM object
-            obj.issuance(obj.issuance().id);
             list.push(obj);
         });
 

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

Summary of changes:
 .../src/perlmods/lib/OpenILS/Application/Serial.pm |   24 +++++++++++++++++++-
 .../staff/serials/directives/view-items-grid.js    |    4 +--
 2 files changed, 24 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list