From a912996c7f4f46e83b342599e3d6a8e6d73b7fda Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 3 Jul 2014 15:49:40 -0400 Subject: [PATCH] patron holds / top o' queue Signed-off-by: Bill Erickson --- .../src/templates/staff/circ/patron/t_holds.tt2 | 4 +++ .../templates/staff/circ/share/hold_strings.tt2 | 5 ++++ .../web/js/ui/default/staff/circ/patron/holds.js | 6 ++++ .../web/js/ui/default/staff/circ/services/holds.js | 35 ++++++++++++++-------- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_holds.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_holds.tt2 index 976bb40c3d..9c06d4460a 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_holds.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_holds.tt2 @@ -31,6 +31,10 @@ label="[% l('Activate') %]"> + + diff --git a/Open-ILS/src/templates/staff/circ/share/hold_strings.tt2 b/Open-ILS/src/templates/staff/circ/share/hold_strings.tt2 index 0e5be7dce0..8496380753 100644 --- a/Open-ILS/src/templates/staff/circ/share/hold_strings.tt2 +++ b/Open-ILS/src/templates/staff/circ/share/hold_strings.tt2 @@ -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}}') %]"; }]); diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js index 3fa0d9ffed..0f310e1967 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/holds.js @@ -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'); + } }]) diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js index db77eebf66..62946607f0 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/holds.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/holds.js @@ -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; }]) -- 2.11.0