Revision ae3d4c2c
Von Moritz Bunkus vor fast 14 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
}
|
||
|
||
$amount =~ s/,//g;
|
||
# make shure no code wich is not a math expression ends in eval()
|
||
|
||
$amount =~ s/\s//g;
|
||
|
||
unless($amount =~ /^[-\+]?\d+\.?\d*([-\+\*\/][-\+]?\d+\.?\d*)*$/){
|
||
return 0;
|
||
}
|
||
|
||
$main::lxdebug->leave_sub(2);
|
||
|
||
return (eval $amount) * 1 ;
|
||
# Make sure no code wich is not a math expression ends up in eval().
|
||
return 0 unless $amount =~ /^ [\s \d \( \) \- \+ \* \/ \. ]* $/x;
|
||
return scalar(eval($amount)) * 1 ;
|
||
}
|
||
|
||
sub round_amount {
|
js/common.js | ||
---|---|---|
if(decpoint && decpoint == ','){
|
||
test_val = test_val.replace(/,/g, '.');
|
||
}
|
||
var forbidden = test_val.match(/[^-\+\/\*\.0-9\ ]/g );
|
||
var forbidden = test_val.match(/[^\s\d\(\)\-\+\*\/\.]/g);
|
||
if (forbidden && forbidden.length > 0 ){
|
||
return show_alert_and_focus(input_name, wrongNumberFormat);
|
||
}
|
Auch abrufbar als: Unified diff
Berechnung in Zahlenfelder: Erlaubte Zeichen auf Klammern ausgeweitet