'status' => $this->currentElement['STATUS']));
}
if ($name == 'USER_PROJECT_BIND' && $this->canImport) {
-/*
- ttUserHelper::insertBind(
- $this->userMap[$this->currentElement['USER_ID']],
- $this->projectMap[$this->currentElement['PROJECT_ID']],
- $this->currentElement['RATE'],
- $this->currentElement['STATUS']);*/
- ttUserHelper::insertBind2(array(
+ ttUserHelper::insertBind(array(
'user_id' => $this->userMap[$this->currentElement['USER_ID']],
'project_id' => $this->projectMap[$this->currentElement['PROJECT_ID']],
'group_id' => $this->group_id,
if (is_a($affected, 'PEAR_Error')) die ($affected->getMessage());
} else {
// Record does not exist. Insert it.
- ttUserHelper::insertBind($user_id, $project_id, $rate, 1);
- }
+ ttUserHelper::insertBind(array(
+ 'user_id' => $user_id,
+ 'project_id' => $project_id,
+ 'group_id' => $user->getActiveGroup(),
+ 'org_id' => $user->org_id,
+ 'rate' => $rate,
+ 'status' => ACTIVE));
+ }
}
}
}
}
// 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) {
+ static function insertBind($fields) {
global $user;
$mdb2 = getConnection();
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <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> |
+ <td align="center"> Anuko Time Tracker 1.18.12.4389 | 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>
setChange("ALTER TABLE `tt_project_task_binds` ADD `group_id` int(11) default NULL AFTER `task_id`");
setChange("ALTER TABLE `tt_project_task_binds` ADD `org_id` int(11) default NULL AFTER `group_id`");
setChange("UPDATE `tt_site_config` SET param_value = '1.18.12', modified = now() where param_name = 'version_db' and param_value = '1.18.11'");
+ // TODO: this does not work as we just introduced group_id and it is NULL. Same for tt_project_task_binds. Improve.
+ // setChange("UPDATE `tt_user_project_binds` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.12') set org_id = group_id where org_id is null");
}
if ($_POST["cleanup"]) {