diff --git a/module/task/control.php b/module/task/control.php index 9f0ca0e730..616cb7c8b6 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -578,6 +578,23 @@ class task extends control $this->action->logHistory($actionID, $changes); $this->sendmail($taskID, $actionID); } + + /* Remind whether to update status of the bug, if task which from that bug has been finished. */ + $task = $this->task->getById($taskID); + if($task->fromBug != 0) + { + foreach($changes as $change) + { + if($change['field'] == 'status' and $change['new'] == 'done') + { + $confirmURL = $this->createLink('bug', 'view', "id=$task->fromBug"); + unset($_GET['onlybody']); + $cancelURL = $this->createLink('task', 'view', "taskID=$taskID"); + die(js::confirm(sprintf($this->lang->task->remindBug, $task->fromBug), $confirmURL, $cancelURL, 'parent', 'parent.parent')); + } + } + } + if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } @@ -601,7 +618,24 @@ class task extends control if(!empty($_POST)) { - $this->task->recordEstimate($taskID); + $changes = $this->task->recordEstimate($taskID); + + /* Remind whether to update status of the bug, if task which from that bug has been finished. */ + $task = $this->task->getById($taskID); + if($changes and $task->fromBug != 0) + { + foreach($changes as $change) + { + if($change['field'] == 'status' and $change['new'] == 'done') + { + $confirmURL = $this->createLink('bug', 'view', "id=$task->fromBug"); + unset($_GET['onlybody']); + $cancelURL = $this->createLink('task', 'view', "taskID=$taskID"); + die(js::confirm(sprintf($this->lang->task->remindBug, $task->fromBug), $confirmURL, $cancelURL, 'parent', 'parent.parent')); + } + } + } + if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } diff --git a/module/task/model.php b/module/task/model.php index 5129434f95..f17722aee8 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -615,9 +615,11 @@ class taskModel extends model $oldTask->status = $oldStatus; $newTask->status = $task->status; - $changes = common::createChanges($oldTask, $newTask); + $changes = common::createChanges($oldTask, $newTask); $this->action->logHistory($actionID, $changes); if($task->story) $this->loadModel('story')->setStage($task->story); + + return $changes; } /**