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

SF.net SVN: ledger-smb: [716] trunk



Revision: 716
          http://svn.sourceforge.net/ledger-smb/?rev=716&view=rev
Author:   einhverfr
Date:     2006-12-04 19:02:39 -0800 (Mon, 04 Dec 2006)

Log Message:
-----------
Fixing all bug-1607680-like problems

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm
    trunk/LedgerSMB/CP.pm
    trunk/LedgerSMB/User.pm
    trunk/bin/admin.pl

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2006-12-05 02:58:58 UTC (rev 715)
+++ trunk/LedgerSMB/AA.pm	2006-12-05 03:02:39 UTC (rev 716)
@@ -346,10 +346,10 @@
 				            transdate, fx_transaction)
 				     VALUES (?, (SELECT id FROM chart
 					          WHERE accno = ?),
-				            ? * ?, ?, ?)|;
+				            ?, ?, ?)|;
 
 			@queryargs = ($form->{id}, $ref->{accno}, 
-				$ref->{amount}, $ml, $form->{transdate}, 
+				$ref->{amount} * $ml, $form->{transdate}, 
 				$ref->{fx_transaction});
 			$dbh->prepare($query)->execute(@queryargs) 
 				|| $form->dberror($query);

Modified: trunk/LedgerSMB/CP.pm
===================================================================
--- trunk/LedgerSMB/CP.pm	2006-12-05 02:58:58 UTC (rev 715)
+++ trunk/LedgerSMB/CP.pm	2006-12-05 03:02:39 UTC (rev 716)
@@ -417,12 +417,10 @@
 				INSERT INTO acc_trans 
 				            (trans_id, chart_id, transdate, 
 				            amount)
-				     VALUES (?, ?, 
-				            ?, 
-				            ? * ?)|;
+				     VALUES (?, ?, ?, ?)|;
 			$sth = $dbh->prepare($query);
 			$sth->execute($form->{"id_$i"}, $id, 
-				$form->{date_paid}, $amount, $ml) 
+				$form->{date_paid}, $amount * $ml) 
 					|| $form->dberror($query, 'CP.pm', 427);
 
 			# add payment
@@ -433,11 +431,11 @@
 				     VALUES (?, (SELECT id 
 				                   FROM chart
 				                  WHERE accno = ?),
-				 	    ?, ? * ? * -1, ?, ?)|;
+				 	    ?, ?, ?, ?)|;
 			$sth = $dbh->prepare($query);
 			$sth->execute(
 				$form->{"id_$i"}, $paymentaccno, 
-				$form->{datepaid}, $form->{"paid_$i"}, $ml,
+				$form->{datepaid}, $form->{"paid_$i"} * $ml *-1,
 				$form->{source}, $form->{memo})
 					|| $form->dberror(
 						$query, 'CP.pm', 444);
@@ -458,12 +456,11 @@
 					     VALUES (?, (SELECT id 
 					                   FROM chart
 					                  WHERE accno = ?),
-					             ?, ? * ? * -1, '0', '1', 
-					             ?)|;
+					             ?, ?, '0', '1', ?)|;
 				$sth = $dbh->prepare($query);
 				$sth->execute(
 					$form->{"id_$i"}, $paymentaccno,
-					$form->{datepaid}, $amount, $ml, 
+					$form->{datepaid}, $amount * $ml * -1, 
 					$form->{source})
 						|| $form->dberror(
 							$query, 'CP.pm', 470);
@@ -693,12 +690,12 @@
 				INSERT INTO acc_trans 
 				            (trans_id, chart_id, transdate, 
 				            amount)
-				     VALUES (?, ?, ?, ? * ?)|;
+				     VALUES (?, ?, ?, ?)|;
 
 			$sth = $dbh->prepare($query);
 			$sth->execute(
 				$form->{"id_$i"}, $id, $form->{datepaid},
-				$amount, $ml)
+				$amount * $ml)
 					|| $form->dberror($query, 'CP.pm', 
 						701);
 
