From 67f18ddd69296ce5295426419c25f3e59ee41fc6 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Thu, 7 Apr 2022 01:44:12 +0000 Subject: [PATCH 1/2] * Fix bug #20718. --- module/testcase/model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/testcase/model.php b/module/testcase/model.php index 43ba662f40..34854835ff 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -264,13 +264,16 @@ class testcaseModel extends model */ public function getModuleProjectCases($productID, $branch = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $browseType = '', $auto = 'no') { + $executions = $this->loadModel('execution')->getIdList($this->session->project); + array_push($executions, $this->session->project); + return $this->dao->select('distinct t1.*, t2.*, t4.title as storyTitle')->from(TABLE_PROJECTCASE)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id') ->leftJoin(TABLE_PROJECTSTORY)->alias('t3')->on('t3.story=t2.story') ->leftJoin(TABLE_STORY)->alias('t4')->on('t3.story=t4.id') ->where('1=1') ->beginIF(!empty($productID))->andWhere('t2.product')->eq((int)$productID)->fi() - ->beginIF($this->app->tab == 'project')->andWhere('t1.project')->eq($this->session->project)->fi() + ->beginIF($this->app->tab == 'project')->andWhere('t1.project')->in($executions)->fi() ->beginIF($branch !== 'all')->andWhere('t2.branch')->eq($branch)->fi() ->beginIF($moduleIdList)->andWhere('t2.module')->in($moduleIdList)->fi() ->beginIF($browseType == 'wait')->andWhere('t2.status')->eq($browseType)->fi() From 9400811baed270e3cceaec248baa56957cce10dc Mon Sep 17 00:00:00 2001 From: zhouxin Date: Thu, 7 Apr 2022 02:40:23 +0000 Subject: [PATCH 2/2] * Adjust code. --- module/testcase/model.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/testcase/model.php b/module/testcase/model.php index 34854835ff..0fea861510 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -271,9 +271,8 @@ class testcaseModel extends model ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id') ->leftJoin(TABLE_PROJECTSTORY)->alias('t3')->on('t3.story=t2.story') ->leftJoin(TABLE_STORY)->alias('t4')->on('t3.story=t4.id') - ->where('1=1') + ->where('t1.project')->in($executions) ->beginIF(!empty($productID))->andWhere('t2.product')->eq((int)$productID)->fi() - ->beginIF($this->app->tab == 'project')->andWhere('t1.project')->in($executions)->fi() ->beginIF($branch !== 'all')->andWhere('t2.branch')->eq($branch)->fi() ->beginIF($moduleIdList)->andWhere('t2.module')->in($moduleIdList)->fi() ->beginIF($browseType == 'wait')->andWhere('t2.status')->eq($browseType)->fi()