diff options
-rwxr-xr-x | LedgerSMB/Form.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index 4b6fbad2..e952d1c3 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -478,14 +478,24 @@ sub parse_amount { my ($self, $myconfig, $amount) = @_; - if (($myconfig->{numberformat} eq '1.000,00') || - ($myconfig->{numberformat} eq '1000,00')) { + my $numberformat = $myconfig->{numberformat}; + my $decimal_regex = /\.\d{2}/; + if (($numberformat !~ $decimal_regex) and ($amount =~ $decimal_regex)){ + # We have already parsed this number + $numberformat = "1000.00"; + } + + if (($numberformat eq '1.000,00') || + ($numberformat eq '1000,00')) { $amount =~ s/\.//g; $amount =~ s/,/\./; } + if ($numberformat eq '1 000.00'){ + $amount =~ s/\s//g; + } - if ($myconfig->{numberformat} eq "1'000.00") { + if ($numberformat eq "1'000.00") { $amount =~ s/'//g; } |