diff options
author | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-11-28 20:47:56 +0000 |
---|---|---|
committer | tetragon <tetragon@4979c152-3d1c-0410-bac9-87ea11338e46> | 2006-11-28 20:47:56 +0000 |
commit | 049058a5fa8cf564c7fe686256b960aec36f4cfe (patch) | |
tree | 4536772ddcc9098ecd236dfedd40ae2492636a16 /LedgerSMB | |
parent | 72c5ed68eebe56378a17dec99dec9b76e050ac67 (diff) |
Resolve test/test2 in save_preferences. Error uses test's language
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@701 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-x | LedgerSMB/AM.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/LedgerSMB/AM.pm b/LedgerSMB/AM.pm index 95b2a075..b3e94bbb 100755 --- a/LedgerSMB/AM.pm +++ b/LedgerSMB/AM.pm @@ -1311,9 +1311,23 @@ sub save_preferences { # connect to database my $dbh = $form->{dbh}; + + # get username, is same as requested? my @queryargs; - # update name my $query = qq| + SELECT login + FROM employee + WHERE login = ?|; + @queryargs = ($form->{login}); + my $sth = $dbh->prepare($query); + $sth->execute(@queryargs) || $form->dberror($query); + my ($dbusername) = $sth->fetchrow_array; + $sth->finish; + + return 0 if ($dbusername ne $form->{login}); + + # update name + $query = qq| UPDATE employee SET name = ?, role = ? |