[open-ils-commits] r15937 - in trunk/Open-ILS: src/perlmods/OpenILS/Application/Acq web/css/skin/default web/js/dojo/openils/acq/nls web/js/ui/default/acq/common web/js/ui/default/acq/po web/templates/default/acq/common web/templates/default/acq/po (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 23 12:00:29 EDT 2010


Author: senator
Date: 2010-03-23 12:00:26 -0400 (Tue, 23 Mar 2010)
New Revision: 15937

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
   trunk/Open-ILS/web/css/skin/default/acq.css
   trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
   trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
   trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js
   trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
   trunk/Open-ILS/web/templates/default/acq/po/view.tt2
Log:
Acq: optionally mark POs as prepayment_required; show/confirm it where needed

The PO creation dialog box now has a checkbox for "prepayment required." This
will be checked or unchecked automatically when choosing a vendor from the
above dropdown based on whether that vendor's "prepayment required" value is
true.  The user can override the default value for a vendor, but will face a
confirmation dialog about it.

The PO viewing interface shows whether or not a PO is marked "prepayment
required," and if it is, when the user wishes to activate the PO, there will
be another confirmation dialog reminding the user to deal with payment.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm	2010-03-23 13:47:06 UTC (rev 15936)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm	2010-03-23 16:00:26 UTC (rev 15937)
@@ -1433,6 +1433,8 @@
     my %pargs = (ordering_agency => $e->requestor->ws_ou); # default
     $pargs{provider} = $po->provider if $po->provider;
     $pargs{ordering_agency} = $po->ordering_agency if $po->ordering_agency;
+    $pargs{prepayment_required} = $po->prepayment_required
+        if $po->prepayment_required;
     $po = create_purchase_order($mgr, %pargs) or return $e->die_event;
 
     my $li_ids = $$args{lineitems};

Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css	2010-03-23 13:47:06 UTC (rev 15936)
+++ trunk/Open-ILS/web/css/skin/default/acq.css	2010-03-23 16:00:26 UTC (rev 15937)
@@ -60,6 +60,7 @@
 .oils-acq-po-records-author-row td { padding-left: 30px; }
 .oils-acq-po-records-phys_desc-row td { padding-left: 30px; }
 .oils-acq-po-records-phys_desc-row {}
+.oils-acq-po-prepay { font-weight: bold; color: #c00; }
 
 #oils-acq-po-paging-block { width: 50%; text-align: left;}
 #oils-acq-po-actions-block { width: 50%; text-align: right;}

Modified: trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js	2010-03-23 13:47:06 UTC (rev 15936)
+++ trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js	2010-03-23 16:00:26 UTC (rev 15937)
@@ -32,5 +32,10 @@
     'LI_CANCEL_CONFIRM': "Are you SURE you want to cancel this line item?",
     'LID_CANCEL_CONFIRM': "Are you SURE you want to cancel this copy?",
     'CANCEL_REASON': "Cancel reason",
-    'CANCEL': "Cancel"
+    'CANCEL': "Cancel",
+    'YES': "Yes",
+    'NO' : "No",
+    'VENDOR_SAYS_PREPAY_NOT_NEEDED': "The selected vendor does not necessarily require prepayment, according\nto records. Require prepayment on this PO anyway?",
+    'VENDOR_SAYS_PREPAY_NEEDED': "The selected vendor requires prepayment, according to records.\nProceed anyway without required prepayment on this PO?",
+    'PREPAYMENT_REQUIRED_REMINDER': "This PO requires prepayment.  Are you certain you're ready to activate it?"
 }

Modified: trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2010-03-23 13:47:06 UTC (rev 15936)
+++ trunk/Open-ILS/web/js/ui/default/acq/common/li_table.js	2010-03-23 16:00:26 UTC (rev 15937)
@@ -68,8 +68,12 @@
         });
 
     acqLitCreatePoSubmit.onClick = function() {
-        acqLitPoCreateDialog.hide();
-        self._createPO(acqLitPoCreateDialog.getValues());
+        if (self._confirmPoPrepaySituation()) {
+            acqLitPoCreateDialog.hide();
+            self._createPO(acqLitPoCreateDialog.getValues());
+        } else {
+            return false;
+        }
     }
 
     acqLitSavePlButton.onClick = function() {
@@ -456,7 +460,7 @@
             }
         }
 
-        if (note.vendor_public() == "t")
+        if (openils.Util.isTrue(note.vendor_public()))
             nodeByName("vendor_public", row).innerHTML =
                 localeStrings.VENDOR_PUBLIC;
 
@@ -1485,6 +1489,25 @@
         }
     }
 
