0012352: only allow integer numbers for customer number
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 23 Nov 2016 13:09:55 +0000 (14:09 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 23 Nov 2016 13:11:21 +0000 (14:11 +0100)
* prevents non-numbers

https://forge.tine20.org/view.php?id=12352

Change-Id: I257a499df63afa5ed64adecb2cf4d466e020f8c5
Reviewed-on: http://gerrit.tine20.com/customers/3866
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Sales/js/CustomerEditDialog.js

index 8c6bf2c..b553b3f 100644 (file)
@@ -39,13 +39,19 @@ Tine.Sales.CustomerEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
             form = this.getForm();
         
         isValid = Tine.Sales.CustomerEditDialog.superclass.isValid.call(this)
-            
+
         if (Ext.isEmpty(form.findField('adr_street').getValue()) && Ext.isEmpty(form.findField('adr_pobox').getValue())) {
             isValid = false;
             var msg = this.app.i18n._('Either street or postbox is required!');
             form.markInvalid( {'adr_street': msg, 'adr_pobox': msg});
         }
 
+        var number = form.findField('number').getValue();
+        if (number.match(/[^0-9^]+/)) {
+            isValid = false;
+            form.markInvalid( {'number': this.app.i18n._('Only numbers are allowed!')});
+        }
+
         return isValid;
     },