patron holds / transfer to marked title, second half
authorBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 20:38:46 +0000 (16:38 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 3 Jul 2014 20:38:46 +0000 (16:38 -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 9c06d44..f720a4f 100644 (file)
@@ -35,6 +35,8 @@
     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="transfer_to_marked_title"
+    label="[% l('Transfer To Marked Title') %]"></eg-grid-action>
   <eg-grid-action handler="cancel_hold"
     label="[% l('Cancel Hold') %]"></eg-grid-action>
 
index 8496380..1cf5111 100644 (file)
@@ -17,6 +17,10 @@ s.SET_TOP_OF_QUEUE =
     '{{num_holds}}') %]";
 s.CLEAR_TOP_OF_QUEUE = 
   "[% l('Unset the Top of Queue flag for [_1] Hold(s)?', '{{num_holds}}') %]";
+s.TRANSFER_HOLD_TO_TITLE = 
+  "[% l('Tranfer [_1] Hold(s) to bib record ID [_2]?', '{{num_holds}}', '{{bib_id}}') %]";
+s.NO_HOLD_TRANSFER_TITLE_MARKED = 
+  "[% l('No record is marked as a hold transfer target!') %]";
 }]);
 </script>
 
index 0f310e1..9c47198 100644 (file)
@@ -145,6 +145,10 @@ function($scope,  $q,  $routeParams,  egCore,  egUser,  patronSvc,
         generic_update(items, 'clear_top_of_queue');
     }
 
+    $scope.transfer_to_marked_title = function(items) {
+        generic_update(items, 'transfer_to_marked_title');
+    }
+
 }])
 
 
index 6294660..94ef30b 100644 (file)
@@ -6,8 +6,8 @@ angular.module('egCoreMod')
 
 .factory('egHolds',
 
-       ['$modal','$q','egCore','egAlertDialog','egConfirmDialog',
-function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
+       ['$modal','$q','egCore','egAlertDialog','egConfirmDialog','egAlertDialog',
+function($modal , $q , egCore , egAlertDialog , egConfirmDialog , egAlertDialog) {
 
     var service = {};
 
@@ -253,6 +253,31 @@ function($modal , $q , egCore , egAlertDialog , egConfirmDialog) {
             hold_ids, 'CLEAR_TOP_OF_QUEUE', 'cut_in_line', null);
     }
 
+    service.transfer_to_marked_title = function(hold_ids) {
+        if (!hold_ids.length) return $q.when();
+
+        var bib_id = egCore.hatch.getLocalItem(
+            'eg.circ.hold.title_transfer_target');
+
+        if (!bib_id) {
+            // no target marked
+            return egAlertDialog.open(
+                egCore.strings.NO_HOLD_TRANSFER_TITLE_MARKED).result;
+        }
+
+        return egConfirmDialog.open(
+            egCore.strings.TRANSFER_HOLD_TO_TITLE, '', {
+                num_holds : hold_ids.length,
+                bib_id : bib_id
+            }
+        ).result.then(function() {
+            return egCore.net.request(
+                'open-ils.circ',
+                'open-ils.circ.hold.change_title.specific_holds',
+                egCore.auth.token(), bib_id, hold_ids);
+        });
+    }
+
     return service;
 }])