diff --git a/module/execution/control.php b/module/execution/control.php index 79e081dde8..eb33c67f69 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -430,7 +430,9 @@ class execution extends control $this->story->replaceURLang($storyType); $this->config->product->search['fields']['title'] = $this->lang->story->title; unset($this->config->product->search['fields']['plan']); + unset($this->config->product->search['params']['plan']); unset($this->config->product->search['fields']['stage']); + unset($this->config->product->search['params']['stage']); } /* Process the order by field. */ diff --git a/module/execution/model.php b/module/execution/model.php index 46ff78a696..49545dbd6e 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2316,7 +2316,12 @@ class executionModel extends model if(empty($project->hasProduct)) { unset($this->config->product->search['fields']['product']); - if($project->model != 'kanban') unset($this->config->product->search['fields']['plan']); + unset($this->config->product->search['params']['product']); + if($project->model != 'kanban') + { + unset($this->config->product->search['fields']['plan']); + unset($this->config->product->search['params']['plan']); + } } $this->loadModel('search')->setSearchParams($this->config->product->search); diff --git a/module/product/config/search.php b/module/product/config/search.php index 305d6706cd..2e573a773e 100644 --- a/module/product/config/search.php +++ b/module/product/config/search.php @@ -5,13 +5,13 @@ $config->product->search['module'] = 'story'; $config->product->search['fields']['title'] = $lang->story->title; $config->product->search['fields']['id'] = $lang->story->id; $config->product->search['fields']['keywords'] = $lang->story->keywords; -$config->product->search['fields']['stage'] = $lang->story->stage; $config->product->search['fields']['status'] = $lang->story->status; $config->product->search['fields']['pri'] = $lang->story->pri; +$config->product->search['fields']['module'] = $lang->story->module; +$config->product->search['fields']['stage'] = $lang->story->stage; $config->product->search['fields']['product'] = $lang->story->product; $config->product->search['fields']['branch'] = ''; -$config->product->search['fields']['module'] = $lang->story->module; $config->product->search['fields']['plan'] = $lang->story->plan; $config->product->search['fields']['estimate'] = $lang->story->estimate; diff --git a/module/product/model.php b/module/product/model.php index fe19695643..9ffac0a04e 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -700,40 +700,56 @@ class productModel extends model * @param array $products * @param int $queryID * @param int $actionURL + * @param string $storyType * @param string $branch * @param int $projectID * @access public * @return void */ - public function buildSearchForm(int $productID, array $products, int $queryID, string $actionURL, string $branch = '', int $projectID = 0): void + public function buildSearchForm(int $productID, array $products, int $queryID, string $actionURL, string $storyType = 'story', string $branch = '', int $projectID = 0): void { $searchConfig = $this->config->product->search; $searchConfig['queryID'] = $queryID; $searchConfig['actionURL'] = $actionURL; - /* Get product plan data. */ - $productIdList = ($this->app->tab == 'project' && empty($productID)) ? array_keys($products) : array($productID); - $branchParam = ($this->app->tab == 'project' && empty($productID)) ? '' : $branch; - $searchConfig['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productIdList, (empty($branchParam) || $branchParam == 'all') ? '' : $branchParam); - /* Get product data. */ $product = ($this->app->tab == 'project' && empty($productID)) ? $products : array(); if(empty($product) && isset($products[$productID])) $product = array($productID => $products[$productID]); $searchConfig['params']['product']['values'] = $product + array('all' => $this->lang->product->allProduct); - /* Get product stage data. */ - $this->config->product->search['params']['stage']['values'] = array('' => '') + $this->lang->story->stageList; - /* Get module data. */ $projectID = ($this->app->tab == 'project' && empty($projectID)) ? $this->session->project : $projectID; $searchConfig['params']['module']['values'] = $this->productTao->getModulesForSearchForm($productID, $products, $branch, $projectID); + if($storyType == 'requirement') + { + /* Change for requirement story title. */ + $this->lang->story->title = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->title); + $this->lang->story->create = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->create); + $searchConfig['fields']['title'] = $this->lang->story->title; + unset($searchConfig['fields']['plan']); + unset($searchConfig['params']['plan']); + unset($searchConfig['fields']['stage']); + unset($searchConfig['params']['stage']); + } + else + { + /* Get product plan data. */ + $productIdList = ($this->app->tab == 'project' && empty($productID)) ? array_keys($products) : array($productID); + $branchParam = ($this->app->tab == 'project' && empty($productID)) ? '' : $branch; + $searchConfig['params']['plan']['values'] = $this->loadModel('productplan')->getPairs($productIdList, (empty($branchParam) || $branchParam == 'all') ? '' : $branchParam); + } + /* Get branch data. */ if($productID) { $productInfo = $this->getByID($productID); - if(!empty($productInfo->shadow)) unset($searchConfig['fields']['product']); + if(!empty($productInfo->shadow)) + { + unset($searchConfig['fields']['product']); + unset($searchConfig['params']['product']); + } if($productInfo->type == 'normal' || $this->app->tab == 'assetlib') { unset($searchConfig['fields']['branch']); diff --git a/module/product/zen.php b/module/product/zen.php index e314ec5afd..3f407c394b 100644 --- a/module/product/zen.php +++ b/module/product/zen.php @@ -1120,21 +1120,20 @@ class productZen extends product */ protected function buildSearchFormForBrowse(object|null $project, int $projectID, int &$productID, string $branch, int $param, string $storyType, string $browseType, bool $isProjectStory): void { - /* Change for requirement story title. */ - if($storyType == 'requirement') - { - $this->lang->story->title = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->title); - $this->lang->story->create = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->create); - $this->config->product->search['fields']['title'] = $this->lang->story->title; - unset($this->config->product->search['fields']['plan']); - unset($this->config->product->search['fields']['stage']); - } + if($isProjectStory && !$productID && !empty($this->products)) $productID = (int)key($this->products); // If toggle a project by the #swapper component on the story page of the projectstory module, the $productID may be empty. Make sure it has value. if(isset($project->hasProduct) && empty($project->hasProduct)) { - if($isProjectStory && !$productID && !empty($this->products)) $productID = (int)key($this->products); // If toggle a project by the #swapper component on the story page of the projectstory module, the $productID may be empty. Make sure it has value. - unset($this->config->product->search['fields']['product']); // The none-product project don't need display the product in the search form. - if($project->model != 'scrum') unset($this->config->product->search['fields']['plan']); // The none-product and none-scrum project don't need display the plan in the search form. + /* The none-product project don't need display the product in the search form. */ + unset($this->config->product->search['fields']['product']); + unset($this->config->product->search['params']['product']); + + /* The none-product and none-scrum project don't need display the plan in the search form. */ + if($project->model != 'scrum') + { + unset($this->config->product->search['fields']['plan']); + unset($this->config->product->search['params']['plan']); + } } /* Build search form. */ @@ -1143,7 +1142,7 @@ class productZen extends product $this->config->product->search['onMenuBar'] = 'yes'; $queryID = ($browseType == 'bysearch') ? $param : 0; - $this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL, $branch, $projectID); + $this->product->buildSearchForm($productID, $this->products, $queryID, $actionURL, $storyType, $branch, $projectID); } /** diff --git a/module/story/control.php b/module/story/control.php index 5e94eb55e6..c7d0bb120e 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -1300,42 +1300,26 @@ class story extends control /* Get story, product, products, and queryID. */ $story = $this->story->getById($storyID); $products = $this->product->getPairs('', 0, '', 'all'); - $product = $this->product->getByID($story->product); /* Change for requirement story title. */ - if($story->type == 'story') - { - $this->lang->story->title = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->title); - $this->lang->story->create = str_replace($this->lang->SRCommon, $this->lang->URCommon, $this->lang->story->create); - $this->config->product->search['fields']['title'] = $this->lang->story->title; - unset($this->config->product->search['fields']['stage']); - } - else + if($story->type == 'requirement') { $this->lang->story->title = str_replace($this->lang->URCommon, $this->lang->SRCommon, $this->lang->story->title); $this->lang->story->linkStory = str_replace($this->lang->URCommon, $this->lang->SRCommon, $this->lang->story->linkStory); } - if(!empty($product->shadow)) - { - unset($this->config->product->search['fields']['plan']); - unset($this->config->product->search['fields']['product']); - } - /* Build search form. */ $actionURL = $this->createLink('story', 'linkStory', "storyID=$storyID&type=$type&linkedStoryID=$linkedStoryID&browseType=bySearch&queryID=myQueryID&storyType=$storyType"); - $this->product->buildSearchForm($story->product, $products, $queryID, $actionURL); + $this->product->buildSearchForm($story->product, $products, $queryID, $actionURL, $story->type == 'story' ? 'requirement' : 'story'); /* Get stories to link. */ - $storyType = $story->type; - $stories2Link = $this->story->getStories2Link($storyID, $type, $browseType, $queryID, $storyType); + $stories2Link = $this->story->getStories2Link($storyID, $type, $browseType, $queryID, $story->type); /* Assign. */ $this->view->title = $this->lang->story->linkStory . "STORY" . $this->lang->colon .$this->lang->story->linkStory; $this->view->type = $type; $this->view->stories2Link = $stories2Link; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->storyType = $storyType; $this->display(); } @@ -1363,20 +1347,13 @@ class story extends control /* Get story, product, products, and queryID. */ $story = $this->story->getById($storyID); $products = $this->product->getPairs('', 0, '', 'all'); - $product = $this->product->getByID($story->product); $queryID = ($browseType == 'bySearch') ? $param : 0; $type = $story->type == 'story' ? 'linkRelateSR' : 'linkRelateUR'; $method = $story->type == 'story' ? 'linkStories' : 'linkRequirements'; - if(!empty($product->shadow)) - { - unset($this->config->product->search['fields']['product']); - unset($this->config->product->search['fields']['plan']); - } - /* Build search form. */ $actionURL = $this->createLink('story', $method, "storyID=$storyID&browseType=bySearch&excludeStories=$excludeStories&queryID=myQueryID"); - $this->product->buildSearchForm($story->product, $products, $queryID, $actionURL); + $this->product->buildSearchForm($story->product, $products, $queryID, $actionURL, $story->type); $this->view->story = $story; $this->view->stories2Link = $this->story->getStories2Link($storyID, $type, $browseType, $queryID, $story->type, $pager, $excludeStories); diff --git a/module/story/tao.php b/module/story/tao.php index 4670a51597..6eb16e5e5b 100644 --- a/module/story/tao.php +++ b/module/story/tao.php @@ -1595,7 +1595,7 @@ class storyTao extends storyModel $reviewLink = helper::createLink('story', 'review', $params . "&from=$story->from&storyType=$story->type"); $recallLink = helper::createLink('story', 'recall', $params . "&from=list&confirm=no&storyType=$story->type"); $batchCreateStoryLink = helper::createLink('story', 'batchCreate', "productID=$story->product&branch=$story->branch&module=$story->module&$params&executionID=$executionID&plan=0&storyType=story"); - $editLink = helper::createLink('story', 'edit', $params . "&kanbanGroup=default&storyType=$story->type"); + $editLink = helper::createLink('story', 'edit', $params . "&kanbanGroup=default&storyType=$story->type") . ($this->app->tab == 'project' ? '#app=project' : ''); $createCaseLink = helper::createLink('testcase', 'create', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$params"); /* If the story cannot be changed, render the close button. */