patron holds suspend/activate
authorBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 19:33:23 +0000 (15:33 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 19:33:23 +0000 (15:33 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_holds.tt2
Open-ILS/src/templates/staff/circ/share/hold_strings.tt2
Open-ILS/web/js/ui/default/staff/circ/patron/holds.js
Open-ILS/web/js/ui/default/staff/circ/services/holds.js

index ea0c7dd..976bb40 100644 (file)
     label="[% l('Edit Notification Settings') %]"></eg-grid-action>
   <eg-grid-action handler="edit_dates"
     label="[% l('Edit Hold Dates') %]"></eg-grid-action>
+  <eg-grid-action handler="activate"
+    label="[% l('Activate') %]"></eg-grid-action>
+  <eg-grid-action handler="suspend"
+    label="[% l('Suspend') %]"></eg-grid-action>
   <eg-grid-action handler="cancel_hold"
     label="[% l('Cancel Hold') %]"></eg-grid-action>
 
index 41718f8..0e5be7d 100644 (file)
@@ -10,6 +10,8 @@ s.HOLD_STATUS_5 = "[% l('Hold Shelf Delay') %]";
 s.HOLD_STATUS_6 = "[% l('Canceled') %]";
 s.HOLD_STATUS_7 = "[% l('Suspended') %]";
 s.HOLD_STATUS_8 = "[% l('Wrong Shelf') %]";
+s.ACTIVATE_HOLDS = "[% l('Activate [_1] Hold(s)?', '{{num_holds}}') %]"
+s.SUSPEND_HOLDS = "[% l('Suspend [_1] Hold(s)?', '{{num_holds}}') %]"
 }]);
 </script>
 
index 8720003..3fa0d9f 100644 (file)
@@ -132,6 +132,12 @@ function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,
     $scope.edit_dates = function(items) {
         generic_update(items, 'edit_dates');
     }
+    $scope.suspend = function(items) {
+        generic_update(items, 'suspend_holds');
+    }
+    $scope.activate = function(items) {
+        generic_update(items, 'activate_holds');
+    }
 
 }])
 
index a49fb89..db77eeb 100644 (file)
@@ -217,6 +217,31 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
         }).result;
     }
 
+    service.activate_holds = function(hold_ids) {
+        if (!hold_ids.length) return $q.when();
+        return egConfirmDialog.open(
+            egCore.strings.ACTIVATE_HOLDS, '', {num_holds : hold_ids.length})
+        .result.then(function() {
+            var vals = hold_ids.map(function(hold_id) {
+                return {id : hold_id, frozen : false}
+            });
+            return service.update_holds(vals);
+        });
+    }
+
+    service.suspend_holds = function(hold_ids) {
+        if (!hold_ids.length) return $q.when();
+        return egConfirmDialog.open(
+            egCore.strings.SUSPEND_HOLDS, '', {num_holds : hold_ids.length})
+        .result.then(function() {
+            var vals = hold_ids.map(function(hold_id) {
+                return {id : hold_id, frozen : true}
+            });
+            return service.update_holds(vals);
+        });
+    }
+
+
     return service;
 }])