LP#1750894 Invoice close date/by fields UI WIP user/berick/lp1750894-invoice-close-date
authorBill Erickson <berickxx@gmail.com>
Tue, 13 Mar 2018 20:22:04 +0000 (16:22 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 13 Mar 2018 20:22:04 +0000 (16:22 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/acq/invoice/view.js

index 8ace4b3..4888d5e 100644 (file)
@@ -1245,6 +1245,11 @@ function drawInvoicePane(parentNode, inv, args) {
             },
             recv_method : {widgetValue : 'PPR'}
         };
+    } else {
+        if (inv.closed_by()) {
+            dojo.mixin(override, 
+                {closed_by: {widgetValue : inv.closed_by().usrname()}});
+        }
     }
 
     dojo.mixin(override, {
@@ -1286,6 +1291,10 @@ function drawInvoicePane(parentNode, inv, args) {
     );
 
 
+    // Display the close date/by data for closed invoices.
+    var readOnly = inv && inv.close_date();
+    var suppress = readOnly ? ['id'] : ['id', 'close_date', 'closed_by'];
+
     pane = new openils.widget.EditPane({
         fmObject : inv,
         paneStackCount : 2,
@@ -1293,7 +1302,7 @@ function drawInvoicePane(parentNode, inv, args) {
         mode : (inv) ? 'edit' : 'create',
         hideActionButtons : true,
         overrideWidgetArgs : override,
-        readOnly : (inv) && inv.close_date(),
+        readOnly : readOnly,
         requiredFields : [
             'inv_ident', 
             'recv_date', 
@@ -1308,7 +1317,7 @@ function drawInvoicePane(parentNode, inv, args) {
             'provider', 
             'shipper'
         ],
-        suppressFields : ['id', 'close_date', 'closed_by']
+        suppressFields : suppress
     });
 
     pane.startup();