diff --git a/module/testcase/control.php b/module/testcase/control.php index babfa11f5a..b28fae1aaf 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -149,12 +149,15 @@ class testcase extends control $sort = common::appendOrder($orderBy); /* Get test cases. */ + $queryCondition = ''; + $cases = array(); $caseIdList = array(); if($browseType != 'onlyscene') { - $cases = $this->testcase->getTestCases($productID, $branch, $browseType, $browseType == 'bysearch' ? $queryID : $suiteID, $moduleID, $caseType, $sort, null); - $caseIdList = array_column($cases, 'id'); + $cases = $this->testcase->getTestCases($productID, $branch, $browseType, $browseType == 'bysearch' ? $queryID : $suiteID, $moduleID, $caseType, $sort, null); + $queryCondition = $this->dao->get(); + $caseIdList = array_column($cases, 'id'); } /* Get top level cases and scenes.*/ @@ -165,17 +168,19 @@ class testcase extends control if(count($productParam) > 1) unset($productParam[0]); } - $queryCondition = ''; - $topObjects = $this->testcase->getList($productParam, $branch, $moduleID, $caseIdList, $pager, 'top', array(), $browseType); + $topObjects = array(); + if(!$this->cookie->onlyAutoCase) + { + $topObjects = $this->testcase->getList($productParam, $branch, $moduleID, $caseIdList, $pager, 'top', array(), $browseType); + if(empty($topObjects) && $pageID > 1) + { + $pager = pager::init(0, $recPerPage, 1); + $topObjects = $this->testcase->getList($productParam, $branch, $moduleID, $caseIdList, $pager, 'top', array(), $browseType); + } + } /* Get children cases and scenes.*/ $scenes = $this->testcase->getList($productParam, $branch, $moduleID, $caseIdList, null, 'child', array_keys($topObjects), $browseType, $queryCondition); - if(empty($topObjects) and $pageID > 1) - { - $pager = pager::init(0, $recPerPage, 1); - $topObjects = $this->testcase->getList($productParam, $branch, $moduleID, $caseIdList, $pager, 'top', array(), $browseType); - $scenes = $this->testcase->getList($productParam, $branch, $moduleID, $caseIdList, null, 'child', array_keys($topObjects), $browseType, $queryCondition); - } /* save session .*/ $this->loadModel('common')->saveQueryCondition($queryCondition, 'testcase', false); diff --git a/module/testcase/model.php b/module/testcase/model.php index 99f5d1f790..6d9a1ea3fc 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -218,8 +218,8 @@ class testcaseModel extends model ->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi() ->beginIF($browseType == 'wait')->andWhere('t1.status')->eq($browseType)->fi() ->beginIF($auto == 'unit')->andWhere('t1.auto')->eq('unit')->fi() - ->beginIF($auto != 'unit')->andWhere('t1.auto')->ne('unit')->fi() - ->beginIF($this->cookie->onlyAutoCase)->andWhere('t1.auto')->eq('auto')->fi() + ->beginIF($auto == 'auto')->andWhere('t1.auto')->eq('auto')->fi() + ->beginIF($auto != 'unit' && $auto != 'auto')->andWhere('t1.auto')->notIn('unit, auto')->fi() ->beginIF($caseType)->andWhere('t1.type')->eq($caseType)->fi() ->andWhere('t1.deleted')->eq('0') ->orderBy($orderBy) @@ -256,8 +256,8 @@ class testcaseModel extends model ->beginIF($moduleIdList)->andWhere('t2.module')->in($moduleIdList)->fi() ->beginIF($browseType == 'wait')->andWhere('t2.status')->eq($browseType)->fi() ->beginIF($auto == 'unit')->andWhere('t2.auto')->eq('unit')->fi() - ->beginIF($auto != 'unit')->andWhere('t2.auto')->ne('unit')->fi() - ->beginIF($this->cookie->onlyAutoCase)->andWhere('t2.auto')->eq('auto')->fi() + ->beginIF($auto == 'auto')->andWhere('t2.auto')->eq('auto')->fi() + ->beginIF($auto != 'unit' && $auto != 'auto')->andWhere('t2.auto')->notIn('unit, auto')->fi() ->beginIF($caseType)->andWhere('t2.type')->eq($caseType)->fi() ->andWhere('t2.deleted')->eq('0') ->orderBy($orderBy) @@ -358,7 +358,8 @@ class testcaseModel extends model ->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi() ->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi() ->beginIF($auto == 'unit')->andWhere('t1.auto')->eq('unit')->fi() - ->beginIF($auto != 'unit')->andWhere('t1.auto')->ne('unit')->fi() + ->beginIF($auto == 'auto')->andWhere('t1.auto')->eq('auto')->fi() + ->beginIF($auto != 'unit' && $auto != 'auto')->andWhere('t1.auto')->notIn('unit, auto')->fi() ->andWhere('t1.deleted')->eq('0') ->orderBy($orderBy)->page($pager)->fetchAll('id'); } @@ -523,9 +524,9 @@ class testcaseModel extends model ->beginIF($this->app->tab == 'project')->andWhere('t3.project')->eq($this->session->project)->fi() ->beginIF($branch !== 'all' and !empty($productID))->andWhere('t1.branch')->eq($branch)->fi() ->beginIF($modules)->andWhere('t1.module')->in($modules)->fi() - ->beginIF($auto != 'unit')->andWhere('t1.auto')->ne('unit')->fi() ->beginIF($auto == 'unit')->andWhere('t1.auto')->eq('unit')->fi() - ->beginIF($this->cookie->onlyAutoCase)->andWhere('t1.auto')->eq('auto')->fi() + ->beginIF($auto == 'auto')->andWhere('t1.auto')->eq('auto')->fi() + ->beginIF($auto != 'unit' && $auto != 'auto')->andWhere('t1.auto')->notIn('unit, auto')->fi() ->beginIF($caseType)->andWhere('t1.type')->eq($caseType)->fi() ->orderBy($sort) ->page($pager, 't1.id') @@ -3302,8 +3303,9 @@ class testcaseModel extends model ->beginIF($this->app->tab == 'project')->andWhere('t2.project')->eq($this->session->project)->fi() ->beginIF($this->app->tab == 'project' and !empty($productID) and $queryProductID != 'all')->andWhere('t2.product')->eq($productID)->fi() ->beginIF($this->app->tab != 'project' and !empty($productID) and $queryProductID != 'all')->andWhere('t1.product')->eq($productID)->fi() - ->beginIF($auto != 'unit')->andWhere('t1.auto')->ne('unit')->fi() ->beginIF($auto == 'unit')->andWhere('t1.auto')->eq('unit')->fi() + ->beginIF($auto == 'auto')->andWhere('t1.auto')->eq('auto')->fi() + ->beginIF($auto != 'unit' && $auto != 'auto')->andWhere('t1.auto')->notIn('unit, auto')->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll('id'); @@ -3401,6 +3403,7 @@ class testcaseModel extends model $rawModule = $this->app->rawModule; return $this->dao->select('*')->from(VIEW_SCENECASE) ->where('deleted')->eq(0) + ->beginIF($this->cookie->onlyAutoCase)->andWhere('isCase')->eq(1)->fi() ->beginIF($browseType == 'onlyscene')->andWhere('isCase')->eq(2)->fi() ->beginIF($modules)->andWhere('module')->in($modules)->fi() ->beginIF($rawMethod == 'browse' and $type === 'top')->andWhere('parent')->eq(0)->andWhere('id')->in($objectIdList)->fi()