diff --git a/module/story/model.php b/module/story/model.php index d052e6d83e..e7094c4395 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -82,6 +82,19 @@ class storyModel extends model ->fetchAll('id'); } + /** + * Get test stories. + * + * @param array $storyIdList + * @param int $projectID + * @access public + * @return array + */ + public function getTestStories($storyIdList, $projectID) + { + return $this->dao->select('story')->from(TABLE_TASK)->where('project')->eq($projectID)->andWhere('type')->eq('test')->andWhere('story')->in($storyIdList)->fetchPairs('story', 'story'); + } + /** * Get story specs. * diff --git a/module/task/control.php b/module/task/control.php index 3c0d0e2030..ba06534941 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -172,9 +172,6 @@ class task extends control $members = $this->project->getTeamMemberPairs($projectID, 'nodeleted'); $moduleOptionMenu = $this->tree->getTaskOptionMenu($projectID); - /* Get no test stories. */ - $testStoryIdList = $this->dao->select('story')->from(TABLE_TASK)->where('project')->eq($projectID)->andWhere('story')->in(array_keys($stories))->fetchPairs('story', 'story'); - $title = $project->name . $this->lang->colon . $this->lang->task->create; $position[] = html::a($taskLink, $project->name); $position[] = $this->lang->task->common; @@ -194,7 +191,7 @@ class task extends control $this->view->task = $task; $this->view->users = $users; $this->view->stories = $stories; - $this->view->testStoryIdList = $testStoryIdList; + $this->view->testStoryIdList = $this->loadModel('story')->getTestStories(array_keys($stories), $project->id); $this->view->members = $members; $this->view->moduleOptionMenu = $moduleOptionMenu; $this->display(); diff --git a/module/testtask/model.php b/module/testtask/model.php index 9cf83de325..a277c34966 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -438,6 +438,7 @@ class testtaskModel extends model */ public function getLinkableCasesBySuite($productID, $task, $query, $suite, $linkedCases, $pager) { + if(strpos($query, '`product`') !== false) $query = str_replace('`product`', 't1.`product`', $query); return $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1') ->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case') ->where($query)