From 98dcd7517ff8c98dfa9c5ed4378b4baa5cd73d3b Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 11 May 2022 06:38:46 +0000 Subject: [PATCH] * Optimize code. --- module/product/control.php | 2 +- module/product/model.php | 8 +++++--- module/project/model.php | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index 17e5520626..fc85c81ebf 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -301,7 +301,7 @@ class product extends control $actionURL = $this->createLink($rawModule, $rawMethod, $params . "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID&storyType=$storyType"); $this->config->product->search['onMenuBar'] = 'yes'; - $this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL, $branch); + $this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL, $branch, $projectID); $showModule = !empty($this->config->datatable->productBrowse->showModule) ? $this->config->datatable->productBrowse->showModule : ''; diff --git a/module/product/model.php b/module/product/model.php index aa01af3093..f8427994e5 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -975,13 +975,15 @@ class productModel extends model * @param int $queryID * @param int $actionURL * @param int $branch + * @param int $projectID * @access public * @return void */ - public function buildSearchForm($productID, $products, $queryID, $actionURL, $branch = 0) + public function buildSearchForm($productID, $products, $queryID, $actionURL, $branch = 0, $projectID = 0) { $productIdList = ($this->app->tab == 'project' and empty($productID)) ? array_keys($products) : $productID; $branchParam = ($this->app->tab == 'project' and empty($productID)) ? '' : $branch; + $projectID = ($this->app->tab == 'project' and empty($projectID)) ? $this->session->project : $projectID; $this->config->product->search['actionURL'] = $actionURL; $this->config->product->search['queryID'] = $queryID; @@ -997,7 +999,7 @@ class productModel extends model if($productID) { $modules = array(); - $branchList = $this->loadModel('branch')->getPairs($productID, '', $this->session->project); + $branchList = $this->loadModel('branch')->getPairs($productID, '', $projectID); $branchModuleList = $this->tree->getOptionMenu($productID, 'story', 0, array_keys($branchList)); foreach($branchModuleList as $branchID => $branchModules) $modules[] = $branchModules; } @@ -1005,7 +1007,7 @@ class productModel extends model { $moduleList = array(); $modules = array('/'); - $branchGroup = $this->loadModel('execution')->getBranchByProduct(array_keys($products), $this->session->project, ''); + $branchGroup = $this->loadModel('execution')->getBranchByProduct(array_keys($products), $projectID, ''); foreach($products as $productID => $productName) { if(isset($branchGroup[$productID])) diff --git a/module/project/model.php b/module/project/model.php index ef25e5e64b..0a4b6d9110 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -532,6 +532,14 @@ class projectModel extends model { $link = helper::createLink($module, 'group', "projectID=%s"); } + elseif($module == 'product' and $method == 'showerrornone') + { + $link = helper::createLink('projectstory', 'story', "projectID=%s"); + } + elseif($module == 'projectstory' and $method == 'story') + { + $link = helper::createLink($module, $method, "projectID=%s"); + } elseif($module == 'projectstory' and $method == 'linkstory') { $link = helper::createLink($module, $method, "projectID=%s");