From e76a988bbe14c43a1d1bfed1a0724d529a0908d2 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Fri, 3 Dec 2021 13:25:51 +0800 Subject: [PATCH] * Fix bug #17065. --- module/testcase/model.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/module/testcase/model.php b/module/testcase/model.php index d622bca03d..b6d0896748 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -231,10 +231,13 @@ class testcaseModel extends model */ public function getModuleCases($productID, $branch = 0, $moduleIdList = 0, $orderBy = 'id_desc', $pager = null, $browseType = '', $auto = 'no') { - return $this->dao->select('t1.*, t2.title as storyTitle')->from(TABLE_CASE)->alias('t1') - ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id') - ->where('t1.product')->eq((int)$productID) - ->beginIF($this->app->tab == 'project')->andWhere('t1.project')->eq($this->session->project)->fi() + $stmt = $this->dao->select('t1.*, t2.title as storyTitle')->from(TABLE_CASE)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id'); + + if($this->app->tab == 'project') $stmt = $stmt->leftJoin(TABLE_PROJECTCASE)->alias('t3')->on('t1.id=t3.case'); + + return $stmt ->where('t1.product')->eq((int)$productID) + ->beginIF($this->app->tab == 'project')->andWhere('t3.project')->eq($this->session->project)->fi() ->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi() ->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi() ->beginIF($browseType == 'wait')->andWhere('t1.status')->eq($browseType)->fi()