From 9c10a2a2f6c8d25769d1abecaaa49bd54f3bd8e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Mon, 18 Dec 2017 16:49:23 +0800 Subject: [PATCH] * Fix bug#1327 --- module/task/control.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 6efd176bda..b4d02d1461 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1217,8 +1217,6 @@ class task extends control } $task->progress .= '%'; - - if($task->parent) $task->name = '[' . $taskLang->childrenAB . '] ' . $task->name; } } else @@ -1236,10 +1234,25 @@ class task extends control foreach($tasks as $task) $relatedStoryIdList[$task->story] = $task->story; /* Get related objects title or names. */ - $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs(); + $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY)->where('id')->in($relatedStoryIdList)->fetchPairs(); $relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('task')->andWhere('objectID')->in(@array_keys($tasks))->andWhere('extra')->ne('editor')->fetchGroup('objectID'); $relatedModules = $this->loadModel('tree')->getTaskOptionMenu($projectID); + $children = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)->andWhere('parent')->in(array_keys($tasks))->fetchGroup('parent', 'id'); + if(!empty($children)) + { + $position = 0; + foreach($tasks as $task) + { + $position ++; + if(isset($children[$task->id])) + { + array_splice($tasks, $position, 0, $children[$task->id]); + $position += count($children[$task->id]); + } + } + } + foreach($tasks as $task) { if($this->post->fileType == 'csv') @@ -1266,6 +1279,8 @@ class task extends control if(isset($users[$task->closedBy])) $task->closedBy = $users[$task->closedBy]; if(isset($users[$task->lastEditedBy])) $task->lastEditedBy = $users[$task->lastEditedBy]; + if(!empty($task->parent)) $task->name = '[' . $taskLang->childrenAB . '] ' . $task->name; + $task->openedDate = substr($task->openedDate, 0, 10); $task->assignedDate = substr($task->assignedDate, 0, 10); $task->finishedDate = substr($task->finishedDate, 0, 10);