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

SF.net SVN: ledger-smb: [700] trunk



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

Log Message:
-----------
Remove test/test2 from save_preferences.  Error uses test's language

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

Modified: trunk/LedgerSMB/AM.pm
===================================================================
--- trunk/LedgerSMB/AM.pm	2006-11-28 01:21:21 UTC (rev 699)
+++ trunk/LedgerSMB/AM.pm	2006-11-28 20:44:18 UTC (rev 700)
@@ -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: trunk/bin/am.pl
===================================================================
--- trunk/bin/am.pl	2006-11-28 01:21:21 UTC (rev 699)
+++ trunk/bin/am.pl	2006-11-28 20:44:18 UTC (rev 700)
@@ -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.