From 9a7bd2a6fce2afbbd7db66c328961c9377cb6e23 Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 1 Dec 2021 11:19:28 +0800 Subject: [PATCH] * Fix bug #16682. --- module/testcase/control.php | 66 ++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/module/testcase/control.php b/module/testcase/control.php index 0cf4106843..598fb38190 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -352,39 +352,6 @@ class testcase extends control } if(empty($this->products)) $this->locate($this->createLink('product', 'create')); - /* Set productID and branch. */ - $productID = $this->product->saveState($productID, $this->products); - if($branch === '') $branch = $this->cookie->preBranch; - - /* Set menu. */ - if($this->app->tab == 'project' or $this->app->tab == 'execution') $this->loadModel('execution'); - if($this->app->tab == 'project') - { - $this->loadModel('project')->setMenu($this->session->project); - } - elseif($this->app->tab == 'execution') - { - $this->execution->setMenu($this->session->execution); - } - else - { - $this->qa->setMenu($this->products, $productID, $branch); - } - - /* Set branch. */ - $product = $this->product->getById($productID); - if($this->app->tab == 'execution' or $this->app->tab == 'project') - { - $objectID = $this->app->tab == 'project' ? $this->session->project : $executionID; - $productBranches = (isset($product->type) and $product->type != 'normal') ? $this->execution->getBranchByProduct($productID, $objectID) : array(); - $branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array(); - $branch = key($branches); - } - else - { - $branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array(); - } - /* Init vars. */ $type = 'feature'; $stage = ''; @@ -423,6 +390,39 @@ class testcase extends control $steps = $this->testcase->createStepsFromBug($bug->steps); } + /* Set productID and branch. */ + $productID = $this->product->saveState($productID, $this->products); + if($branch === '') $branch = $this->cookie->preBranch; + + /* Set menu. */ + if($this->app->tab == 'project' or $this->app->tab == 'execution') $this->loadModel('execution'); + if($this->app->tab == 'project') + { + $this->loadModel('project')->setMenu($this->session->project); + } + elseif($this->app->tab == 'execution') + { + $this->execution->setMenu($this->session->execution); + } + else + { + $this->qa->setMenu($this->products, $productID, $branch); + } + + /* Set branch. */ + $product = $this->product->getById($productID); + if($this->app->tab == 'execution' or $this->app->tab == 'project') + { + $objectID = $this->app->tab == 'project' ? $this->session->project : $executionID; + $productBranches = (isset($product->type) and $product->type != 'normal') ? $this->execution->getBranchByProduct($productID, $objectID) : array(); + $branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array(); + $branch = key($branches); + } + else + { + $branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID, 'active') : array(); + } + /* Padding the steps to the default steps count. */ if(count($steps) < $this->config->testcase->defaultSteps) {