.controller('PatronItemsOutCtrl',
['$scope','$q','$routeParams','$timeout','egCore','egUser','patronSvc',
'$location','egGridDataProvider','$uibModal','egCirc','egConfirmDialog',
- 'egBilling','$window','egBibDisplay',
+ 'egProgressDialog','egBilling','$window','egBibDisplay',
function($scope , $q , $routeParams , $timeout , egCore , egUser , patronSvc ,
$location , egGridDataProvider , $uibModal , egCirc , egConfirmDialog ,
- egBilling , $window , egBibDisplay) {
+ egProgressDialog , egBilling , $window , egBibDisplay) {
// list of noncatatloged circulations. Define before initTab to
// avoid any possibility of race condition, since they are loaded
var deferred = $q.defer();
var rendered = 0;
+ egProgressDialog.open();
+
// fetch the lot of circs and stream the results back via notify
egCore.pcrud.search('circ', {id : id_list},
{ flesh : 4,
}
if (rendered++ >= offset && rendered <= count) {
+ egProgressDialog.close();
deferred.notify(circ);
};
});
$scope.ok = function(args) {
var due = $scope.args.due_date.toISOString();
console.debug("applying due date of " + due);
+ egProgressDialog.open();
- var promises = [];
+ var promise = $q.when();
angular.forEach(items, function(circ) {
- promises.push(
- egCore.net.request(
+ promise = promise.then(function() {
+ return egCore.net.request(
'open-ils.circ',
'open-ils.circ.circulation.due_date.update',
egCore.auth.token(), circ.id(), due
// date from the modified circulation.
circ.due_date(new_circ.due_date());
})
- );
+ });
});
- $q.all(promises).then(function() {
+ promise.finally(function() {
+ egProgressDialog.close();
$uibModalInstance.close();
provider.refresh();
});
expire_date : cusr.expire_date(),
alias : cusr.alias(),
has_email : Boolean(patronSvc.current.email() && patronSvc.current.email().match(/.*@.*/)),
- has_phone : Boolean(cusr.day_phone() || cusr.evening_phone() || cusr.other_phone())
+ has_phone : Boolean(cusr.day_phone() || cusr.evening_phone() || cusr.other_phone()),
+ juvenile : cusr.juvenile()
};
return egCore.print.print({
$scope.show_triggered_events = function(items) {
var focus = items.length == 1;
angular.forEach(items, function(item) {
- var url = egCore.env.basePath +
- '/cat/item/' +
- item.target_copy().id() +
- '/triggered_events';
+ var url = '/eg2/staff/circ/item/event-log/' +
+ item.target_copy().id();
$timeout(function() { var x = $window.open(url, '_blank'); if (focus) x.focus() });
+
});
}
return egConfirmDialog.open(msg, barcodes.join(' '), {}).result
.then(function() {
+ window.oils_cancel_batch = false;
+ window.oils_inside_batch = true;
+ function batch_cleanup() {
+ if (window.oils_inside_batch && window.oils_op_change_within_batch) {
+ window.oils_op_change_undo_func();
+ }
+ window.oils_inside_batch = false;
+ window.oils_op_change_within_batch = false;
+ reset_page();
+ }
function do_one() {
var bc = barcodes.pop();
- if (!bc) { reset_page(); return }
+ if (!bc) {
+ batch_cleanup();
+ return;
+ }
+ if (window.oils_op_change_within_batch) {
+ window.oils_op_change_toast_func();
+ }
// finally -> continue even when one fails
- egCirc.renew({copy_barcode : bc}).finally(do_one);
+ egCirc.renew({copy_barcode : bc}).finally(function() {
+ if (!window.oils_cancel_batch) {
+ do_one();
+ } else {
+ console.log('batch cancelled');
+ batch_cleanup();
+ return;
+ }
+ });
}
do_one();
});