From 03eaef085d960aca5f6b8c97dc89c02fe215d06c Mon Sep 17 00:00:00 2001 From: einhverfr Date: Tue, 9 Oct 2007 22:08:18 +0000 Subject: User::fetch_config now works, and there are some other auth fixes here too git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1730 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/User.pm | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'LedgerSMB') diff --git a/LedgerSMB/User.pm b/LedgerSMB/User.pm index 0b295455..b5c5c757 100644 --- a/LedgerSMB/User.pm +++ b/LedgerSMB/User.pm @@ -174,24 +174,14 @@ sub fetch_config { &error( $self, "Access Denied" ); } - - # 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;" -# ); - - - return \%myconfig; + $query = qq| + SELECT * FROM user_preference + WHERE id = (SELECT id FROM users WHERE username = ?)|; + my $sth = $dbh->prepare($query); + $sth->execute($lsmb->{login}); + $myconfig = $sth->fetchrow_hashref(NAME_lc); + + return $myconfig; } -- cgit v1.2.3