[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [247] trunk/LedgerSMB/Form.pm



Revision: 247
          http://svn.sourceforge.net/ledger-smb/?rev=247&view=rev
Author:   einhverfr
Date:     2006-10-20 21:13:36 -0700 (Fri, 20 Oct 2006)

Log Message:
-----------
Corrected a number of amount parsing problems

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2006-10-21 03:06:46 UTC (rev 246)
+++ trunk/LedgerSMB/Form.pm	2006-10-21 04:13:36 UTC (rev 247)
@@ -388,16 +388,20 @@
 
 	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 @@
 
 	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 @@
 		($numberformat eq '1000,00')) {
 
 		$amount =~ s/\.//g;
-		$amount =~ s/,/\./;
+		$amount =~ s/,/./;
 	}
 	if ($numberformat eq '1 000.00'){
 		$amount =~ s/\s//g;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.