From 15e6089f601dd12bfc11d4315ce46da9e56ad1e4 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 14 Feb 2012 13:14:40 -0500 Subject: [PATCH] Refresh PO activatable state after all prices entered After all lineitems within a PO have a price, re-test whether the PO can be activated. This allows the activation of PO's without having to refresh the page after the last price is entered. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../web/js/ui/default/acq/common/li_table.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 eb0b620354..6ee88d24ee 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 @@ -831,7 +831,7 @@ function AcqLiTable() { } this.updateLiPrice = function(input, li) { - + var self = this; var price = input.value; if(Number(price) == Number(li.estimated_unit_price())) return; @@ -843,6 +843,20 @@ function AcqLiTable() { oncomplete : function(r) { openils.Util.readResponse(r); li.estimated_unit_price(price); // update local copy + + /* + * If this is a PO and every visible lineitem has a price, + * check again to see if this PO can be activated. Note that + * every visible lineitem having a price does not guarantee it can + * be activated, which is why we still make the call. Having a price + * set for every visiable lineitem is just the lowest barrier to entry. + */ + if (self.isPO) { + var priceNodes = dojo.query('[name=price]', dojo.byId('acq-lit-tbody')); + var allSet = true; + dojo.forEach(priceNodes, function(node) { if (node.value == '') allSet = false}); + if (allSet) checkCouldActivatePo(); + } } } ); -- 2.43.2