コード例 #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;
 }
コード例 #2
0
 /**
  * Add subtask to this list
  *
  * @param string $text
  * @param Contact $assigned_to_user
  * @param Company $assigned_to_company
  * @return TemplateTask
  * @throws DAOValidationError
  */
 function addSubTask($text, $assigned_to = null)
 {
     $task = new TemplateTask();
     $task->setText($text);
     if ($assigned_to instanceof Contact) {
         $task->setAssignedToContactId($assigned_to->getId());
     }
     $this->attachTask($task);
     // this one will save task
     return $task;
 }