$tmpquery2 = "DELETE FROM " . $tableCollab["assignments"] . " WHERE subtask IN({$id})"; /* $tmpquery = "WHERE tas.id IN($id)"; $listTasks = new request(); $listTasks->openTasks($tmpquery); $comptListTasks = count($listTasks->tas_id); for ($i=0;$i<$comptListTasks;$i++) { if ($fileManagement == "true") { delDir("../files/".$listTasks->tas_project[$i]."/".$listTasks->tas_id[$i]); } } */ connectSql($tmpquery1); connectSql($tmpquery2); //recompute average completion of the task taskComputeCompletion($listSubtasks->subtas_task[0], $tableCollab["tasks"]); if ($task != "") { headerFunction("../tasks/viewtask.php?id={$task}&msg=delete&" . session_name() . "=" . session_id()); exit; } else { headerFunction("../general/home.php?msg=delete&" . session_name() . "=" . session_id()); exit; } } $tmpquery = "WHERE tas.id = '{$task}'"; $taskDetail = new request(); $taskDetail->openTasks($tmpquery); $project = $taskDetail->tas_project[0]; $tmpquery = "WHERE pro.id = '{$project}'"; $projectDetail = new request(); $projectDetail->openProjects($tmpquery);
if ($pub == "") { $pub = "1"; } //Insert task with our without parent phase $tmpquery1 = "INSERT INTO " . $tableCollab["subtasks"] . "(task,name,description,owner,assigned_to,status,priority,start_date,due_date,estimated_time,actual_time,comments,created,published,completion) VALUES('{$task}','{$tn}','{$d}','{$idSession}','{$at}','{$st}','{$pr}','{$sd}','{$dd}','{$etm}','{$atm}','{$c}','{$dateheure}','{$pub}','{$compl}')"; connectSql("{$tmpquery1}"); $tmpquery = $tableCollab["subtasks"]; last_id($tmpquery); $num = $lastId[0]; unset($lastId); if ($st == "1") { $tmpquery6 = "UPDATE " . $tableCollab["subtasks"] . " SET complete_date='{$date}' WHERE id = '{$num}'"; connectSql($tmpquery6); } //compute the average completion of all subtaks of this tasks taskComputeCompletion($task, $tableCollab["tasks"]); //if assigned_to not blank, set assigned date if ($at != "0") { $tmpquery6 = "UPDATE " . $tableCollab["subtasks"] . " SET assigned='{$dateheure}' WHERE id = '{$num}'"; connectSql($tmpquery6); } $tmpquery2 = "INSERT INTO " . $tableCollab["assignments"] . "(subtask,owner,assigned_to,assigned) VALUES('{$num}','{$idSession}','{$at}','{$dateheure}')"; connectSql($tmpquery2); //if assigned_to not blank, add to team members (only if doesn't already exist) //add assigned_to in team members (only if doesn't already exist) if ($at != "0") { $tmpquery = "WHERE tea.project = '{$project}' AND tea.member = '{$at}'"; $testinTeam = new request(); $testinTeam->openTeams($tmpquery); $comptTestinTeam = count($testinTeam->tea_id); if ($comptTestinTeam == "0") {