LP#1845706: Missing/Damaged from Items Out
authorMike Rylander <mrylander@gmail.com>
Wed, 21 Aug 2019 15:41:29 +0000 (11:41 -0400)
committerMike Rylander <mrylander@gmail.com>
Fri, 21 Feb 2020 20:31:18 +0000 (15:31 -0500)
Marking items Missing or Damaged from the patron Items Out interface
is sometimes necessary.  This commit adds that ability.

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Signed-off-by: Dawn Dale <ddale@georgialibraries.org>
Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/items_out.js

index 8dc8902..b7857aa 100644 (file)
     label="[% l('Print Item Receipt') %]"></eg-grid-action>
   <eg-grid-action handler="edit_due_date"
     label="[% l('Edit Due Date') %]"></eg-grid-action>
+  <eg-grid-action handler="mark_damaged"
+    label="[% l('Mark Damaged') %]"></eg-grid-action>
+  <eg-grid-action handler="mark_missing"
+    label="[% l('Mark Missing') %]"></eg-grid-action>
   <eg-grid-action handler="mark_lost"
     label="[% l('Mark Lost (By Patron)') %]"></eg-grid-action>
   <eg-grid-action handler="mark_claims_returned"
index 96cc65c..a10874e 100644 (file)
@@ -404,12 +404,32 @@ function($scope , $q , $routeParams , $timeout , egCore , egUser , patronSvc ,
         });
     }
 
+    function batch_action_with_flat_copies(items, action) {
+        if (!items.length) return;
+        var copies = items.map(function(circ) 
+            { return egCore.idl.toHash(circ.target_copy()) });
+        action(copies).then(reset_page);
+    }
     function batch_action_with_barcodes(items, action) {
         if (!items.length) return;
         var barcodes = items.map(function(circ) 
             { return circ.target_copy().barcode() });
         action(barcodes).then(reset_page);
     }
+    $scope.mark_damaged = function(items) {
+        if (items.length == 0) return;
+
+        angular.forEach(items, function(circ) {
+            egCirc.mark_damaged({
+                id: circ.target_copy().id(),
+                barcode: circ.target_copy().barcode(),
+                circ_lib: circ.target_copy().circ_lib().id()
+            }).then($timeout(reset_page,1000)) // reset after each, because rejecting one stops the $q.all() chain
+        });
+    }
+    $scope.mark_missing = function(items) {
+        batch_action_with_flat_copies(items, egCirc.mark_missing);
+    }
     $scope.mark_lost = function(items) {
         batch_action_with_barcodes(items, egCirc.mark_lost);
     }