patron holds / top o' queue
authorBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 19:49:40 +0000 (15:49 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 19:49:40 +0000 (15:49 -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 976bb40..9c06d44 100644 (file)
     label="[% l('Activate') %]"></eg-grid-action>
   <eg-grid-action handler="suspend"
     label="[% l('Suspend') %]"></eg-grid-action>
+  <eg-grid-action handler="set_top_of_queue"
+    label="[% l('Set Top of Queue') %]"></eg-grid-action>
+  <eg-grid-action handler="clear_top_of_queue"
+    label="[% l('Un-Set Top of Queue') %]"></eg-grid-action>
   <eg-grid-action handler="cancel_hold"
     label="[% l('Cancel Hold') %]"></eg-grid-action>
 
index 0e5be7d..8496380 100644 (file)
@@ -12,6 +12,11 @@ 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}}') %]"
+s.SET_TOP_OF_QUEUE = 
+  "[% l('Move [_1] Hold(s) to the front of the holds queue above other holds that are not likewise flagged as Top of Queue?', 
+    '{{num_holds}}') %]";
+s.CLEAR_TOP_OF_QUEUE = 
+  "[% l('Unset the Top of Queue flag for [_1] Hold(s)?', '{{num_holds}}') %]";
 }]);
 </script>
 
index 3fa0d9f..0f310e1 100644 (file)
@@ -138,6 +138,12 @@ function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,
     $scope.activate = function(items) {
         generic_update(items, 'activate_holds');
     }
+    $scope.set_top_of_queue = function(items) {
+        generic_update(items, 'set_top_of_queue');
+    }
+    $scope.clear_top_of_queue = function(items) {
+        generic_update(items, 'clear_top_of_queue');
+    }
 
 }])
 
index db77eeb..6294660 100644 (file)
@@ -217,30 +217,41 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
         }).result;
     }
 
-    service.activate_holds = function(hold_ids) {
+    service.update_field_with_confirm = function(hold_ids, msg_key, field, value) {
         if (!hold_ids.length) return $q.when();
+
         return egConfirmDialog.open(
-            egCore.strings.ACTIVATE_HOLDS, '', {num_holds : hold_ids.length})
+            egCore.strings[msg_key], '', {num_holds : hold_ids.length})
         .result.then(function() {
+
             var vals = hold_ids.map(function(hold_id) {
-                return {id : hold_id, frozen : false}
+                val = {id : hold_id};
+                val[field] = value;
+                return val;
             });
             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.update_field_with_confirm(
+            hold_ids, 'SUSPEND_HOLDS', 'frozen', true);
+    }
+
+    service.activate_holds = function(hold_ids) {
+        return service.update_field_with_confirm(
+            hold_ids, 'ACTIVATE_HOLDS', 'frozen', false);
+    }
+
+    service.set_top_of_queue = function(hold_ids) {
+        return service.update_field_with_confirm(
+            hold_ids, 'SET_TOP_OF_QUEUE', 'cut_in_line', true);
     }
 
+    service.clear_top_of_queue = function(hold_ids) {
+        return service.update_field_with_confirm(
+            hold_ids, 'CLEAR_TOP_OF_QUEUE', 'cut_in_line', null);
+    }
 
     return service;
 }])