X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttUserHelper.class.php;h=0d628f6d080b65b5b6db089f91114fe819145e26;hb=005295b05a6f3418db5dc3fb79fe73e2c7d01d2f;hp=2ff774ff5d29325aec9f597fd4f9a062bc354d1d;hpb=f613bf4ab8b4c818c9381d4e5e1af5fe5d0a6052;p=timetracker.git diff --git a/WEB-INF/lib/ttUserHelper.class.php b/WEB-INF/lib/ttUserHelper.class.php index 2ff774ff..0d628f6d 100644 --- a/WEB-INF/lib/ttUserHelper.class.php +++ b/WEB-INF/lib/ttUserHelper.class.php @@ -120,11 +120,7 @@ class ttUserHelper { // Now deal with project assignment. if (!is_a($affected, 'PEAR_Error')) { - $sql = "SELECT LAST_INSERT_ID() AS last_id"; - $res = $mdb2->query($sql); - $val = $res->fetchRow(); - $last_id = $val['last_id']; - + $last_id = $mdb2->lastInsertID('tt_users', 'id'); $projects = isset($fields['projects']) ? $fields['projects'] : array(); if (count($projects) > 0) { // We have at least one project assigned. Insert corresponding entries in tt_user_project_binds table. @@ -193,7 +189,7 @@ class ttUserHelper { // otherwise de-activate the bind (set its status to inactive). This will keep the bind // and its rate in database for reporting. - $all_projects = ttTeamHelper::getAllProjects($user->group_id); + $all_projects = ttTeamHelper::getAllProjects($user->getGroup()); $assigned_projects = isset($fields['projects']) ? $fields['projects'] : array(); foreach($all_projects as $p) { @@ -232,8 +228,6 @@ class ttUserHelper { ttUserHelper::insertBind(array( 'user_id' => $user_id, 'project_id' => $project_id, - 'group_id' => $user->getGroup(), - 'org_id' => $user->org_id, 'rate' => $rate, 'status' => ACTIVE)); } @@ -319,10 +313,8 @@ class ttUserHelper { global $user; $mdb2 = getConnection(); - // This may be used during import. Use the following until we have import refactored. - $group_id = $fields['group_id'] ? (int) $fields['group_id'] : $user->getGroup(); - $org_id = $fields['org_id'] ? (int) $fields['org_id'] : $user->org_id; - + $group_id = $user->getGroup(); + $org_id = $user->org_id; $user_id = (int) $fields['user_id']; $project_id = (int) $fields['project_id']; $rate = $mdb2->quote($fields['rate']);