[open-ils-commits] r16036 - in trunk/Open-ILS/web: css/skin/default js/dojo/openils/acq/nls js/ui/default/acq/financial templates/default/acq/financial (senator)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 29 12:41:11 EDT 2010


Author: senator
Date: 2010-03-29 12:41:08 -0400 (Mon, 29 Mar 2010)
New Revision: 16036

Modified:
   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/financial/view_fund.js
   trunk/Open-ILS/web/templates/default/acq/financial/list_funds.tt2
   trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2
Log:
Acq: fund transfer UI


Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css	2010-03-29 15:52:34 UTC (rev 16035)
+++ trunk/Open-ILS/web/css/skin/default/acq.css	2010-03-29 16:41:08 UTC (rev 16036)
@@ -117,6 +117,10 @@
     padding: 4px;
 }
 .oils-acq-fund-tag A { margin-left: 10px; }
+#oils-acq-fund-xfer-table th { vertical-align: top; border-right: 1px solid #999; border-top: 1px solid #999; border-bottom: 1px solid #999; padding: 4px; }
+#oils-acq-fund-xfer-table td { padding-left: 24px; }
+#oils-acq-fund-xfer-name-fund { font-style: italic; }
+#oils-acq-fund-xfer-submit-row { text-align: center; }
 
 /* li search page */
 h1.oils-acq-li-search { font-size: 150%;font-weight: bold;margin-bottom: 12px; }

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-29 15:52:34 UTC (rev 16035)
+++ trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js	2010-03-29 16:41:08 UTC (rev 16036)
@@ -46,5 +46,7 @@
     'COULD_NOT_DELETE_MAPPING': "Error removing tag from fund.",
     'FUND_LIST_ROLLOVER_SUMMARY' : 'Fund Propagation & Rollover Summary for Fiscal Year ${0}',
     'FUND_LIST_ROLLOVER_SUMMARY_FUNDS' : '<b>${1}</b> funds propagated for fiscal year ${0} for the selected locations',
-    'FUND_LIST_ROLLOVER_SUMMARY_ROLLOVER_AMOUNT' : '<b>$${1}</b> unspent money rolled over to fiscal year ${0} for the selected locations'
+    'FUND_LIST_ROLLOVER_SUMMARY_ROLLOVER_AMOUNT' : '<b>$${1}</b> unspent money rolled over to fiscal year ${0} for the selected locations',
+    'FUND_XFER_SAME_SOURCE_AND_DEST': "Cannot transfer. The source and destination funds are the same.",
+    'FUND_XFER_CONFIRM': "Are you sure you're ready to commit this transfer?"
 }

Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js	2010-03-29 15:52:34 UTC (rev 16035)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js	2010-03-29 16:41:08 UTC (rev 16036)
@@ -11,9 +11,11 @@
 dojo.require('openils.Event');
 dojo.require('openils.User');
 dojo.require('openils.Util');
+dojo.require("openils.widget.AutoFieldWidget");
 
 var fund = null;
 var tagManager;
+var xferManager;
 
 function getSummaryInfo(rowIndex, item) {
     if(!item) return'';
@@ -80,9 +82,68 @@
     );
 }
 
