From: Thomas Kasulke Date: Fri, 25 May 2007 09:12:30 +0000 (+0000) Subject: Stricktere Überwachung der Nummernformate eingeführt. Auch 1000,00 wird bei Formaten... X-Git-Tag: release-2.4.3^2~256 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f411025cef83276e66b13a30420876cfbd457fc6;p=kivitendo-erp.git Stricktere Überwachung der Nummernformate eingeführt. Auch 1000,00 wird bei Formaten wie 1,000.00 und 1.000,00 jetzt als falsch erkannt. --- diff --git a/js/common.js b/js/common.js index ffbcd43cd..d4d5ab7b9 100644 --- a/js/common.js +++ b/js/common.js @@ -57,9 +57,12 @@ function check_right_number_format(input_name) { thnumbers[thnumbers.length-1] = thnumbers[thnumbers.length-1].substring((thnumbers[thnumbers.length-1].lastIndexOf(",") !== -1 ? thnumbers[thnumbers.length-1].lastIndexOf(",") : thnumbers[thnumbers.length-1].length), 0); } - for(var i = 1; i < thnumbers.length; i++) { - if(thnumbers[i].length !== 3) { - return show_alert_and_focus(input_name, wrongNumberFormat+thnumbers); + for(var i = 0; i < thnumbers.length; i++) { + if(i == 0 && thnumbers[i].length > 3) { + return show_alert_and_focus(input_name, wrongNumberFormat); + } + if(i > 0 && thnumbers[i].length != 3) { + return show_alert_and_focus(input_name, wrongNumberFormat); } } } @@ -71,11 +74,11 @@ function check_right_number_format(input_name) { } if(decnumbers.length == 2) { if(decnumbers[1].length > 2) { - return show_alert_and_focus(input_name, wrongNumberFormat + decnumbers); + return show_alert_and_focus(input_name, wrongNumberFormat); } } else { - if(decnumbers.length > 1 || decnumbers.length == 0) { + if(decnumbers.length > 2) { return show_alert_and_focus(input_name, wrongNumberFormat); } if(!thpoint) { @@ -133,7 +136,7 @@ function getDateArray(input_name) { function show_alert_and_focus(input_name, errorMessage) { input_name.select(); - alert(errorMessage + "\n\r\n\r--> " + input_name.value); // + "\ndecpoint: " + decpoint + "\nthpoint: " + thpoint + alert(errorMessage + "\n\r\n\r--> " + input_name.value); input_name.focus(); return false; }