+    this._updateCreatePoPrepayCheckbox = function(prepay) {
+        var prepay = openils.Util.isTrue(prepay);
+        this._prepayRequiredByVendor = prepay;
+        dijit.byId("acq-lit-po-prepay").attr("checked", prepay);
+    };
+
+    this._confirmPoPrepaySituation = function() {
+        var want_prepay = dijit.byId("acq-lit-po-prepay").attr("checked");
+        if (want_prepay != this._prepayRequiredByVendor) {
+            return confirm(
+                want_prepay ?
+                    localeStrings.VENDOR_SAYS_PREPAY_NOT_NEEDED :
+                    localeStrings.VENDOR_SAYS_PREPAY_NEEDED
+            );
+        } else {
+            return true;
+        }
+    };
+
     this.applySelectedLiAction = function(action) {
         var self = this;
         switch(action) {
@@ -1501,6 +1524,15 @@
                         fmClass : 'acqpo',
                         searchFilter: {"active": "t"},
                         parentNode : dojo.byId('acq-lit-po-provider'),
+                        dijitArgs : {
+                            "onChange": function() {
+                                if (this.item) {
+                                    self._updateCreatePoPrepayCheckbox(
+                                        this.item.prepayment_required
+                                    );
+                                }
+                            }
+                        }
                     });
                     widget.build(
                         function(w) { self.createPoProviderSelector = w; }
@@ -1829,6 +1861,7 @@
         var po = new fieldmapper.acqpo();
         po.provider(this.createPoProviderSelector.attr('value'));
         po.ordering_agency(this.createPoAgencySelector.attr('value'));
+        po.prepayment_required(fields.prepayment_required[0] ? true : false);
 
         var selected = this.getSelected( (fields.create_from == 'all') );
         if(selected.length == 0) return;

Modified: trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js	2010-03-23 13:47:06 UTC (rev 15936)
+++ trunk/Open-ILS/web/js/ui/default/acq/po/view_po.js	2010-03-23 16:00:26 UTC (rev 15937)
@@ -46,7 +46,7 @@
 
         nodeByName("value", row).innerHTML = note.value();
 
-        if (note.vendor_public() == "t")
+        if (openils.Util.isTrue(note.vendor_public()))
             nodeByName("vendor_public", row).innerHTML =
                 localeStrings.VENDOR_PUBLIC;
 
@@ -187,6 +187,16 @@
     }
 }
 
+function makePrepayWidget(node, prepay) {
+    if (prepay) {
+        openils.Util.addCSSClass(node, "oils-acq-po-prepay");
+        node.innerHTML = localeStrings.YES;
+    } else {
+        openils.Util.removeCSSClass(node, "oils-acq-po-prepay");
+        node.innerHTML = localeStrings.NO;
+    }
+}
+
 function makeCancelWidget(node, labelnode) {
     openils.Util.hide("acq-po-choose-cancel-reason");
 
@@ -246,6 +256,10 @@
     dojo.byId("acq-po-view-total-enc").innerHTML = PO.amount_encumbered();
     dojo.byId("acq-po-view-total-spent").innerHTML = PO.amount_spent();
     dojo.byId("acq-po-view-state").innerHTML = PO.state(); // TODO i18n
+    makePrepayWidget(
+        dojo.byId("acq-po-view-prepay"),
+        openils.Util.isTrue(PO.prepayment_required())
+    );
     makeCancelWidget(
         dojo.byId("acq-po-view-cancel-reason"),
         dojo.byId("acq-po-cancel-label")
@@ -299,6 +313,11 @@
 }
 
 function activatePo() {
+    if (
+        openils.Util.isTrue(PO.prepayment_required()) &&
+        !confirm(localeStrings.PREPAYMENT_REQUIRED_REMINDER)
+    ) return false;
+
     progressDialog.show(true);
     try {
         fieldmapper.standardRequest(

Modified: trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2010-03-23 13:47:06 UTC (rev 15936)
+++ trunk/Open-ILS/web/templates/default/acq/common/li_table.tt2	2010-03-23 16:00:26 UTC (rev 15937)
@@ -302,6 +302,10 @@
                     <td><div name='provider' id='acq-lit-po-provider'/></td>
                 </tr>
                 <tr>
+                    <td>Prepayment Required</td>
+                    <td><input id="acq-lit-po-prepay" name="prepayment_required" dojoType="dijit.form.CheckBox"/></td>
+                </tr>
+                <tr>
                     <td>All Lineitems</td>
                     <td><input checked='checked' name='create_from' value='all' dojoType='dijit.form.RadioButton'/></td>
                 </tr>

Modified: trunk/Open-ILS/web/templates/default/acq/po/view.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/po/view.tt2	2010-03-23 13:47:06 UTC (rev 15936)
+++ trunk/Open-ILS/web/templates/default/acq/po/view.tt2	2010-03-23 16:00:26 UTC (rev 15937)
@@ -13,6 +13,7 @@
                 <tr><td>Total Encumbered</td><td>$<span id='acq-po-view-total-enc'/></td></tr>
                 <tr><td>Total Spent</td><td>$<span id='acq-po-view-total-spent'/></td></tr>
                 <tr><td>Status</td><td><span id='acq-po-view-state'/></td></tr>
+                <tr><td>Prepayment Required?</td><td><span id="acq-po-view-prepay"/></td></tr>
                 <tr>
                     <td id="acq-po-cancel-label"></td>
                     <td>



More information about the open-ils-commits mailing list