[open-ils-commits] r16039 - in trunk/Open-ILS: src/perlmods/OpenILS/Application/Acq src/sql/Pg src/sql/Pg/upgrade web/css/skin/default web/js/ui/default/acq/financial web/templates/default/acq/financial (senator)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Mar 29 15:32:04 EDT 2010
Author: senator
Date: 2010-03-29 15:31:59 -0400 (Mon, 29 Mar 2010)
New Revision: 16039
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0221.perm.perm_list.acq_imbalanced_xfer.sql
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
trunk/Open-ILS/web/css/skin/default/acq.css
trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js
trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2
Log:
Acq: In fund transfer, add destination amount field when warranted
When warranted means when source and dest fund have differing currencies.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2010-03-29 19:22:38 UTC (rev 16038)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm 2010-03-29 19:31:59 UTC (rev 16039)
@@ -429,6 +429,8 @@
$ratio = @{$exchange_rate}[0]->{ratio};
}
$dfund_amount = $ofund_amount * $ratio;
+ } else {
+ return $e->die_event unless $e->allowed("ACQ_XFER_MANUAL_DFUND_AMOUNT");
}
$e->json_query({
Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-03-29 19:22:38 UTC (rev 16038)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql 2010-03-29 19:31:59 UTC (rev 16039)
@@ -60,7 +60,7 @@
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0220); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0221'); -- senator
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-03-29 19:22:38 UTC (rev 16038)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-03-29 19:31:59 UTC (rev 16039)
@@ -1332,7 +1332,8 @@
(385, 'CREATE_TRIGGER_VALIDATOR', oils_i18n_gettext(385, 'Allow a user to create trigger validators', 'ppl', 'description')),
(386, 'DELETE_TRIGGER_VALIDATOR', oils_i18n_gettext(386, 'Allow a user to delete trigger validators', 'ppl', 'description')),
(387, 'UPDATE_TRIGGER_VALIDATOR', oils_i18n_gettext(387, 'Allow a user to update trigger validators', 'ppl', 'description')),
- (388, 'UPDATE_ORG_UNIT_SETTING.circ.block_renews_for_holds', oils_i18n_gettext(388, 'Allow a user to enable blocking of renews on items that could fulfill holds', 'ppl', 'description'))
+ (388, 'UPDATE_ORG_UNIT_SETTING.circ.block_renews_for_holds', oils_i18n_gettext(388, 'Allow a user to enable blocking of renews on items that could fulfill holds', 'ppl', 'description')),
+ (389, 'ACQ_XFER_MANUAL_DFUND_AMOUNT', oils_i18n_gettext(389, 'Allow a user to transfer different amounts of money out of one fund and into another', 'ppl', 'description'))
;
SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000);
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0221.perm.perm_list.acq_imbalanced_xfer.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0221.perm.perm_list.acq_imbalanced_xfer.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0221.perm.perm_list.acq_imbalanced_xfer.sql 2010-03-29 19:31:59 UTC (rev 16039)
@@ -0,0 +1,9 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0221'); -- senator
+
+INSERT INTO permission.perm_list (id, code, description)
+ VALUES (389, 'ACQ_XFER_MANUAL_DFUND_AMOUNT',
+ oils_i18n_gettext( 389, 'Allow a user to transfer different amounts of money out of one fund and into another', 'ppl', 'description' ));
+
+COMMIT;
Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css 2010-03-29 19:22:38 UTC (rev 16038)
+++ trunk/Open-ILS/web/css/skin/default/acq.css 2010-03-29 19:31:59 UTC (rev 16039)
@@ -117,9 +117,8 @@
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-table th { border-right: 1px solid #999; border-top: 1px solid #999; border-bottom: 1px solid #999; padding: 4px; }
+#oils-acq-fund-xfer-table td { padding: 4px 4px 4px 24px; }
#oils-acq-fund-xfer-submit-row { text-align: center; }
/* li search page */
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 19:22:38 UTC (rev 16038)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js 2010-03-29 19:31:59 UTC (rev 16039)
@@ -4,6 +4,7 @@
dojo.require('dijit.layout.ContentPane');
dojo.require('dojox.grid.DataGrid');
dojo.require('dijit.form.CurrencyTextBox');
+dojo.require("dijit.form.CheckBox");
dojo.require('dojo.data.ItemFileReadStore');
dojo.require("fieldmapper.OrgUtils");
dojo.require('openils.acq.Fund');
@@ -85,23 +86,43 @@
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._init = function() {
+ 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": {
+ "onChange": function() {
+ openils.Util[
+ this.item.currency_type == fund.currency_type() ?
+ "hide" : "show"
+ ]("oils-acq-fund-xfer-dest-amount", "table-row");
+ }
+ },
+ "forceSync": true
+ }).build(function(w, ww) { self.fundSelector = w; });
+ dijit.byId("oils-acq-fund-xfer-same-o-d").onChange = function() {
+ dijit.byId("oils-acq-fund-xfer-d-amount").attr(
+ "disabled", this.attr("checked")
+ );
+ }
+ };
+
+ this._init();
+
this.clearFundSelector = function() {
- if (!this.fundSelector.attr("value"))
+ if (this.fundSelector.attr("value"))
this.fundSelector.attr("value", "");
};
@@ -112,7 +133,10 @@
this.submit = function() {
var values = xferDialog.getValues();
- if (values.d_fund == fund.id()) {
+ var dfund = this.fundSelector.item;
+ var dfund_id = typeof(dfund.id) == "object" ? dfund.id[0] : dfund.id;
+
+ if (dfund_id == fund.id()) {
alert(localeStrings.FUND_XFER_SAME_SOURCE_AND_DEST);
return false;
}
@@ -121,8 +145,11 @@
["open-ils.acq", "open-ils.acq.funds.transfer_money"], {
"params": [
openils.User.authtoken,
- fund.id(), values.o_amount,
- values.d_fund, null,
+ fund.id(),
+ values.o_amount,
+ dfund_id,
+ (dfund.currency_type != fund.currency_type() &&
+ values.same_o_d.length) ? null : values.d_amount,
values.note
],
"async": true,
@@ -134,7 +161,6 @@
}
);
}
- return true;
};
}
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 19:22:38 UTC (rev 16038)
+++ trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2 2010-03-29 19:31:59 UTC (rev 16039)
@@ -76,7 +76,7 @@
<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
+ /* If a fund 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();
@@ -86,8 +86,10 @@
<tr>
<th>
<label for="oils-acq-fund-xfer-o-amount">
- Amount to transfer from<br />
- <span id="oils-acq-fund-xfer-name-fund"></span>
+ Source amount<br />
+ <em>Amount to transfer from<br />
+ <span id="oils-acq-fund-xfer-name-fund"></span>
+ </em>
</label>
</th>
<td>
@@ -106,6 +108,28 @@
<span id="oils-acq-fund-xfer-d-selector"></span>
</td>
</tr>
+ <tr id="oils-acq-fund-xfer-dest-amount" class="hidden">
+ <th>
+ <label for="oils-acq-fund-xfer-d-selector">
+ Destination amount
+ </label>
+ </th>
+ <td>
+ <div class="oils-acq-basic-roomy">
+ <input id="oils-acq-fund-xfer-same-o-d"
+ dojoType="dijit.form.CheckBox" checked="checked"
+ value="1" name="same_o_d" />
+ <label for="oils-acq-fund-xfer-same-o-d">
+ Same as source amount?
+ </label>
+ </div>
+ <div class="oils-acq-basic-roomy">
+ <input id="oils-acq-fund-xfer-d-amount"
+ dojoType="dijit.form.CurrencyTextBox"
+ name="d_amount" disabled="disabled" />
+ </div>
+ </td>
+ </tr>
<tr>
<th>
<label for="oils-acq-fund-xfer-note">Note</label>
More information about the open-ils-commits
mailing list