Close all subtasks when a task is closed
This commit is contained in:
@@ -227,6 +227,18 @@ class Subtask extends Base
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close all subtasks of a task
|
||||
*
|
||||
* @access public
|
||||
* @param integer $task_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function closeAll($task_id)
|
||||
{
|
||||
return $this->db->table(self::TABLE)->eq('task_id', $task_id)->update(array('status' => self::STATUS_DONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subtasks with consecutive positions
|
||||
*
|
||||
|
||||
@@ -62,6 +62,7 @@ class TaskStatus extends Base
|
||||
*/
|
||||
public function close($task_id)
|
||||
{
|
||||
$this->subtask->closeAll($task_id);
|
||||
return $this->changeStatus($task_id, Task::STATUS_CLOSED, time(), Task::EVENT_CLOSE);
|
||||
}
|
||||
|
||||
@@ -113,7 +114,7 @@ class TaskStatus extends Base
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the status of task
|
||||
* Check the status of a task
|
||||
*
|
||||
* @access private
|
||||
* @param integer $task_id Task id
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<div class="confirm">
|
||||
<p class="alert alert-info">
|
||||
<?= t('Do you really want to close this task: "%s"?', $this->e($task['title'])) ?>
|
||||
<?= t('Do you really want to close the task "%s" as well as all subtasks?', $this->e($task['title'])) ?>
|
||||
</p>
|
||||
|
||||
<div class="form-actions">
|
||||
|
||||
Reference in New Issue
Block a user