break;
}
- function get_status(ids) {
+ function get_status(statusID) {
var deferred = $q.defer()
- egCore.pcrud.search('ccs', {id: ids})
+ egCore.pcrud.retrieve('ccs', statusID)
.then(function(resp) {
deferred.resolve(resp);
}, function(resp) {
deferred.reject(resp);
- }, function(resp) {
- deferred.notify(resp);
});
return deferred.promise;
}
- var newStatus, oldStatus;
- return get_status([markstatus,copy['status.id']]).then(function(resp) {
- return egConfirmDialog.open(
- 'Mark Item ' + newStatus.name(),
- 'From ' + oldStatus.name(),
- {
- ok : function() {},
- cancel : function() {}
+ var newStatus;
+ return get_status(markstatus).then(function(resp) {
+ newStatus = resp;
+ return egCore.net.request(
+ 'open-ils.circ',
+ req,
+ egCore.auth.token(),
+ copy.id,
+ args
+ ).then(function(resp) {
+ if (resp == 1) {
+ console.debug(req + ' succeeded for ' + copy.barcode);
+ } else if (evt = egCore.evt.parse(resp)) {
+ console.error(req + ' failed for ' + copy.barcode + ': ' + resp.textcode);
}
- ).result;
+ });
}, function(resp) {
/* noop */
- }, function(resp) {
- if (resp.id() == markstatus)
- newStatus = resp;
- else
- oldStatus = resp;
});
}