From ed2efc053ca15562f3804e9d0fd9b0f01bfb8cbe Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Thu, 2 Dec 2021 14:05:35 +0800 Subject: [PATCH 1/8] * Fix bug #16975. --- module/testcase/control.php | 5 +++-- module/testcase/view/showimport.html.php | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/module/testcase/control.php b/module/testcase/control.php index 2cfd24f23f..9817b145cc 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1838,7 +1838,8 @@ class testcase extends control $caseLang = $this->lang->testcase; $caseConfig = $this->config->testcase; - $modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch); + $branches = $this->loadModel('branch')->getPairs($productID); + $modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, empty(array_keys($branches)) ? 0 : array_keys($branches)); $stories = $this->loadModel('story')->getProductStoryPairs($productID, $branch); $fields = $this->testcase->getImportFields($productID); $fields = array_flip($fields); @@ -2019,7 +2020,7 @@ class testcase extends control $this->view->caseData = $caseData; $this->view->stepData = $stepData; $this->view->productID = $productID; - $this->view->branches = $this->loadModel('branch')->getPairs($productID); + $this->view->branches = $branches; $this->view->isEndPage = $pagerID >= $allPager; $this->view->allCount = $allCount; $this->view->allPager = $allPager; diff --git a/module/testcase/view/showimport.html.php b/module/testcase/view/showimport.html.php index 0b6cbc545a..79c721e73e 100644 --- a/module/testcase/view/showimport.html.php +++ b/module/testcase/view/showimport.html.php @@ -81,7 +81,8 @@ $(function() title, ENT_QUOTES), "class='form-control'")?> - module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen moduleChange'")?> + branch) and $case->branch != 0) ? $modules[BRANCH_MAIN] + $modules[$case->branch] : $modules;?> + module) ? $case->module : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->module : ''), "class='form-control chosen moduleChange'")?> story) ? $case->story : ((!empty($case->id) and isset($cases[$case->id])) ? $cases[$case->id]->story : '');?> From fc8a537ed9662bbde85deb66deb9e7672d239580 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Thu, 2 Dec 2021 15:41:25 +0800 Subject: [PATCH 2/8] * Fix bug #17046. --- module/qa/model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/qa/model.php b/module/qa/model.php index fa41835710..c128e4d35f 100644 --- a/module/qa/model.php +++ b/module/qa/model.php @@ -32,7 +32,10 @@ class qaModel extends model $branch = ($this->cookie->preBranch !== '' and $branch === '') ? $this->cookie->preBranch : $branch; setcookie('preBranch', $branch, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); - if(!in_array($this->app->rawModule, $this->config->qa->noDropMenuModule)) $this->lang->switcherMenu = $this->loadModel('product')->getSwitcher($productID, $extra, $branch); + $product = $this->loadModel('product')->getById($productID); + if($product->type != 'normal') $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]); + + if(!in_array($this->app->rawModule, $this->config->qa->noDropMenuModule)) $this->lang->switcherMenu = $this->product->getSwitcher($productID, $extra, $branch); if($this->app->rawModule == 'product' and $this->app->rawMethod == 'showerrornone') $this->lang->switcherMenu = ''; common::setMenuVars('qa', $productID); } From ddcdaf4319c8f72059fa169ad05a98be30d45247 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Thu, 2 Dec 2021 15:46:24 +0800 Subject: [PATCH 3/8] * Fix api of users. --- api/v1/entries/builds.php | 2 +- api/v1/entries/user.php | 28 +++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/api/v1/entries/builds.php b/api/v1/entries/builds.php index fff692e506..46cbba813b 100644 --- a/api/v1/entries/builds.php +++ b/api/v1/entries/builds.php @@ -59,7 +59,7 @@ class buildsEntry extends entry $control = $this->loadController('build', 'create'); $this->requireFields('execution,product,name,builder,date'); - $control->create(0,0,$projectID); + $control->create(0, 0, $projectID); $data = $this->getData(); if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); diff --git a/api/v1/entries/user.php b/api/v1/entries/user.php index dc3e23579a..0630c3ca98 100644 --- a/api/v1/entries/user.php +++ b/api/v1/entries/user.php @@ -14,7 +14,7 @@ class userEntry extends Entry /** * GET method. * - * @param int $userID + * @param int|string $userID * @access public * @return void */ @@ -23,6 +23,13 @@ class userEntry extends Entry /* Get my info defaultly. */ if(!$userID) return $this->getInfo($this->param('fields', '')); + if(!is_numeric($userID)) + { + $user = $this->loadModel('user')->getById($userID, 'account'); + if(!$user) return $this->send404(); + $userID = $user->id; + } + /* Get user by id. */ $control = $this->loadController('user', 'profile'); $control->profile($userID); @@ -349,17 +356,25 @@ class userEntry extends Entry /** * PUT method. * - * @param int $userID + * @param int|string $userID * @access public * @return void */ public function put($userID) { + if(!is_numeric($userID)) + { + $user = $this->loadModel('user')->getById($userID, 'account'); + if(!$user) return $this->send404(); + $userID = $user->id; + } + $oldUser = $this->loadModel('user')->getByID($userID, 'id'); /* Set $_POST variables. */ $fields = 'dept,realname,email,commiter,gender'; $this->batchSetPost($fields, $oldUser); + $this->setPost('account', $oldUser->account); if($this->request('gender') and !in_array($this->request('gender'), array('f', 'm'))) return $this->sendError(400, "The value of gendar must be 'f' or 'm'"); @@ -380,12 +395,19 @@ class userEntry extends Entry /** * DELETE method. * - * @param int $userID + * @param int|string $userID * @access public * @return void */ public function delete($userID) { + if(!is_numeric($userID)) + { + $user = $this->loadModel('user')->getById($userID, 'account'); + if(!$user) return $this->send404(); + $userID = $user->id; + } + $this->setPost('verifyPassword', md5($this->app->user->password . $this->app->session->rand)); $control = $this->loadController('user', 'delete'); From ebf78059e884c5cb7777aeb6f1d614077fc03b92 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Thu, 2 Dec 2021 15:55:20 +0800 Subject: [PATCH 4/8] * Rename actions of productplan. --- ...ductplanlinkbug.php => productplanlinkbugs.php} | 4 ++-- ...lanlinkstory.php => productplanlinkstories.php} | 4 ++-- ...planunlinkbug.php => productplanunlinkbugs.php} | 4 ++-- ...nlinkstory.php => productplanunlinkstories.php} | 4 ++-- config/routes.php | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) rename api/v1/entries/{productplanlinkbug.php => productplanlinkbugs.php} (94%) rename api/v1/entries/{productplanlinkstory.php => productplanlinkstories.php} (93%) rename api/v1/entries/{productplanunlinkbug.php => productplanunlinkbugs.php} (93%) rename api/v1/entries/{productplanunlinkstory.php => productplanunlinkstories.php} (92%) diff --git a/api/v1/entries/productplanlinkbug.php b/api/v1/entries/productplanlinkbugs.php similarity index 94% rename from api/v1/entries/productplanlinkbug.php rename to api/v1/entries/productplanlinkbugs.php index b553a092b4..33f6f7812d 100644 --- a/api/v1/entries/productplanlinkbug.php +++ b/api/v1/entries/productplanlinkbugs.php @@ -1,6 +1,6 @@ Date: Thu, 2 Dec 2021 16:08:17 +0800 Subject: [PATCH 5/8] * Fix bug #17031,#17029. --- module/bug/view/view.html.php | 3 ++- module/project/view/bug.html.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index bca8d23892..3177f59666 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -123,6 +123,7 @@ + @@ -153,7 +154,7 @@ foreach($modulePath as $key => $module) { $moduleTitle .= $module->name; - if(!common::printLink('bug', 'browse', "productID=$bug->product&branch=$module->branch&browseType=byModule¶m=$module->id", $module->name)) echo $module->name; + if(!common::printLink('bug', 'browse', "productID=$bug->product&branch=$module->branch&browseType=byModule¶m=$module->id", $module->name, '', "data-app='qa'")) echo $module->name; if(isset($modulePath[$key + 1])) { $moduleTitle .= '/'; diff --git a/module/project/view/bug.html.php b/module/project/view/bug.html.php index 2fcba6a8c8..d4d985bfc6 100644 --- a/module/project/view/bug.html.php +++ b/module/project/view/bug.html.php @@ -18,6 +18,7 @@
bug->product;?> product", $product->name, '', "data-app='product'")) echo $product->name;?>
- From 1c3c07e6e06008b76732a60310a401d247d63aed Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 2 Dec 2021 16:43:15 +0800 Subject: [PATCH 8/8] * Fix the problem that cookic is not updated in time. --- module/product/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/product/model.php b/module/product/model.php index 535c652d4e..6e0c1a4b16 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -161,6 +161,7 @@ class productModel extends model if($this->cookie->preProductID != $this->session->product) { + $this->cookie->set('preBranch', 0); setcookie('preBranch', 0, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); } return $this->session->product;
bug->product;?> product", $product->name, '', "data-app='product'")) echo $product->name;?>