Exemplo n.º 1
0
 /**
  * Returns an unsaved copy of the task. Copies everything except open/closed state,
  * anything that needs the task to have an id (like tags, properties, subtask),
  * administrative info like who created the task and when, etc.
  *
  * @param TemplateTask $task
  * @return TemplateTask
  */
 function createTaskCopy(TemplateTask $task)
 {
     $new = new TemplateTask();
     $new->setMilestoneId($task->getMilestoneId());
     $new->setParentId($task->getParentId());
     $new->setObjectName($task->getObjectName());
     $new->setAssignedToContactId($task->getAssignedToContactId());
     $new->setPriority($task->getPriority());
     $new->setTimeEstimate($task->getTimeEstimate());
     $new->setText($task->getText());
     $new->setOrder(TemplateTasks::maxOrder($new->getParentId(), $new->getMilestoneId()));
     $new->setStartDate($task->getStartDate());
     $new->setDueDate($task->getDueDate());
     return $new;
 }
 /**
  * Detach subtask from this task
  *
  * @param TemplateTask $task
  * @param TemplateTaskList $attach_to If you wish you can detach and attach task to
  *   other list with one save query
  * @return null
  */
 function detachTask(TemplateTask $task, $attach_to = null)
 {
     if ($task->getParentId() != $this->getId()) {
         return;
     }
     if ($attach_to instanceof TemplateTask) {
         $attach_to->attachTask($task);
     } else {
         $task->setParentId(0);
         $task->save();
     }
 }