From: Lebbeous Fogle-Weekley Date: Thu, 30 May 2013 16:09:10 +0000 (-0400) Subject: Acq: Prevent interface from attempting repeat receives, unreceives X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fsenator%2Facq-prevent-rereceive-reunreceive;p=working%2FEvergreen.git Acq: Prevent interface from attempting repeat receives, unreceives If staff should select received lineitems and try to receive them again, or if staff selects unreceived lineitems and tries to unreceive them again, Evergreen doesn't do anything wrong to the data, but the interface can get stuck on the page where you see counts next to labels like "Lineitems Processed" and so on. This should fix that by filtering out any received lineitems from the list that the interface will pass to the receive operation, and any already unreceived lineitems that the interface will pass to the unreceive operation. If you have nothing selected but inappropriate lineitems, the alert message you get will just say "You have not selected any lineitems." This is admittedly a bit confusing, but I have heard that for bugfixes we can't change strings or introduce new ones because to do so makes trouble for translators. So we have to rely on the strings we already have. If I am mistaken about this, we can happily change the alert message to be more clear. Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/web/js/ui/default/acq/common/li_table.js b/Open-ILS/web/js/ui/default/acq/common/li_table.js index 7a804da228..40a270f6f6 100644 --- a/Open-ILS/web/js/ui/default/acq/common/li_table.js +++ b/Open-ILS/web/js/ui/default/acq/common/li_table.js @@ -2949,7 +2949,9 @@ function AcqLiTable() { }; this.receiveSelectedLineitems = function() { - var li_list = this.getSelected(); + var li_list = this.getSelected().filter( + function(li) { return li.state() != "received" } + ); if (!li_list.length) { alert(localeStrings.NO_LI_GENERAL); @@ -3033,7 +3035,12 @@ function AcqLiTable() { }; this.rollbackReceiveLineitems = function() { - var li_id_list = this.getSelected(false, null, true); + var li_id_list = this.getSelected().filter( + function(li) { return li.state() == "received" } + ).map( + function(li) { return li.id() } + ); + if (!li_id_list.length) { alert(localeStrings.NO_LI_GENERAL); return;