diff --git a/module/testtask/control.php b/module/testtask/control.php index 1461b904c9..6164760290 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -655,7 +655,7 @@ class testtask extends control $this->view->position[] = $this->lang->testtask->common; $this->view->position[] = $this->lang->testtask->linkCase; - $testTask = $this->testtask->getRelatedTestTasks($productID,$taskID); + $testTask = $this->testtask->getRelatedTestTasks($productID, $param); /* Get cases. */ $cases = $this->testtask->getLinkableCases($productID, $task, $taskID, $type, $param, $pager); diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php index c4271ac95c..5e4127b86f 100644 --- a/module/testtask/lang/zh-cn.php +++ b/module/testtask/lang/zh-cn.php @@ -74,7 +74,7 @@ $lang->testtask->priList[2] = '2'; $lang->testtask->priList[4] = '4'; $lang->testtask->unlinkedCases = '未关联'; -$lang->testtask->linkByVersion = '按版本关联'; +$lang->testtask->linkByVersion = '按版本复制'; $lang->testtask->linkByStory = '按需求关联'; $lang->testtask->linkByBug = '按Bug关联'; $lang->testtask->linkBySuite = '按套件关联'; diff --git a/module/testtask/model.php b/module/testtask/model.php index f2bdf5aac0..bb01874172 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -322,16 +322,16 @@ class testtaskModel extends model * Get linkeable cases by test task. * * @param string $testTask + * @param array $linkedCases * @param object $pager * @access public * @return array */ public function getLinkableCasesByTestTask($testTask, $linkedCases, $pager) { - $runList = $this->dao->select("`case`")->from(TABLE_TESTRUN)->where('task')->eq($testTask)->andWhere('id')->notIN($linkedCases)->fetchPairs('case'); + $caseList = $this->dao->select("`case`")->from(TABLE_TESTRUN)->where('task')->eq($testTask)->andWhere('id')->notin($linkedCases)->fetchPairs('case'); - $caseList = $this->dao->select("*")->from(TABLE_CASE)->where('id')->in($runList)->page($pager)->fetchAll(); - return $caseList; + return $this->dao->select("*")->from(TABLE_CASE)->where('id')->in($caseList)->page($pager)->fetchAll(); } /** @@ -342,9 +342,17 @@ class testtaskModel extends model * @access public * @return array */ - public function getRelatedTestTasks($productID,$taskID) + public function getRelatedTestTasks($productID, $testTaskID) { - return $this->dao->select('id, name')->from(TABLE_TESTTASK)->where("product = '$productID'")->orderBy('id desc')->fetchPairs('id', 'name'); + $beginDate = $this->dao->select('begin')->from(TABLE_TESTTASK)->where('id')->eq($testTaskID)->fetch('begin'); + + return $this->dao->select('id, name')->from(TABLE_TESTTASK) + ->where('product')->eq($productID) + ->beginIF($beginDate)->andWhere('begin')->le($beginDate)->fi() + ->andWhere('deleted')->eq('0') + ->andWhere('id')->notin($testTaskID) + ->orderBy('begin desc') + ->fetchPairs('id', 'name'); } /** @@ -719,7 +727,7 @@ class testtaskModel extends model { $runs = $this->dao->select('id, `case`')->from(TABLE_TESTRUN) ->where('`case`')->in($caseIdList) - ->beginIF($taskID)->andWhere('task')->eq($taskID) + ->beginIF($taskID)->andWhere('task')->eq($taskID)->fi() ->fetchPairs('case', 'id'); } diff --git a/module/testtask/view/browse.html.php b/module/testtask/view/browse.html.php index 9a87a79e5a..1fcc72fa00 100644 --- a/module/testtask/view/browse.html.php +++ b/module/testtask/view/browse.html.php @@ -15,7 +15,7 @@