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 <lebbeous@esilibrary.com>
};
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);
};
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;