From c9e522fd7d19cded6bdf3027fe2797a230aed7ab Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Thu, 25 Mar 2021 09:33:23 +0800 Subject: [PATCH] * Fix bug #11531, #11530. --- module/testcase/control.php | 7 +++++-- module/testcase/model.php | 9 +++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/module/testcase/control.php b/module/testcase/control.php index 127b20b535..ca50fafec4 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -96,7 +96,7 @@ class testcase extends control $queryID = ($browseType == 'bysearch') ? (int)$param : 0; /* Set menu, save session. */ - if($this->app->openApp == 'project') $this->products = array('0' => $this->lang->product->all) + $this->products; + if($this->app->openApp == 'project') $this->products = array('0' => $this->lang->product->all) + $this->loadModel('project')->getProducts($this->session->project, false); $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($projectID) : $this->testcase->setMenu($this->products, $productID, $branch, $moduleID, $suiteID, $orderBy); $this->session->set('caseList', $this->app->getURI(true), 'qa'); $this->session->set('productID', $productID); @@ -128,7 +128,10 @@ class testcase extends control $cases = $this->testcase->appendData($cases); /* Build the search form. */ - $actionURL = $this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); + $currentModule = $this->app->openApp == 'project' ? 'project' : 'testcase'; + $currentMethod = $this->app->openApp == 'project' ? 'testcase' : 'browse'; + $projectParam = $this->app->openApp == 'project' ? "projectID={$this->session->project}&" : ''; + $actionURL = $this->createLink($currentModule, $currentMethod, $projectParam . "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); $this->config->testcase->search['onMenuBar'] = 'yes'; $this->testcase->buildSearchForm($productID, $this->products, $queryID, $actionURL); diff --git a/module/testcase/model.php b/module/testcase/model.php index b7bc886d63..93bbf914b5 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -502,8 +502,13 @@ class testcaseModel extends model if(strpos($caseQuery, $allBranch) !== false) $caseQuery = str_replace($allBranch, '1', $caseQuery); $caseQuery .= ')'; - $cases = $this->dao->select('*')->from(TABLE_CASE)->where($caseQuery) - ->beginIF($queryProductID != 'all')->andWhere('product')->eq($productID)->fi() + if($this->app->openApp == 'project') $caseQuery = str_replace('`product`', 't2.`product`', $caseQuery); + $cases = $this->dao->select('*')->from(TABLE_CASE) + ->beginIF($this->app->openApp == 'project')->alias('t1')->fi() + ->beginIF($this->app->openApp == 'project')->leftJoin(TABLE_PROJECTCASE)->alias('t2')->on('t1.id=t2.case')->fi() + ->where($caseQuery) + ->beginIF($this->app->openApp == 'project')->andWhere('t2.project')->eq($this->session->project)->fi() + ->beginIF(!empty($productID) and $queryProductID != 'all')->andWhere('product')->eq($productID)->fi() ->beginIF($auto != 'unit')->andWhere('auto')->ne('unit')->fi() ->beginIF($auto == 'unit')->andWhere('auto')->eq('unit')->fi() ->andWhere('deleted')->eq(0)