'status' => $this->currentElement['STATUS']));
}
if ($name == 'USER_PROJECT_BIND' && $this->canImport) {
- ttUserHelper::insertBind(
+/*
+ ttUserHelper::insertBind(
$this->userMap[$this->currentElement['USER_ID']],
$this->projectMap[$this->currentElement['PROJECT_ID']],
$this->currentElement['RATE'],
- $this->currentElement['STATUS']);
+ $this->currentElement['STATUS']);*/
+ ttUserHelper::insertBind2(array(
+ 'user_id' => $this->userMap[$this->currentElement['USER_ID']],
+ 'project_id' => $this->projectMap[$this->currentElement['PROJECT_ID']],
+ 'group_id' => $this->group_id,
+ 'org_id' => $this->org_id,
+ 'rate' => $this->currentElement['RATE'],
+ 'status' => $this->currentElement['STATUS']));
}
if ($name == 'CLIENT' && $this->canImport) {
$active_users = ttTeamHelper::getActiveUsers(array('getAllFields'=>true));
foreach ($active_users as $u) {
if(in_array($u['id'], $users)) {
- $sql = "insert into tt_user_project_binds (project_id, user_id, status, rate) values(
- $last_id, ".$u['id'].", 1, ".$u['rate'].")";
+ $sql = "insert into tt_user_project_binds (project_id, user_id, group_id, org_id, status, rate) values(
+ $last_id, ".$u['id'].", $group_id, $org_id, 1, ".$u['rate'].")";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
while ($row = $res->fetchRow()) {
$user_rate[$row['id']] = $row['rate'];
}
+ $group_id = $user->getActiveGroup();
+ $org_id = $user->org_id;
foreach ($users_to_add as $id) {
- $sql = "insert into tt_user_project_binds (user_id, project_id, rate, status) values($id, $project_id, ".$user_rate[$id].", 1)";
+ $sql = "insert into tt_user_project_binds (user_id, project_id, group_id, org_id, rate, status)".
+ " values($id, $project_id, $group_id, $org_id, ".$user_rate[$id].", 1)";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
else
$p['rate'] = str_replace(',', '.', $p['rate']);
- $sql = "insert into tt_user_project_binds (project_id, user_id, rate, status) values(".$p['id'].",".$last_id.",".$p['rate'].", 1)";
+ $sql = "insert into tt_user_project_binds (project_id, user_id, group_id, org_id, rate, status)".
+ " values(".$p['id'].", $last_id, $group_id, $org_id, ".$p['rate'].", 1)";
$affected = $mdb2->exec($sql);
}
}
// insertBind - inserts a user to project bind into tt_user_project_binds table.
static function insertBind($user_id, $project_id, $rate, $status) {
+ global $user;
+ $mdb2 = getConnection();
+
+ $group_id = $user->getActiveGroup();
+ $org_id = $user->org_id;
+ $sql = "insert into tt_user_project_binds (user_id, project_id, group_id, org_id, rate, status)".
+ " values($user_id, $project_id, $group_id, $org_id, ".$mdb2->quote($rate).", $status)";
+ $affected = $mdb2->exec($sql);
+ return (!is_a($affected, 'PEAR_Error'));
+ }
+
+ // insertBind2 - inserts a user to project bind into tt_user_project_binds table.
+ static function insertBind2($fields) {
+ global $user;
$mdb2 = getConnection();
- $sql = "insert into tt_user_project_binds (user_id, project_id, rate, status)
- values($user_id, $project_id, ".$mdb2->quote($rate).", $status)";
+ // This may be used during import. Use the following until we have import refactored.
+ $group_id = $fields['group_id'] ? (int) $fields['group_id'] : $user->getActiveGroup();
+ $org_id = $fields['org_id'] ? (int) $fields['org_id'] : $user->org_id;
+
+ $user_id = (int) $fields['user_id'];
+ $project_id = (int) $fields['project_id'];
+ $rate = $mdb2->quote($fields['rate']);
+ $status = $mdb2->quote($fields['status']);
+
+ $sql = "insert into tt_user_project_binds (user_id, project_id, group_id, org_id, rate, status)".
+ " values($user_id, $project_id, $group_id, $org_id, $rate, $status)";
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.12.4387 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.12.4388 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
'login' => $cl_login,
'password' => $cl_password1,
'rate' => $cl_rate,
- 'group_id' => $user->group_id, // TODO: this needs to be fixed for on-behalf group work.
+ 'group_id' => $user->getActiveGroup(),
'org_id' => $user->org_id,
'role_id' => $cl_role_id,
'client_id' => $cl_client_id,