From 23518e36fd18a50f42546977f03131e422809fc7 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 28 Feb 2023 14:33:43 +0800 Subject: [PATCH] * Code for bug#32489. --- module/execution/model.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/module/execution/model.php b/module/execution/model.php index 52724ab8d2..a0314f5de2 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2931,14 +2931,17 @@ class executionModel extends model $this->loadModel('task'); $taskStories = array(); + $parents = array(); $execution = $this->getByID($executionID); - $tasks = $this->dao->select('id,execution,assignedTo,story,consumed,status')->from(TABLE_TASK)->where('id')->in($this->post->tasks)->fetchAll('id'); + $tasks = $this->dao->select('id,execution,assignedTo,story,consumed,status,parent')->from(TABLE_TASK)->where('id')->in($this->post->tasks)->fetchAll('id'); foreach($tasks as $task) { /* Save the assignedToes and stories, should linked to execution. */ $assignedToes[$task->assignedTo] = $task->execution; $taskStories[$task->story] = $task->story; + if($task->parent < 0) $parents[$task->id] = $task->id; + $data = new stdclass(); $data->project = $execution->project; $data->execution = $executionID; @@ -2958,6 +2961,10 @@ class executionModel extends model $this->loadModel('action')->create('task', $task->id, 'moved', '', $task->execution); } + /* Get stories of children task. */ + $childrens = $this->dao->select('*')->from(TABLE_TASK)->where('parent')->in($parents)->fetchAll('id'); + foreach($childrens as $children) $taskStories[$children->story] = $children->story; + /* Remove empty story. */ unset($taskStories[0]);