// If any new back end mark_item calls are added, also add
// them here to use them from the staff client.
// TODO: I didn't find any JS constants for copy status.
- switch (markstatus) {
+ switch (markstatus.id()) {
case 2:
// Not implemented in the staff client, yet.
// req = "open-ils.circ.mark_item_bindery";
break;
}
- function get_status(statusID) {
- var deferred = $q.defer()
- egCore.pcrud.retrieve('ccs', statusID)
- .then(function(resp) {
- deferred.resolve(resp);
- }, function(resp) {
- deferred.reject(resp);
- });
- return deferred.promise;
- }
-
- 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);
- }
- });
- }, function(resp) {
- /* noop */
+ 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);
+ }
});
}
cancel : function() {}
}
).result.then(function() {
- var promises = [];
- angular.forEach(copies, function(copy) {
- promises.push(service.mark_item(copy, 13, {}))
- });
- return $q.all(promises);
+ egCore.pcrud.retrieve('ccs', 13)
+ .then(function(resp) {
+ var promises = [];
+ angular.forEach(copies, function(copy) {
+ promises.push(service.mark_item(copy, resp, {}))
+ });
+ return $q.all(promises);
+ });
});
}