diff --git a/module/task/control.php b/module/task/control.php index 2019d920b1..2087ab5d96 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1289,8 +1289,10 @@ class task extends control if(!$this->session->taskWithChildren) { $children = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0) - ->andWhere('parent')->in(array_keys($tasks)) - ->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi() + ->andWhere('parent')->ne(0) + ->andWhere('parent', true)->in(array_keys($tasks)) + ->beginIF($this->post->exportType == 'selected')->orWhere('id')->in($this->cookie->checkedItem)->fi() + ->markRight(1) ->orderBy($sort) ->fetchGroup('parent', 'id'); if(!empty($children)) @@ -1324,8 +1326,13 @@ class task extends control { array_splice($tasks, $position, 0, $children[$task->id]); $position += count($children[$task->id]); + unset($children[$task->id]); } } + if($children) + { + foreach($children as $childTasks) $tasks += $childTasks; + } } }