From ba3ccdd6dd134d58697c9d18e6f57e3e951409da Mon Sep 17 00:00:00 2001 From: wangxuepeng Date: Thu, 28 Dec 2023 13:51:31 +0800 Subject: [PATCH] * Save the preBranch in qa module. --- module/bug/zen.php | 8 +++----- module/testcase/control.php | 2 +- module/testcase/zen.php | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/module/bug/zen.php b/module/bug/zen.php index 1ec35e50fb..c3ca72eb65 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -216,12 +216,10 @@ class bugZen extends bug { 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); + if($branch === '') $branch = $this->cookie->preBranch; + if($branch === '' || $branch === false) $branch = '0'; $this->session->set('branch', $branch, 'qa'); + helper::setcookie('preBranch', $branch); return $branch; } diff --git a/module/testcase/control.php b/module/testcase/control.php index d5d4626b3c..e202d399cc 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -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 === '0') && $this->cookie->preBranch !== '' && $branch === '' ? $this->cookie->preBranch : $branch; + $branch = $this->testcaseZen->getBrowseBranch($branch); $browseType = strtolower($browseType); $moduleID = $browseType == 'bymodule' ? $param : 0; $suiteID = $browseType == 'bysuite' ? $param : ($browseType == 'bymodule' ? ($this->cookie->caseSuite ? $this->cookie->caseSuite : 0) : 0); diff --git a/module/testcase/zen.php b/module/testcase/zen.php index bf53c95483..db9fe703c1 100755 --- a/module/testcase/zen.php +++ b/module/testcase/zen.php @@ -37,6 +37,22 @@ class testcaseZen extends testcase if($browseType == 'bysuite') helper::setcookie('caseSuite', $param); } + /** + * 获取列表页面的 branch 参数。 + * Get browse branch param. + * + * @param string $branch + * @access protected + * @return string + */ + protected function getBrowseBranch(string $branch): string + { + if($branch === '') $branch = $this->cookie->preBranch; + if($branch === '' || $branch === false) $branch = '0'; + + return $branch; + } + /** * 设置列表页面的 session。 * Set Browse session.