diff --git a/module/task/control.php b/module/task/control.php index 64eb1c5159..8b2b33a885 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1151,9 +1151,18 @@ class task extends control } /* Get tasks. */ - $tasks = $this->dao->select('*')->from(TABLE_TASK)->alias('t1')->where($this->session->taskQueryCondition) - ->beginIF($this->post->exportType == 'selected')->andWhere('t1.id')->in($this->cookie->checkedItem)->fi() - ->orderBy($orderBy)->fetchAll('id'); + $tasks = array(); + if($this->session->taskOnlyCondition) + { + $tasks = $this->dao->select('*')->from(TABLE_TASK)->alias('t1')->where($this->session->taskQueryCondition) + ->beginIF($this->post->exportType == 'selected')->andWhere('t1.id')->in($this->cookie->checkedItem)->fi() + ->orderBy($orderBy)->fetchAll('id'); + } + else + { + $stmt = $this->dbh->query($this->session->taskQueryCondition . ($this->post->exportType == 'selected' ? " AND t1.id IN({$this->cookie->checkedItem})" : '') . " ORDER BY " . strtr($orderBy, '_', ' ')); + while($row = $stmt->fetch()) $tasks[$row->id] = $row; + } /* Get users and projects. */ $users = $this->loadModel('user')->getPairs('noletter');