LP#1058321: Possible to receive a pending purchase order
authorMark Cooper <markchristophercooper@gmail.com>
Tue, 16 Oct 2012 01:03:44 +0000 (18:03 -0700)
committerJason Stephenson <jstephenson@mvlc.org>
Fri, 14 Dec 2012 18:43:38 +0000 (13:43 -0500)
Restrict 'Mark purchase order as received' to on-order state
purchase orders, and 'Un-Receive Purchase Order' to 'received'
POs. Otherwise inconsistencies easily occur ...

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/src/templates/acq/common/li_table.tt2
Open-ILS/web/js/ui/default/acq/po/view_po.js

index 00c2727..328bed0 100644 (file)
@@ -28,8 +28,8 @@
                                             <option mask='po' value='create_assets'>Load Bibs and Items</option>
                                             <option mask='po' value='cancel_lineitems'>Cancel Selected Lineitems</option>
                                             <option mask='po' value='change_claim_policy'>Change Claim Policy</option>
                                             <option mask='po' value='create_assets'>Load Bibs and Items</option>
                                             <option mask='po' value='cancel_lineitems'>Cancel Selected Lineitems</option>
                                             <option mask='po' value='change_claim_policy'>Change Claim Policy</option>
-                                            <option mask='po' value='receive_po'>Mark Purchase Order as Received</option>
-                                            <option mask='po' value='rollback_receive_po'>Un-Receive Purchase Order</option>
+                                            <option mask='po' value='receive_po' id='receive_po' disabled='disabled'>Mark Purchase Order as Received</option>
+                                            <option mask='po' value='rollback_receive_po' id='rollback_receive_po' disabled='disabled'>Un-Receive Purchase Order</option>
                                             <option mask='po' value='print_po'>Print Purchase Order</option>
                                             <option mask='po' value='po_history'>View PO History</option>
                                             <option mask='po' value='batch_create_invoice'>[% l('Create Invoice From Selected Lineitems') %]</option>
                                             <option mask='po' value='print_po'>Print Purchase Order</option>
                                             <option mask='po' value='po_history'>View PO History</option>
                                             <option mask='po' value='batch_create_invoice'>[% l('Create Invoice From Selected Lineitems') %]</option>
index 4c2a7e7..faab39d 100644 (file)
@@ -319,7 +319,11 @@ function renderPo() {
                     openils.Util.timeStamp(PO.order_date(), {formatLength:'short'})
                 ]
             );
                     openils.Util.timeStamp(PO.order_date(), {formatLength:'short'})
                 ]
             );
-
+        if(PO.state() == "on-order") {
+            dojo.removeAttr('receive_po', 'disabled');
+        } else if(PO.state() == "received") {
+            dojo.removeAttr('rollback_receive_po', 'disabled');
+        }
     }
 
     makePrepayWidget(
     }
 
     makePrepayWidget(