LP#1058321: Acq: Possible to receive a pending purchase order
authorMark Cooper <markchristophercooper@gmail.com>
Wed, 24 Oct 2012 05:02:38 +0000 (22:02 -0700)
committerJason Stephenson <jstephenson@mvlc.org>
Fri, 14 Dec 2012 18:43:39 +0000 (13:43 -0500)
Revised to allow a cancelled PO to be received, as this is needed under
certain conditions (note - bib/items are not restored in this case).
Added po_state variable to avoid repeated PO.state() function invocations.

Signed-off-by: Mark Cooper <markchristophercooper@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/web/js/ui/default/acq/po/view_po.js

index faab39d..490de97 100644 (file)
@@ -300,6 +300,7 @@ function prepareInvoiceFeatures() {
 }
 
 function renderPo() {
+    var po_state = PO.state();
     dojo.byId("acq-po-view-id").innerHTML = PO.id();
     dojo.byId("acq-po-view-name").innerHTML = PO.name();
     makeProviderLink(
@@ -309,7 +310,7 @@ function renderPo() {
     dojo.byId("acq-po-view-total-li").innerHTML = PO.lineitem_count();
     dojo.byId("acq-po-view-total-enc").innerHTML = PO.amount_encumbered().toFixed(2);
     dojo.byId("acq-po-view-total-spent").innerHTML = PO.amount_spent().toFixed(2);
-    dojo.byId("acq-po-view-state").innerHTML = PO.state(); // TODO i18n
+    dojo.byId("acq-po-view-state").innerHTML = po_state; // TODO i18n
 
     if(PO.order_date()) {
         openils.Util.show('acq-po-activated-on', 'inline');
@@ -319,9 +320,9 @@ function renderPo() {
                     openils.Util.timeStamp(PO.order_date(), {formatLength:'short'})
                 ]
             );
-        if(PO.state() == "on-order") {
+        if(po_state == "on-order" || po_state == "cancelled") {
             dojo.removeAttr('receive_po', 'disabled');
-        } else if(PO.state() == "received") {
+        } else if(po_state == "received") {
             dojo.removeAttr('rollback_receive_po', 'disabled');
         }
     }
@@ -337,7 +338,7 @@ function renderPo() {
     // dojo.byId("acq-po-view-notes").innerHTML = PO.notes().length;
     poNoteTable.updatePoNotesCount();
 
-    if (PO.state() == "pending") {
+    if (po_state == "pending") {
         checkCouldActivatePo();
         if (PO.lineitem_count() > 1)
             openils.Util.show("acq-po-split");