+function TransferManager() {
+    var self = this;
+
+    new openils.widget.AutoFieldWidget({
+        "fmField": "fund",
+        /* We're not really using LIDs here, we just need some class that has
+         * a fund field to take advantage of AutoFieldWidget's magic.
+         */
+        "fmClass": "acqlid",
+        "labelFormat": ["${0} (${1})", "code", "year"],
+        "searchFormat": ["${0} (${1})", "code", "year"],
+        "searchFilter": {"active": "t"}, /* consider making it possible to select inactive? */
+        "parentNode": dojo.byId("oils-acq-fund-xfer-d-selector"),
+        "orgLimitPerms": ["ADMIN_ACQ_FUND"], /* XXX is there a more appropriate permission for this? */
+        "dijitArgs": {"name": "d_fund"},
+        "forceSync": true
+    }).build(function(w, ww) { self.fundSelector = w; });
+
+    this.clearFundSelector = function() {
+        if (!this.fundSelector.attr("value"))
+            this.fundSelector.attr("value", "");
+    };
+
+    this.setFundName = function(fund) {
+        dojo.byId("oils-acq-fund-xfer-name-fund").innerHTML =
+            fund.code() + " (" + fund.year() + ") / " + fund.name();
+    };
+
+    this.submit = function() {
+        var values = xferDialog.getValues();
+        if (values.d_fund == fund.id()) {
+            alert(localeStrings.FUND_XFER_SAME_SOURCE_AND_DEST);
+            return false;
+        }
+        if (confirm(localeStrings.FUND_XFER_CONFIRM)) {
+            fieldmapper.standardRequest(
+                ["open-ils.acq", "open-ils.acq.funds.transfer_money"], {
+                    "params": [
+                        openils.User.authtoken,
+                        fund.id(), values.o_amount,
+                        values.d_fund, null,
+                        values.note
+                    ],
+                    "async": true,
+                    "oncomplete": function(r) {
+                        if (openils.Util.readResponse(r) == 1) {
+                            location.href = location.href;
+                        }
+                    }
+                }
+            );
+        }
+        return true;
+    };
+}
+
 function load() {
     tagManager = new TagManager(dojo.byId("oils-acq-tag-manager-display"));
     tagManager.prepareTagSelector(tagSelector);
+
+    xferManager = new TransferManager();
+
     fetchFund();
 }
 

Modified: trunk/Open-ILS/web/templates/default/acq/financial/list_funds.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/list_funds.tt2	2010-03-29 15:52:34 UTC (rev 16035)
+++ trunk/Open-ILS/web/templates/default/acq/financial/list_funds.tt2	2010-03-29 16:41:08 UTC (rev 16036)
@@ -13,7 +13,7 @@
     }
 
     function formatName(value) {
-        if (!value) return "XXX"; // XXX
+        if (!value) return ""; // XXX
 
         var link = "<a href='/eg/acq/financial/view_fund/" +
             value.id + "'>" +

Modified: trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2	2010-03-29 15:52:34 UTC (rev 16035)
+++ trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2	2010-03-29 16:41:08 UTC (rev 16036)
@@ -72,6 +72,60 @@
             </table>
         </div>
     </div> 
+    <div dojoType="dijit.form.DropDownButton">
+        <span>Transfer Money</span>
+        <div jsId="xferDialog" dojoType="dijit.TooltipDialog">
+            <script type="dojo/connect" event="onOpen">
+                /* If something is selected (from a previous time that the
+                user popped open this dialog), unselect it. Wouldn't want to
+                accidentally encourage a transfer that the user didn't mean. */
+                xferManager.clearFundSelector();
+                xferManager.setFundName(fund);
+            </script>
+            <table id="oils-acq-fund-xfer-table">
+                <tr>
+                    <th>
+                        <label for="oils-acq-fund-xfer-o-amount">
+                            Amount to transfer from<br />
+                            <span id="oils-acq-fund-xfer-name-fund"></span>
+                        </label>
+                    </th>
+                    <td>
+                        <input dojoType="dijit.form.CurrencyTextBox"
+                            id="oils-acq-fund-xfer-o-amount"
+                            name="o_amount" />
+                    </td>
+                </tr>
+                <tr>
+                    <th>
+                        <label for="oils-acq-fund-xfer-d-selector">
+                            Destination fund
+                        </label>
+                    </th>
+                    <td>
+                        <span id="oils-acq-fund-xfer-d-selector"></span>
+                    </td>
+                </tr>
+                <tr>
+                    <th>
+                        <label for="oils-acq-fund-xfer-note">Note</label>
+                    </th>
+                    <td>
+                        <input dojoType="dijit.form.TextBox" name="note"
+                            id="oils-acq-fund-xfer-note" />
+                    </td>
+                </tr>
+                <tr>
+                    <td colspan="2" id="oils-acq-fund-xfer-submit-row">
+                        <button onclick="xferManager.submit();"
+                            dojoType="dijit.form.Button" type="submit">
+                            Transfer
+                        </button>
+                    </td>
+                </tr>
+            </table>
+        </div>
+    </div>
 </div>
 
 



More information about the open-ils-commits mailing list