// 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.
ttUserHelper::insertBind(array(
'user_id' => $user_id,
'project_id' => $project_id,
- 'group_id' => $user->getGroup(),
- 'org_id' => $user->org_id,
'rate' => $rate,
'status' => ACTIVE));
}
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']);