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

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



Revision: 701
          http://svn.sourceforge.net/ledger-smb/?rev=701&view=rev
Author:   tetragon
Date:     2006-11-28 12:47:56 -0800 (Tue, 28 Nov 2006)

Log Message:
-----------
Resolve test/test2 in save_preferences.  Error uses test's language

Modified Paths:
--------------
    branches/1.2/LedgerSMB/AM.pm
    branches/1.2/bin/am.pl

Modified: branches/1.2/LedgerSMB/AM.pm
===================================================================
--- branches/1.2/LedgerSMB/AM.pm	2006-11-28 20:44:18 UTC (rev 700)
+++ branches/1.2/LedgerSMB/AM.pm	2006-11-28 20:47:56 UTC (rev 701)
@@ -1311,9 +1311,23 @@
 
 	# connect to database
 	my $dbh = $form->{dbh};
+
+	# get username, is same as requested?
 	my @queryargs;
+	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
-	my $query = qq|
+	$query = qq|
 		UPDATE employee
 		   SET name = ?,
 		       role = ?

Modified: branches/1.2/bin/am.pl
===================================================================
--- branches/1.2/bin/am.pl	2006-11-28 20:44:18 UTC (rev 700)
+++ branches/1.2/bin/am.pl	2006-11-28 20:47:56 UTC (rev 701)
@@ -2235,7 +2235,7 @@
   }
 
   if (AM->save_preferences(\%myconfig, \%$form)) {
-    $form->redirect($locale->text('Preferences saved!'));
+    $form->info($locale->text('Preferences saved!'));
   } else {
     $form->error($locale->text('Cannot save preferences!'));
   }


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