* finish task #3664.
This commit is contained in:
@@ -1084,6 +1084,7 @@ class task extends control
|
||||
{
|
||||
$story = $this->dao->select('story')->from(TABLE_TASK)->where('id')->eq($taskID)->fetch('story');
|
||||
$this->task->delete(TABLE_TASK, $taskID);
|
||||
$this->task->updateParentStatus($task->parent, 'done');
|
||||
$this->task->computeWorkingHours($task->parent);
|
||||
if($task->fromBug != 0) $this->dao->update(TABLE_BUG)->set('toTask')->eq(0)->where('id')->eq($task->fromBug)->exec();
|
||||
if($story) $this->loadModel('story')->setStage($story);
|
||||
|
||||
@@ -296,12 +296,16 @@ class taskModel extends model
|
||||
public function updateParentStatus($parentID, $status = 'done')
|
||||
{
|
||||
if(!$parentID) return true;
|
||||
$children = $this->dao->select('id,status')->from(TABLE_TASK)->where('parent')->eq($parentID)->fetchPairs('id', 'status');
|
||||
$values = array_values(array_unique($children));
|
||||
if((count($values) == 1 && $values[0] == $status) || (count($values) == 2 && in_array('closed', $values) && $status == 'done'))
|
||||
$children = $this->dao->select('id,status')->from(TABLE_TASK)->where('parent')->eq($parentID)->andWhere('deleted')->eq(0)->fetchPairs('id', 'status');
|
||||
|
||||
$changeStatus = true;
|
||||
foreach($children as $taskStatus)
|
||||
{
|
||||
$this->dao->update(TABLE_TASK)->set('status')->eq($status)->where('id')->eq($parentID)->exec();
|
||||
if($status == 'done' and $taskStatus != $status and $taskStatus != 'closed' and $taskStatus != 'cancel') $changeStatus = false;
|
||||
if($status != 'done' and $taskStatus != $status) $changeStatus = false;
|
||||
|
||||
}
|
||||
if($changeStatus) $this->dao->update(TABLE_TASK)->set('status')->eq($status)->where('id')->eq($parentID)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
common::printIcon('task', 'edit', "taskID=$task->id", $task);
|
||||
common::printCommentIcon('task', $task);
|
||||
common::printIcon('task', 'create', "productID=0&storyID=0&moduleID=0&taskID=$task->id", $task, 'button', 'copy');
|
||||
common::printIcon('task', 'delete', "projectID=$task->project&taskID=$task->id", $task);
|
||||
common::printIcon('task', 'delete', "projectID=$task->project&taskID=$task->id", $task, 'button', '', 'hiddenwin');
|
||||
echo '</div>';
|
||||
|
||||
echo "<div class='btn-group'>";
|
||||
|
||||
Reference in New Issue
Block a user