diff --git a/module/testcase/config.php b/module/testcase/config.php index 26acbca266..283c36ac00 100644 --- a/module/testcase/config.php +++ b/module/testcase/config.php @@ -37,6 +37,7 @@ $config->testcase->excludeCheckFileds = ',pri,type,stage,needReview,story,branch global $lang; $config->testcase->search['module'] = 'testcase'; $config->testcase->search['fields']['title'] = $lang->testcase->title; +$config->testcase->search['fields']['story'] = $lang->testcase->linkStory; $config->testcase->search['fields']['id'] = $lang->testcase->id; $config->testcase->search['fields']['keywords'] = $lang->testcase->keywords; $config->testcase->search['fields']['lastEditedBy'] = $lang->testcase->lastEditedByAB; @@ -58,6 +59,7 @@ $config->testcase->search['fields']['openedDate'] = $lang->testcase->openedD $config->testcase->search['fields']['lastEditedDate'] = $lang->testcase->lastEditedDateAB; $config->testcase->search['params']['title'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); +$config->testcase->search['params']['story'] = array('operator' => 'include', 'control' => 'select', 'values' => ''); $config->testcase->search['params']['module'] = array('operator' => 'belong', 'control' => 'select', 'values' => 'modules'); $config->testcase->search['params']['keywords'] = array('operator' => 'include', 'control' => 'input', 'values' => ''); $config->testcase->search['params']['lastEditedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); diff --git a/module/testcase/lang/de.php b/module/testcase/lang/de.php index 1c865a72e3..ad64811882 100644 --- a/module/testcase/lang/de.php +++ b/module/testcase/lang/de.php @@ -13,6 +13,7 @@ $lang->testcase->id = 'ID'; $lang->testcase->product = $lang->productCommon; $lang->testcase->project = 'Project'; $lang->testcase->execution = 'Execution'; +$lang->testcase->linkStory = 'linkStory'; $lang->testcase->module = 'Module'; $lang->testcase->auto = 'Test Automation Cases'; $lang->testcase->frame = 'Test Automation Cramework'; diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php index b50993b46c..72e5991595 100644 --- a/module/testcase/lang/en.php +++ b/module/testcase/lang/en.php @@ -13,6 +13,7 @@ $lang->testcase->id = 'ID'; $lang->testcase->product = $lang->productCommon; $lang->testcase->project = 'Project'; $lang->testcase->execution = 'Execution'; +$lang->testcase->linkStory = 'linkStory'; $lang->testcase->module = 'Module'; $lang->testcase->auto = 'Test Automation Cases'; $lang->testcase->frame = 'Test Automation Cramework'; diff --git a/module/testcase/lang/fr.php b/module/testcase/lang/fr.php index da07973081..670943aee9 100644 --- a/module/testcase/lang/fr.php +++ b/module/testcase/lang/fr.php @@ -13,6 +13,7 @@ $lang->testcase->id = 'ID'; $lang->testcase->product = $lang->productCommon; $lang->testcase->project = 'Project'; $lang->testcase->execution = 'Execution'; +$lang->testcase->linkStory = 'linkStory'; $lang->testcase->module = 'Module'; $lang->testcase->auto = 'Test Automation Cases'; $lang->testcase->frame = 'Test Automation Cramework'; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 835cedb468..956d9281f3 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -13,6 +13,7 @@ $lang->testcase->id = '用例编号'; $lang->testcase->product = "所属{$lang->productCommon}"; $lang->testcase->project = '所属项目'; $lang->testcase->execution = '所属执行'; +$lang->testcase->linkStory = '关联需求'; $lang->testcase->module = '所属模块'; $lang->testcase->auto = '自动化测试用例'; $lang->testcase->frame = '自动化测试框架'; diff --git a/module/testtask/control.php b/module/testtask/control.php index d12e5cae63..7995699047 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -1059,6 +1059,11 @@ class testtask extends control * Link cases to a test task. * * @param int $taskID + * @param string $type + * @param int $param + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID * @access public * @return void */ @@ -1107,7 +1112,17 @@ class testtask extends control $this->config->testcase->search['actionURL'] = inlink('linkcase', "taskID=$taskID&type=$type¶m=$param"); $this->config->testcase->search['style'] = 'simple'; + $build = $this->loadModel('build')->getByID($task->build); + $stories = array(); + if($build) + { + $stories = $this->dao->select('id,title')->from(TABLE_STORY)->where('id')->in($build->stories)->fetchPairs(); + $this->config->testcase->search['params']['story']['values'] = $stories; + $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story'); + } + if($product->shadow) unset($this->config->testcase->search['fields']['product']); + if($type != 'bystory') unset($this->config->testcase->search['fields']['story']); if($task->productType == 'normal') { unset($this->config->testcase->search['fields']['branch']); diff --git a/module/testtask/model.php b/module/testtask/model.php index 11c07e5f8e..9042218934 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -399,18 +399,20 @@ class testtaskModel extends model { $stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('stories'); $cases = array(); + $query = preg_replace('/`(\w+)`/', 't1.`$1`', $query); if($stories) { - $cases = $this->dao->select('*')->from(TABLE_CASE) + $cases = $this->dao->select('t1.*,t2.title as storyTitle')->from(TABLE_CASE)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where($query) - ->beginIF($this->lang->navGroup->testtask != 'qa')->andWhere('project')->eq($this->session->project)->fi() - ->andWhere('product')->eq($productID) - ->andWhere('status')->ne('wait') - ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi() - ->beginIF($task->branch !== '')->andWhere('branch')->in("0,$task->branch")->fi() - ->andWhere('story')->in(trim($stories, ',')) - ->andWhere('deleted')->eq(0) - ->orderBy('id desc') + ->beginIF($this->lang->navGroup->testtask != 'qa')->andWhere('t1.project')->eq($this->session->project)->fi() + ->andWhere('t1.product')->eq($productID) + ->andWhere('t1.status')->ne('wait') + ->beginIF($linkedCases)->andWhere('t1.id')->notIN($linkedCases)->fi() + ->beginIF($task->branch !== '')->andWhere('t1.branch')->in("0,$task->branch")->fi() + ->andWhere('t1.story')->in(trim($stories, ',')) + ->andWhere('t1.deleted')->eq(0) + ->orderBy('t1.id desc') ->page($pager) ->fetchAll(); } @@ -1500,7 +1502,7 @@ class testtaskModel extends model $failHtml = ': ' . $this->lang->testtask->fail . ''; $passHtml = ': ' . $this->lang->testtask->pass . ''; - + $log = preg_replace(array("/:\x20失败/", "/:\x20fail/", "/:\x20成功/", "/:\x20pass/"), array($failHtml, $failHtml, $passHtml, $passHtml), $log); $logHtml .= "