allow data entry of negative currency amounts
authorgmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 12 Jan 2011 00:30:07 +0000 (00:30 +0000)
committergmc <gmc@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 12 Jan 2011 00:30:07 +0000 (00:30 +0000)
Plug in fix for Dojo bug http://bugs.dojotoolkit.org/ticket/9438, which
was preventing the input of discounts and credits during invoice
creation.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

git-svn-id: svn://svn.open-ils.org/ILS/trunk@19163 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/widget/AutoFieldWidget.js

index e300fb1..a3ba60b 100644 (file)
@@ -225,6 +225,16 @@ if(!dojo._hasResource['openils.widget.AutoFieldWidget']) {
 
                     case 'money':
                         dojo.require('dijit.form.CurrencyTextBox');
+                        // plug in fix for Dojo bug http://bugs.dojotoolkit.org/ticket/9438
+                        // to allow entry of negative values; won't be needed after we upgrade
+                        // to Dojo 1.5
+                        dojo.extend(dijit.form.CurrencyTextBox, {
+                            regExpGen: function(constraints){
+                                return this._focused ?
+                                    dojo.number.regexp(dojo.mixin(dojo.mixin(this.editOptions, constraints), {type: 'decimal'})) :
+                                    dojo.currency.regexp(constraints);
+                            }
+                        });
                         this.widget = new dijit.form.CurrencyTextBox(this.dijitArgs, this.parentNode);
                         break;