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

SF.net SVN: ledger-smb: [964] branches/1.2/LedgerSMB



Revision: 964
          http://svn.sourceforge.net/ledger-smb/?rev=964&view=rev
Author:   einhverfr
Date:     2007-03-20 17:10:55 -0700 (Tue, 20 Mar 2007)

Log Message:
-----------
Fixing error posting payments and requring user for User::fetch_config

Modified Paths:
--------------
    branches/1.2/LedgerSMB/CP.pm
    branches/1.2/LedgerSMB/User.pm

Modified: branches/1.2/LedgerSMB/CP.pm
===================================================================
--- branches/1.2/LedgerSMB/CP.pm	2007-03-20 23:43:50 UTC (rev 963)
+++ branches/1.2/LedgerSMB/CP.pm	2007-03-21 00:10:55 UTC (rev 964)
@@ -669,7 +669,7 @@
 				 WHERE e.curr = ?
 				       AND a.id = ?|;
 
-			$sth = $sbh->prepare($query);
+			$sth = $dbh->prepare($query);
 			$sth->execute($form->{currency}, $form->{"id_$i"})
 				|| $form->dberror($query, 'CP.pm', 671);
 			my ($exchangerate) = $sth->fetchrow_array;

Modified: branches/1.2/LedgerSMB/User.pm
===================================================================
--- branches/1.2/LedgerSMB/User.pm	2007-03-20 23:43:50 UTC (rev 963)
+++ branches/1.2/LedgerSMB/User.pm	2007-03-21 00:10:55 UTC (rev 964)
@@ -112,39 +112,41 @@
 
 	my ($self, $login) = @_;
 
-	if ($login ne "") {
+	if (!$login){
+		&error($self, "Access Denied");
+	}
+
   
-		# use central db
-		my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH};
-  
-		# for now, this is querying the table directly... ugly 
-		my $fetchUserPrefs = $dbh->prepare("SELECT acs, address, businessnumber,
-												   company, countrycode, currency,
-												   dateformat, dbdriver, dbhost, dbname, 
-												   dboptions, dbpasswd, dbport, dbuser, 
-												   email, fax, menuwidth, name, numberformat, 
-												   password, print, printer, role, sid, 
-												   signature, stylesheet, tel, templates, 
-												   timeout, vclimit, u.username
-											  FROM users_conf as uc, users as u
-											 WHERE u.username =  ?
-											   AND u.id = uc.id;");
+	# use central db
+	my $dbh = ${LedgerSMB::Sysconfig::GLOBALDBH};
+ 
+	# for now, this is querying the table directly... ugly 
+	my $fetchUserPrefs = $dbh->prepare("SELECT acs, address, businessnumber,
+											   company, countrycode, currency,
+											   dateformat, dbdriver, dbhost, dbname, 
+											   dboptions, dbpasswd, dbport, dbuser, 
+											   email, fax, menuwidth, name, numberformat, 
+											   password, print, printer, role, sid, 
+											   signature, stylesheet, tel, templates, 
+											   timeout, vclimit, u.username
+										  FROM users_conf as uc, users as u
+										 WHERE u.username =  ?
+										   AND u.id = uc.id;");
 
-		$fetchUserPrefs->execute($login);
+	$fetchUserPrefs->execute($login);
 
-		my $userHashRef = $fetchUserPrefs->fetchrow_hashref;
+	my $userHashRef = $fetchUserPrefs->fetchrow_hashref;
 
-		while ( my ($key, $value) = each(%{$userHashRef}) ) {
-			$myconfig{$key} = $value;
-		}
+	while ( my ($key, $value) = each(%{$userHashRef}) ) {
+		$myconfig{$key} = $value;
+	}
 
-		chomp($myconfig{'dbport'});
-		chomp($myconfig{'dbname'});
-		chomp($myconfig{'dbhost'});
+	chomp($myconfig{'dbport'});
+	chomp($myconfig{'dbname'});
+	chomp($myconfig{'dbhost'});
 
-		$myconfig{'login'} = $login;
-		$myconfig{'dbconnect'} = 'dbi:Pg:dbname='.$myconfig{'dbname'}.';host='.$myconfig{'dbhost'}.';port='.$myconfig{'dbport'};
-	}
+	$myconfig{'login'} = $login;
+	$myconfig{'dbconnect'} = 'dbi:Pg:dbname='.$myconfig{'dbname'}.';host='.$myconfig{'dbhost'}.';port='.$myconfig{'dbport'};
  
 	return \%myconfig;
 }


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