From: Jason Stephenson Date: Sat, 20 Oct 2018 18:55:53 +0000 (-0400) Subject: Revert "Attempt to get flesh_copy_status to work." X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=eef6b965d6d2734cf8e292b3b4ecb8f4eaecf17f;p=working%2FEvergreen.git Revert "Attempt to get flesh_copy_status to work." This reverts commit 7248fc97f04c645409c6c244b1de5cc1937fa267. --- 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 4660a71c65..03d36e8af8 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,21 +1374,76 @@ function($uibModal , $q , egCore , egAlertDialog , egConfirmDialog, egAddCopyAl }).result; } - service.mark_item = function(copy, markstatus, args) { - if (!copy) return $q.when(); - return egConfirmDialog.open( - egCore.strings.MARK_ITEM_CHECKED_OUT, - egCore.sttring.MARK_ITEM_CONTINUE, - { - status : copy.status().name(), - ok : function() {}, - cancel : function() {} - }).result; - } - service.mark_discard = function(copy) { - service.flesh_copy_status(copy).then(function(copy) { - return service.mark_item(copy, 13, {})}); + 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, + { + 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); + } + } + }); + return result; } service.mark_missing = function(copy_ids) {