label="[% l('Mark Item Damaged') %]"></eg-grid-action>
<eg-grid-action handler="mark_missing"
label="[% l('Mark Item Missing') %]"></eg-grid-action>
+ <eg-grid-action handler="retarget"
+ label="[% l('Find Another Target') %]"></eg-grid-action>
<eg-grid-action handler="cancel_hold"
label="[% l('Cancel Hold') %]"></eg-grid-action>
"[% 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!') %]";
+s.RETARGET_HOLDS =
+ "[% l('Reset hold(s) [_1]?', '{{hold_ids}}') %]";
}]);
</script>
egCirc.mark_missing(copy_ids).then(refresh_all);
}
+ $scope.retarget = function(items) {
+ var hold_ids = items.map(function(item) { return item.hold.id() });
+ egHolds.retarget(hold_ids).then(refresh_all);
+ }
+
+
}])
});
}
+ // serially retargets each hold
+ service.retarget = function(hold_ids) {
+ if (!hold_ids.length) return $q.when();
+ var deferred = $q.defer();
+
+ egConfirmDialog.open(
+ egCore.strings.RETARGET_HOLDS, '',
+ {hold_ids : hold_ids.join(',')}
+
+ ).result.then(function() {
+
+ function do_one() {
+ var hold_id = hold_ids.pop();
+ if (!hold_id) {
+ deferred.resolve();
+ return;
+ }
+
+ egCore.net.request(
+ 'open-ils.circ',
+ 'open-ils.circ.hold.reset',
+ egCore.auth.token(), hold_id).finally(do_one);
+ }
+
+ do_one(); // kick it off
+ });
+
+ return deferred.promise;
+ }
+
return service;
}])