<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/record.js"></script>
<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/tagtable.js"></script>
<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/services/marcedit.js"></script>
+<script src="[% ctx.media_prefix %]/js/ui/default/staff/circ/services/holds.js"></script>
+[% INCLUDE 'staff/circ/share/hold_strings.tt2' %]
<script src="[% ctx.media_prefix %]/js/ui/default/staff/cat/bucket/record/app.js"></script>
<script>
angular.module('egCoreMod').run(['egStrings', function(s) {
<eg-grid-action label="[% l('Delete Selected Records from Catalog') %]"
handler="deleteRecordsFromCatalog"></eg-grid-action>
+ <eg-grid-action handler="transfer_holds_to_marked"
+ label="[% l('Transfer Title Holds') %]"></eg-grid-action>
+
<eg-grid-action label="[% l('Merge Selected Records') %]"
handler="openRecordMergeDialog"></eg-grid-action>
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}}') %]";
+ "[% l('Transfer [_1] Hold(s) to bib record ID [_2]?', '{{num_holds}}', '{{bib_id}}') %]";
+s.TRANSFER_ALL_BIB_HOLDS_TO_TITLE =
+ "[% l('Transfer holds on [_1] bib(s) to bib record ID [_2]?', '{{num_bibs}}', '{{bib_id}}') %]";
s.NO_HOLD_TRANSFER_TITLE_MARKED =
"[% l('No record is marked as a hold transfer target!') %]";
s.RETARGET_HOLDS =
}])
.controller('ViewCtrl',
- ['$scope','$q','$routeParams','bucketSvc', 'egCore', '$window',
- '$timeout', 'egConfirmDialog', '$modal',
-function($scope, $q , $routeParams, bucketSvc, egCore, $window,
- $timeout, egConfirmDialog, $modal) {
+ ['$scope','$q','$routeParams','bucketSvc','egCore','$window',
+ '$timeout','egConfirmDialog','$modal','egHolds',
+function($scope, $q , $routeParams, bucketSvc, egCore, $window,
+ $timeout, egConfirmDialog, $modal, egHolds) {
$scope.setTab('view');
$scope.bucketId = $routeParams.id;
);
}
+ // runs the transfer title holds action
+ $scope.transfer_holds_to_marked = function(records) {
+ var bib_ids = records.map(function(val) { return val.id; })
+ egHolds.transfer_all_bib_holds_to_marked_title(bib_ids);
+ }
+
// opens the record merge dialog
$scope.openRecordMergeDialog = function(records) {
$modal.open({
});
}
+ service.transfer_all_bib_holds_to_marked_title = function(bib_ids) {
+ if (!bib_ids.length) return $q.when();
+
+ var target_bib_id = egCore.hatch.getLocalItem(
+ 'eg.circ.hold.title_transfer_target');
+
+ if (!target_bib_id) {
+ // no target marked
+ return egAlertDialog.open(
+ egCore.strings.NO_HOLD_TRANSFER_TITLE_MARKED).result;
+ }
+
+ return egConfirmDialog.open(
+ egCore.strings.TRANSFER_ALL_BIB_HOLDS_TO_TITLE, '', {
+ num_bibs : bib_ids.length,
+ bib_id : target_bib_id
+ }
+ ).result.then(function() {
+ return egCore.net.request(
+ 'open-ils.circ',
+ 'open-ils.circ.hold.change_title',
+ egCore.auth.token(), target_bib_id, bib_ids);
+ });
+ }
+
// serially retargets each hold
service.retarget = function(hold_ids) {
if (!hold_ids.length) return $q.when();