@@ -715,12 +712,13 @@
 				INSERT INTO acc_trans 
 				            (trans_id, chart_id, transdate,
 				            amount, source, memo)
-				    VALUES (?, ?, ?, ? * ? * -1, ?, ?)|;
+				    VALUES (?, ?, ?, ?, ?, ?)|;
 
 			$sth = $dbh->prepare($query);
 			$sth->execute(
 				$form->{"id_$i"}, $accno_id, $form->{datepaid},
-				$paid, $ml, $form->{source}, $form->{memo})
+				$paid * $ml * -1, $form->{source}, 
+				$form->{memo})
 					|| $form->dberror($query, 'CP.pm', 
 						723);
 

Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm	2006-12-05 02:58:58 UTC (rev 715)
+++ trunk/LedgerSMB/User.pm	2006-12-05 03:02:39 UTC (rev 716)
@@ -71,10 +71,6 @@
 		chomp($self->{dbname});
 		chomp($self->{dbhost});
 
-		if(! int($self->{dbport})){#in case there's a space or junk in the dbport
-			$self->{dbport} = '5432';
-		}
-
 		$self->{dbconnect} = 'dbi:Pg:dbname='.$self->{dbname}.';host='.$self->{dbhost}.';port='.$self->{dbport};
 
 		if($self->{username}){
@@ -142,13 +138,10 @@
 			$myconfig{$key} = $value;
 		}
 
-		if(! int($myconfig{'dbport'})){#in case there's a space or junk in the dbport
-			$myconfig{'dbport'} = '5432';
-		}
+		chomp($myconfig{'dbport'});
+		chomp($myconfig{'dbname'});
+		chomp($myconfig{'dbhost'});
 
-		if (! $myconfig{'dbhost'}){ # necessary to avoid many issues
-			$myconfig{'dbhost'} = 'localhost';
-		}
 		$myconfig{'login'} = $login;
 		$myconfig{'dbconnect'} = 'dbi:Pg:dbname='.$myconfig{'dbname'}.';host='.$myconfig{'dbhost'}.';port='.$myconfig{'dbport'};
 	}
@@ -277,21 +270,8 @@
 	$form->{dboptions} = $dboptions{$form->{dbdriver}}{$form->{dateformat}};
 
 	$form->{dbconnect} = "dbi:$form->{dbdriver}:dbname=$db";
-
-
-	if ($form->{dbhost}) {
-		$form->{dbconnect} .= ";host=$form->{dbhost}";
-
-	} else {
-		$form->{dbconnect} .= ";host=localhost";
-	}
-
-
-	if ($form->{dbport}) {
-		$form->{dbconnect} .= ";port=$form->{dbport}";
-	} else {
-		$form->{dbconnect} .= ";port=5432";
-	}
+	$form->{dbconnect} .= ";host=$form->{dbhost}";
+	$form->{dbconnect} .= ";port=$form->{dbport}";
   
 }
 
@@ -720,6 +700,14 @@
 	my $userCheck = $dbh->prepare("SELECT id FROM users WHERE username = ?");
 	$userCheck->execute($self->{login});
 	my ($userID) = $userCheck->fetchrow_array;
+
+        if (! $self->{dbhost}) {
+                $self->{dbhost} = 'localhost';
+        }
+        if (! $self->{dbport}) {
+                $self->{dbport} = '5432';
+        }
+
 	my $userConfExists = 0;
 
 	if($userID){

Modified: trunk/bin/admin.pl
===================================================================
--- trunk/bin/admin.pl	2006-12-05 02:58:58 UTC (rev 715)
+++ trunk/bin/admin.pl	2006-12-05 03:02:39 UTC (rev 716)
@@ -270,7 +270,6 @@
 		$href =~ s/ /%20/g;
 
 		$member{$key}{templates} =~ s/^${LedgerSMB::Sysconfig::templates}\///;
-		$member{$key}{dbhost} = 'localhost' unless $member{$key}{dbhost};
 
 		$column_data{login} = qq|<td><a href="$href">$key</a></td>|;
 		$column_data{name} = qq|<td>$member{$key}{name}</td>|;


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