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

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



Revision: 386
          http://svn.sourceforge.net/ledger-smb/?rev=386&view=rev
Author:   jasonjayr
Date:     2006-10-29 21:48:15 -0800 (Sun, 29 Oct 2006)

Log Message:
-----------
 ..hidden..:  mystik | 2006-10-30 00:38:30 -0500
 Further refined the fix, when the if went into the first case, the SQL Statement didn't need all those bound values, and it emitted a warning when
 you did an update in the hr/save existing employee

Modified Paths:
--------------
    trunk/LedgerSMB/User.pm

Property Changed:
----------------
    trunk/


Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 601a1b1a-6c14-0410-aace-ab8e151093f6:/ledger-smb/yui:438
   + 601a1b1a-6c14-0410-aace-ab8e151093f6:/ledger-smb/yui:457

Modified: trunk/LedgerSMB/User.pm
===================================================================
--- trunk/LedgerSMB/User.pm	2006-10-30 05:47:22 UTC (rev 385)
+++ trunk/LedgerSMB/User.pm	2006-10-30 05:48:15 UTC (rev 386)
@@ -783,29 +783,33 @@
 		my ($id) = $sth->fetchrow_array;
 		$sth->finish;
 		my $employeenumber;
+		my @values;
 		if ($id) {
 
 			$query = qq|UPDATE employee SET
-			role = '$self->{role}',
-			email = '$self->{email}',
-			name = '$self->{name}'
-			WHERE login = '$login'|;
+			role = ?,
+			email = ?, 
+			name = ?
+			WHERE login = ?|;
 
+			@values = ($self->{role}, $self->{email}, $self->{name}, $login);
+
 		} else {
 
-			($employeenumber) = Form::update_defaults(
+			my ($employeenumber) = Form::update_defaults(
 				"", \%$self, "employeenumber", $dbh);
 			$query = qq|
 				INSERT INTO employee 
 				            (login, employeenumber, name, 
 				            workphone, role, email, sales)
 				    VALUES (?, ?, ?, ?, ?, ?, '1')|;
+			
+			@values = ($login, $employeenumber, $self->{name}, $self->{tel},
+			$self->{role}, $self->{email})
 		}
 
 		$sth = $dbh->prepare($query);
-		$sth->execute(
-			$login, $employeenumber, $self->{name}, $self->{tel},
-			$self->{role}, $self->{email});
+		$sth->execute(@values);
 		$dbh->commit;
 		$dbh->disconnect;
 


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