From: pines Date: Mon, 12 Mar 2007 14:22:45 +0000 (+0000) Subject: input filter for money fields in copy editor, and convert empty strings to nulls... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2f40c2ba07b0dbcad2e85c18a05c464faa376fcc;p=Evergreen.git input filter for money fields in copy editor, and convert empty strings to nulls, and for display, show nulls as git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_0_3@7062 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/server/cat/copy_editor.js b/Open-ILS/xul/staff_client/server/cat/copy_editor.js index 20db41981d..3e4b8f67b0 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_editor.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_editor.js @@ -436,6 +436,9 @@ g.apply = function(field,value) { g.error.sdump('D_TRACE','applying field = <' + field + '> value = <' + value + '>\n'); if (value == '') value = null; if (field == 'alert_message') { value = value.replace(/^\W+$/g,''); } + if (field == 'price' || field == 'deposit_amount') { + if (value == '') { value = null; } else { JSAN.use('util.money'); value = util.money.sanitize( value ); } + } for (var i = 0; i < g.copies.length; i++) { var copy = g.copies[i]; try { @@ -842,14 +845,14 @@ g.panes_and_field_names = { [ "Deposit Amount", { - render: 'util.money.sanitize( fm.deposit_amount() );', + render: 'if (fm.deposit_amount() == null) { ""; } else { util.money.sanitize( fm.deposit_amount() ); }', input: 'c = function(v){ g.apply("deposit_amount",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);', } ], [ "Price", { - render: 'util.money.sanitize( fm.price() );', + render: 'if (fm.price() == null) { ""; } else { util.money.sanitize( fm.price() ); }', input: 'c = function(v){ g.apply("price",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);', } ], diff --git a/Open-ILS/xul/staff_client/server/circ/util.js b/Open-ILS/xul/staff_client/server/circ/util.js index 14b173088f..12281f78ac 100644 --- a/Open-ILS/xul/staff_client/server/circ/util.js +++ b/Open-ILS/xul/staff_client/server/circ/util.js @@ -497,11 +497,11 @@ circ.util.columns = function(modify,params) { }, { 'persist' : 'hidden width ordinal', 'id' : 'deposit_amount', 'label' : getString('staff.acp_label_deposit_amount'), 'flex' : 1, - 'primary' : false, 'hidden' : true, 'render' : function(my) { return util.money.sanitize(my.acp.deposit_amount()); }, 'sort_type' : 'money', + 'primary' : false, 'hidden' : true, 'render' : function(my) { return my.acp.price() == null ? "" : util.money.sanitize(my.acp.deposit_amount()); }, 'sort_type' : 'money', }, { 'persist' : 'hidden width ordinal', 'id' : 'price', 'label' : getString('staff.acp_label_price'), 'flex' : 1, - 'primary' : false, 'hidden' : true, 'render' : function(my) { return util.money.sanitize(my.acp.price()); }, 'sort_type' : 'money', + 'primary' : false, 'hidden' : true, 'render' : function(my) { return my.acp.price() == null ? "" : util.money.sanitize(my.acp.price()); }, 'sort_type' : 'money', }, { 'persist' : 'hidden width ordinal', 'id' : 'circ_as_type', 'label' : getString('staff.acp_label_circ_as_type'), 'flex' : 1,