From: senator Date: Mon, 29 Mar 2010 16:41:08 +0000 (+0000) Subject: Acq: fund transfer UI X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1412f9af8a8de067e371fb1291c02c27cfa1695d;p=evergreen%2Fbjwebb.git Acq: fund transfer UI git-svn-id: svn://svn.open-ils.org/ILS/trunk@16036 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/css/skin/default/acq.css b/Open-ILS/web/css/skin/default/acq.css index ea8eaa58a..78e2bd1d3 100644 --- a/Open-ILS/web/css/skin/default/acq.css +++ b/Open-ILS/web/css/skin/default/acq.css @@ -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; } diff --git a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js index 739b6c154..af3c7774b 100644 --- a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js +++ b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js @@ -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' : '${1} funds propagated for fiscal year ${0} for the selected locations', - 'FUND_LIST_ROLLOVER_SUMMARY_ROLLOVER_AMOUNT' : '$${1} unspent money rolled over to fiscal year ${0} for the selected locations' + 'FUND_LIST_ROLLOVER_SUMMARY_ROLLOVER_AMOUNT' : '$${1} 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?" } diff --git a/Open-ILS/web/js/ui/default/acq/financial/view_fund.js b/Open-ILS/web/js/ui/default/acq/financial/view_fund.js index eb0f0bdf9..5a0a779ef 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/view_fund.js +++ b/Open-ILS/web/js/ui/default/acq/financial/view_fund.js @@ -11,9 +11,11 @@ dojo.require('openils.acq.FundingSource'); 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 fetchFund() { ); } +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(); } diff --git a/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 b/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 index 4622fa1aa..937c277f9 100644 --- a/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 @@ -13,7 +13,7 @@ } function formatName(value) { - if (!value) return "XXX"; // XXX + if (!value) return ""; // XXX var link = "" + diff --git a/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 b/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 index 694512881..f98c38527 100644 --- a/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 @@ -72,6 +72,60 @@ +
+ Transfer Money +
+ + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ +
+
+