// Do a query with inner join to get assigned projects.
$sql = "select p.id, p.name, p.tasks, upb.rate from tt_projects p".
" inner join tt_user_project_binds upb on (upb.user_id = $user_id and upb.project_id = p.id and upb.status = 1)".
// Do a query with inner join to get assigned projects.
$sql = "select p.id, p.name, p.tasks, upb.rate from tt_projects p".
" inner join tt_user_project_binds upb on (upb.user_id = $user_id and upb.project_id = p.id and upb.status = 1)".
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$sql = "select p.id, upb.rate from tt_projects p".
" inner join tt_user_project_binds upb on (upb.user_id = $user_id and upb.project_id = p.id)".
$sql = "select p.id, upb.rate from tt_projects p".
" inner join tt_user_project_binds upb on (upb.user_id = $user_id and upb.project_id = p.id)".
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$sql = "select p.id, p.name, p.tasks from tt_projects p".
" inner join tt_client_project_binds cpb on (cpb.client_id = $user->client_id and cpb.project_id = p.id)".
$sql = "select p.id, p.name, p.tasks from tt_projects p".
" inner join tt_client_project_binds cpb on (cpb.client_id = $user->client_id and cpb.project_id = p.id)".
$mdb2 = getConnection();
$sql = "select id, name, description, status, tasks from tt_projects where id = $id and group_id = ".
$mdb2 = getConnection();
$sql = "select id, name, description, status, tasks from tt_projects where id = $id and group_id = ".
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
" and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
" and (status = 1 or status = 0)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
-
- $last_id = 0;
- $sql = "select last_insert_id() as last_insert_id";
- $res = $mdb2->query($sql);
- $val = $res->fetchRow();
- $last_id = $val['last_insert_id'];
+
+ $last_id = $mdb2->lastInsertID('tt_projects', 'id');
// Bind the project to users.
$active_users = ttTeamHelper::getActiveUsers(array('getAllFields'=>true));
// Bind the project to users.
$active_users = ttTeamHelper::getActiveUsers(array('getAllFields'=>true));
// Update project name, description, tasks and status in tt_projects table.
$comma_separated = implode(",", $tasks_to_bind); // This is a comma-separated list of associated task ids.
$sql = "update tt_projects set name = ".$mdb2->quote($name).", description = ".$mdb2->quote($description).
// Update project name, description, tasks and status in tt_projects table.
$comma_separated = implode(",", $tasks_to_bind); // This is a comma-separated list of associated task ids.
$sql = "update tt_projects set name = ".$mdb2->quote($name).", description = ".$mdb2->quote($description).
- ", tasks = ".$mdb2->quote($comma_separated).", status = $status where id = $project_id and group_id = ".$user->getActiveGroup();
+ ", tasks = ".$mdb2->quote($comma_separated).", status = $status where id = $project_id and group_id = ".$user->getGroup();
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}