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>
'{{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>
.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 = {};
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;
}])