* Fix bug #42525, fixed related bugs.

This commit is contained in:
wangxuepeng
2023-12-27 17:12:07 +08:00
parent a74eac0729
commit 6802dcbe05
4 changed files with 33 additions and 5 deletions
+1
View File
@@ -221,6 +221,7 @@ class bugZen extends bug
/* 如果是多分支产品时,设置分支的 cookie。*/
/* Set branch cookie if product is multi-branch. */
helper::setcookie('preBranch', $branch);
$this->session->set('branch', $branch, 'qa');
return $branch;
}
+1 -1
View File
@@ -93,7 +93,7 @@ class testcase extends control
/* 把访问的产品ID等状态信息保存到session和cookie中。*/
/* Save the product id user last visited to session and cookie. */
$productID = $this->app->tab != 'project' ? $this->product->checkAccess($productID, $this->products) : $productID;
$branch = $this->cookie->preBranch && $this->cookie->preBranch !== '' && $branch === '' ? $this->cookie->preBranch : $branch;
$branch = ($this->cookie->preBranch || $this->cookie->preBranch === '0') && $this->cookie->preBranch !== '' && $branch === '' ? $this->cookie->preBranch : $branch;
$browseType = strtolower($browseType);
$moduleID = $browseType == 'bymodule' ? $param : 0;
$suiteID = $browseType == 'bysuite' ? $param : ($browseType == 'bymodule' ? ($this->cookie->caseSuite ? $this->cookie->caseSuite : 0) : 0);
+8 -4
View File
@@ -89,9 +89,6 @@ class testtask extends control
$this->session->set('testtaskList', $uri, 'qa');
$this->session->set('reportList', $uri, 'qa');
$this->session->set('buildList', $uri, 'execution');
$this->session->set('branch', $branch, 'qa');
$this->loadModel('qa')->setMenu($productID, $branch);
/* 预处理部分变量供查询使用。*/
/* Prepare variables for query. */
@@ -101,7 +98,14 @@ class testtask extends control
$endTime = $endTime ? date('Y-m-d', strtotime($endTime)) : '';
$sort = common::appendOrder($orderBy);
$product = $this->product->getById($productID);
if($product->type == 'normal') $branch = 'all';
/* 处理分支。 */
/* Process branch. */
$branch = $this->testtaskZen->getBrowseBranch($branch, $product->type);
/* 设置1.5级菜单。 */
/* Set 1.5 level menu. */
$this->loadModel('qa')->setMenu($productID, $branch);
/* 从数据库中查询符合条件的测试单。*/
/* Query the testtasks from the database. */
+23
View File
@@ -28,6 +28,29 @@ class testtaskZen extends testtask
return $this->loadModel('qa')->setMenu($productID, $branch);
}
/**
* 获取列表页面的 branch 参数。
* Get browse branch param.
*
* @param string $branch
* @param string $productType
* @access protected
* @return string
*/
protected function getBrowseBranch(string $branch, string $productType): string
{
if($productType == 'normal') return 'all';
if($this->cookie->preBranch !== '' && $branch === '') $branch = (string)$this->cookie->preBranch;
/* 如果是多分支产品时,设置分支的 cookie。*/
/* Set branch cookie if product is multi-branch. */
helper::setcookie('preBranch', $branch);
$this->session->set('branch', $branch, 'qa');
return $branch;
}
/**
* 设置测试单用例列表页面搜索表单的参数。
* Set congiruration of search form in cases page of testtask.