Dutch translation improved.
[timetracker.git] / WEB-INF / lib / ttTeamHelper.class.php
index 5aeee21..2aff793 100644 (file)
@@ -108,6 +108,7 @@ class ttTeamHelper {
     global $user;
     $mdb2 = getConnection();
 
+    // Obtain role id for the user we are swapping ourselves with.
     $sql = "select u.id, u.role_id from tt_users u left join tt_roles r on (u.role_id = r.id) where u.id = $user_id and u.team_id = $user->team_id and u.status = 1 and r.rank < $user->rank";
     $res = $mdb2->query($sql);
     if (is_a($res, 'PEAR_Error'))
@@ -755,6 +756,7 @@ class ttTeamHelper {
   // The insert function creates a new team.
   static function insert($fields) {
 
+    global $user;
     $mdb2 = getConnection();
 
     // Start with team name and currency.
@@ -837,6 +839,9 @@ class ttTeamHelper {
       $values .= ', '.$mdb2->quote($fields['config']);
     }
 
+    $columns .= ', created, created_ip, created_by';
+    $values .= ', now(), '.$mdb2->quote($_SERVER['REMOTE_ADDR']).', '.$mdb2->quote($user->id);
+
     $sql = "insert into tt_teams ($columns) values($values)";
     $affected = $mdb2->exec($sql);