* Fix menu bug: testcase to project.

This commit is contained in:
zhujinyong
2021-03-25 09:02:57 +08:00
parent 3063a692c3
commit 26091d2bed
2 changed files with 13 additions and 8 deletions
+12 -7
View File
@@ -39,6 +39,7 @@ class testcase extends control
$this->loadModel('product');
$this->loadModel('tree');
$this->loadModel('user');
$this->loadModel('qa');
$this->view->products = $this->products = $this->product->getPairs();
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testcase")));
@@ -79,10 +80,7 @@ class testcase extends control
/* Set browseType, productID, moduleID and queryID. */
$productID = $this->app->openApp != 'project' ? $this->product->saveState($productID, $this->products) : $productID;
$branch = ($branch === '') ? (int)$this->cookie->preBranch : (int)$branch;
setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', false, true);
if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch)
setcookie('preProductID', $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true); setcookie('preBranch', (int)$branch, $this->config->cookieLife, $this->config->webRoot, '', false, true); if($this->cookie->preProductID != $productID or $this->cookie->preBranch != $branch)
{
$_COOKIE['caseModule'] = 0;
setcookie('caseModule', 0, 0, $this->config->webRoot, '', false, false);
@@ -96,8 +94,16 @@ 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;
$this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($projectID) : $this->testcase->setMenu($this->products, $productID, $branch, $moduleID, $suiteID, $orderBy);
if($this->app->openApp == 'project')
{
$this->products = array('0' => $this->lang->product->all) + $this->products;
$this->loadModel('project')->setMenu($projectID);
}
else
{
$this->qa->setMenu($this->products, $productID, $branch);
}
$this->session->set('caseList', $this->app->getURI(true), 'qa');
$this->session->set('productID', $productID);
$this->session->set('moduleID', $moduleID);
@@ -197,7 +203,6 @@ class testcase extends control
$this->lang->modulePageNav = $this->product->select($products, $productID, 'testcase', 'groupCase', '', $branch);
}
$this->session->set('caseList', $this->app->getURI(true), 'qa');
$cases = $this->testcase->getModuleCases($productID, $branch, 0, $groupBy);
+1 -1
View File
@@ -224,7 +224,7 @@ class testcaseModel extends model
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->openApp = 'project')->andWhere('t1.project')->eq($this->session->project)->fi()
->beginIF($this->app->openApp == 'project')->andWhere('t1.project')->eq($this->session->project)->fi()
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi()
->beginIF($browseType == 'wait')->andWhere('t1.status')->eq($browseType)->fi()