summaryrefslogtreecommitdiff
path: root/LedgerSMB/User.pm
diff options
context:
space:
mode:
Diffstat (limited to 'LedgerSMB/User.pm')
-rwxr-xr-xLedgerSMB/User.pm62
1 files changed, 32 insertions, 30 deletions
diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm
index bd40b3b7..0d918640 100755
--- a/LedgerSMB/User.pm
+++ b/LedgerSMB/User.pm
@@ -112,39 +112,41 @@ sub fetch_config {
my ($self, $login) = @_;
- if ($login ne "") {
-
- # 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);
-
- my $userHashRef = $fetchUserPrefs->fetchrow_hashref;
+ if (!$login){
+ &error($self, "Access Denied");
+ }
- while ( my ($key, $value) = each(%{$userHashRef}) ) {
- $myconfig{$key} = $value;
- }
+
+ # 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);
+
+ my $userHashRef = $fetchUserPrefs->fetchrow_hashref;
+
+ 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;
}