From: Jason Stephenson Date: Sun, 21 Oct 2018 01:30:29 +0000 (-0400) Subject: Just trying to lookup copy status. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=0e6f483adf510935ff9c674d80366a4c5c83fd2f;p=working%2FEvergreen.git Just trying to lookup copy status. --- diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js index 03d36e8af8..c9985e3725 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/circ.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/circ.js @@ -1374,76 +1374,68 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl }).result; } - service.mark_discard = function(copy) { + service.mark_item = function(copy, markstatus, args) { if (!copy) return $q.when(); - var arg = {}; - if (copy["status.id"] == 1) { - egConfirmDialog.open( - egCore.strings.MARK_DISCARD_CHECKED_OUT, - egCore.strings.MARK_DISCARD_CONTINUE, - { - ok : function() {}, - cancel :function() {} - } - ).result.then(function() { - arg.handle_checkin = 1; - }); - } else if (copy["status.id"] == 6) { - egConfirmDialog.open( - egCore.strings.MARK_DISCARD_IN_TRANSIT, - egCore.strings.MARK_DISCARD_CONTINUE, - { - ok : function() {}, - cancel :function() {} - } - ).result.then(function() { - arg.handle_transit = 1; - }); - } else if (copy["status.restrict_copy_delete"] == "t") { - egConfirmDialog.open( - egCore.strings.MARK_DISCARD_RESTRICT_DELETE, - egCore.strings.MARK_DISCARD_CONTINUE, + var req; + // 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) { + case 2: + // Not implemented in the staff client, yet. + // req = "open-ils.circ.mark_item_bindery"; + break; + case 4: + req = "open-ils.circ.mark_item_missing"; + break; + case 9: + // Not implemented in the staff client, yet. + // req = "open-ils.circ.mark_item_on_order"; + break; + case 10: + // Not implemented in the staff client, yet. + // req = "open-ils.circ.mark_item_ill"; + break; + case 11: + // Not implemented in the staff client, yet. + // req = "open-ils.circ.mark_item_cataloging"; + break; + case 12: + // Not implemented in the staff client, yet. + // req = "open-ils.circ.mark_item_reserves"; + break; + case 13: + req = "open-ils.circ.mark_item_discard"; + break; + case 14: + // Damaged is handled elsewhere. + break; + } + + function get_status(id) { + var deferred = $q.defer() + egCore.pcrud.retrieve('ccs', id, {atomic: true}) + .then(function(resp) { + deferred.resolve(resp) + }); + return deferred.promise; + } + + var promise = get_status(markstatus); + return promise.then(function(newStatus) { + return egConfirmDialog.open( + 'Status', + newStatus.name(), { ok : function() {}, - cancel :function() {} - } - ).result.then(function() { - arg.handle_copy_delete_warning = 1; - }); - } - var result = egCore.net.request( - 'open-ils.circ', - 'open-ils.circ.mark_item_discard', - egCore.auth.token(), copy.id, arg - ).then(function(resp) { - if (evt = egCore.evt.parse(resp)) { - if (evt.textcode == "ITEM_TO_MARK_LAST_HOLD_COPY") { - egConfirmDialog.open( - egCore.strings.MARK_DISCARD_LAST_HOLD_COPY, - egCore.strings.MARK_DISCARD_CONTINUE, - { - barcode : copy.barcode, - ok : function() {}, - cancel :function() {} - } - ).result.then(function() { - arg.handle_last_hold_copy = 1; - result = egCore.net.request( - 'open-ils.circ', - 'open-ils.circ.mark_item_discard', - egCore.auth.token(), copy.id, arg - ).then(function(resp) { - if (evt == egCore.evt.parse(resp)) { - console.error('mark discard/weed failed: ' + evt); - } - }); - }); - } else { - console.error('mark discard/weed failed: ' + evt); + cancel : function() {} } - } + ).result; }); - return result; + } + + service.mark_discard = function(copy) { + return service.mark_item(copy, 13, {}); } service.mark_missing = function(copy_ids) {