diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-10-21 04:13:36 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-10-21 04:13:36 +0000 |
commit | 6368d71c71eabcb28dd895f9311750ac1eef737a (patch) | |
tree | 2ea1acf579786d5780c6e1fda28a2294a3efdf13 /LedgerSMB | |
parent | 39fd76db4fe613342f89500d4745ee3672559bde (diff) |
Corrected a number of amount parsing problems
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@247 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-x | LedgerSMB/Form.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index 8c9cc51a..b42f7584 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -388,16 +388,20 @@ sub format_amount { my ($self, $myconfig, $amount, $places, $dash) = @_; + my $negative = ($amount < 0); + print STDERR "$amount\n"; if ($amount){ $amount =~ s/-//; $amount = $self->parse_amount($myconfig, $amount); } + print STDERR "$amount\n"; if ($places =~ /\d+/) { #$places = 4 if $places == 2; $amount = $self->round_amount($amount, $places); } + print STDERR "$amount\n"; # is the amount negative @@ -489,7 +493,7 @@ sub parse_amount { my ($self, $myconfig, $amount) = @_; - if (!UNIVERSAL::isa($amount, 'Math::BigFloat')){ # Amount may not be an object + if (UNIVERSAL::isa($amount, 'Math::BigFloat')){ # Amount may not be an object return $amount; } my $numberformat = $myconfig->{numberformat}; @@ -503,7 +507,7 @@ sub parse_amount { ($numberformat eq '1000,00')) { $amount =~ s/\.//g; - $amount =~ s/,/\./; + $amount =~ s/,/./; } if ($numberformat eq '1 000.00'){ $amount =~ s/\s//g; |