$comment = w2PgetParam($_POST, 'email_comment', ''); $new_task_project = (int) w2PgetParam($_POST, 'new_task_project', 0); // Find the task if we are set $task_end_date = null; $obj = new CTask(); if ($task_id) { $obj->load($task_id); $task_end_date = new w2p_Utilities_Date($obj->task_end_date); } if (!$obj->bind($_POST)) { $AppUI->setMsg($obj->getError(), UI_MSG_ERROR); $AppUI->redirect('m=task&a=addedit'); } // Check to see if the task_project has changed if ($new_task_project != 0 and $obj->task_project != $new_task_project) { $obj->moveTaskBetweenProjects($task_id, $obj->task_project, $new_task_project); /** * We have to bail out for a redirect here or otherwise the store() below * will screw things up and assign the root task specified back to the * original project. */ $AppUI->redirect('m=projects&a=view&project_id=' . $new_task_project); } // Map task_dynamic checkboxes to task_dynamic values for task dependencies. if ($obj->task_dynamic != 1) { $task_dynamic_delay = w2PgetParam($_POST, 'task_dynamic_nodelay', '0'); if (in_array($obj->task_dynamic, CTask::$tracking_dynamics)) { $obj->task_dynamic = $task_dynamic_delay ? 21 : 31; } else { $obj->task_dynamic = $task_dynamic_delay ? 11 : 0; }
//Action: Modify Duration if (isset($_POST['bulk_task_duration']) && $bulk_task_duration != '' && is_numeric($bulk_task_duration)) { if ($upd_task->task_id) { $upd_task->task_duration = $bulk_task_duration; //set duration type to hours (1) $upd_task->task_duration_type = $bulk_task_durntype ? $bulk_task_durntype : 1; $result = $upd_task->store(); if (!$result) { break; } } } //Action: Move to Project if (isset($_POST['bulk_task_project']) && $bulk_task_project != '' && $bulk_task_project) { if ($upd_task->task_id) { $upd_task->moveTaskBetweenProjects($upd_task->task_id, $upd_task->task_project, $bulk_task_project); } } //Action: Change parent if ($bulk_task_parent) { $new_parent = -1 == $bulk_task_parent ? $upd_task->task_id : $bulk_task_parent; $upd_task->task_parent = $new_parent; $result = $upd_task->store(); } //Action: Change dependency if (isset($_POST['bulk_task_dependency']) && $bulk_task_dependency != '') { if ($upd_task->task_id) { //If parent is self task if ($bulk_task_dependency == '0') { $upd_task->task_dynamic = 0; $upd_task->store();