X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FForm.pm;h=582d2aff8edc33ee04ca949fd389de145558d644;hb=af56ae02cd83ad4fff35a3ef695a9fcf4c074caf;hp=4db9e4bd478f69b02fc569f6852a5f3878d1f60a;hpb=300f3739cfe93d10a867a778a1430068c00c32a8;p=kivitendo-erp.git diff --git a/SL/Form.pm b/SL/Form.pm index 4db9e4bd4..582d2aff8 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1172,17 +1172,12 @@ sub parse_amount { } $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 {