From 4a2a72ac4589c11017f970a827ed3147afb9ce4f Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Thu, 15 Apr 2021 15:37:04 +0800 Subject: [PATCH] * Finish task #37555. --- module/projectrelease/control.php | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index 6c5a94ac97..ffd095947b 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -28,32 +28,32 @@ class projectrelease extends control $this->loadModel('product'); $this->loadModel('release'); $this->loadModel('project'); - $this->view->products = $this->products = $this->product->getProductPairsByProject($this->session->project); - if(empty($this->products) and !helper::isAjaxRequest()) die($this->locate($this->createLink('product', 'showErrorNone', 'moduleName=project&activeMenu=projectrelease&projectID=' . $this->session->project))); } /** * Common actions. * + * @param int $projectID * @param int $productID * @param int $branch * @access public * @return void */ - public function commonAction($productID = 0, $branch = 0) + public function commonAction($projectID = 0, $productID = 0, $branch = 0) { $this->lang->product->switcherMenu = $this->product->getSwitcher($productID); /* Get product and product list by project. */ - $products = $this->product->getProductPairsByProject($this->session->project); - if(!$productID) $productID = key($products); + $this->products = $this->product->getProductPairsByProject($projectID); + if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'moduleName=project&activeMenu=projectrelease&projectID=' . $projectID))); + if(!$productID) $productID = key($this->products); $product = $this->product->getById($productID); - $this->view->products = $products; + $this->view->products = $this->products; $this->view->product = $product; $this->view->branches = (isset($product->type) and $product->type == 'normal') ? array() : $this->loadModel('branch')->getPairs($productID); $this->view->branch = $branch; - $this->view->project = $this->project->getByID($this->session->project); + $this->view->project = $this->project->getByID($projectID); } /** @@ -80,7 +80,7 @@ class projectrelease extends control $this->view->position[] = $this->lang->release->browse; $this->view->execution = $execution; $this->view->project = $project; - $this->view->products = $this->loadModel('product')->getProducts($this->session->project); + $this->view->products = $this->loadModel('product')->getProducts($projectID); $this->view->releases = $this->projectrelease->getList($projectID, $type); $this->view->projectID = $projectID; $this->view->executionID = $executionID; @@ -112,20 +112,20 @@ class projectrelease extends control } /* Get the builds that can select. */ - $productPairs = $this->loadModel('product')->getProductPairsByProject($this->session->project); + $productPairs = $this->loadModel('product')->getProductPairsByProject($projectID); $productIdList = array_keys($productPairs); $builds = $this->loadModel('build')->getProductBuildPairs($productIdList, 0, 0, 'notrunk'); - $releaseBuilds = $this->projectrelease->getReleaseBuilds($this->session->project); + $releaseBuilds = $this->projectrelease->getReleaseBuilds($projectID); foreach($releaseBuilds as $build) unset($builds[$build]); unset($builds['trunk']); $this->project->setMenu($projectID); - $this->commonAction(); + $this->commonAction($projectID); $this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->release->create; $this->view->position[] = $this->lang->release->create; $this->view->builds = $builds; - $this->view->lastRelease = $this->projectrelease->getLast($this->session->project); + $this->view->lastRelease = $this->projectrelease->getLast($projectID); $this->display(); } @@ -162,7 +162,7 @@ class projectrelease extends control /* Get release and build. */ $release = $this->projectrelease->getById((int)$releaseID); - $this->commonAction($release->product, $release->branch); + $this->commonAction($release->project, $release->product, $release->branch); $build = $this->build->getById($release->build); /* Set project menu. */ @@ -172,7 +172,7 @@ class projectrelease extends control $this->view->position[] = $this->lang->release->edit; $this->view->release = $release; $this->view->build = $build; - $this->view->builds = $this->loadModel('build')->getProjectBuildPairs($this->session->project, $release->product, $release->branch, 'notrunk|withbranch'); + $this->view->builds = $this->loadModel('build')->getProjectBuildPairs($release->project, $release->product, $release->branch, 'notrunk|withbranch'); $this->display(); } @@ -228,7 +228,7 @@ class projectrelease extends control ->fetchAll(); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'leftBugs'); - $this->commonAction($release->product); + $this->commonAction($release->project, $release->product); $product = $this->product->getById($release->product); /* Set menu. */ @@ -252,7 +252,7 @@ class projectrelease extends control $this->view->storyPager = $storyPager; $this->view->bugPager = $bugPager; $this->view->leftBugPager = $leftBugPager; - $this->view->projectID = $this->session->project; + $this->view->projectID = $release->project; $this->display(); } @@ -433,7 +433,7 @@ class projectrelease extends control $release = $this->projectrelease->getByID($releaseID); $build = $this->loadModel('build')->getByID($release->build); - $this->commonAction($release->product); + $this->commonAction($release->project, $release->product); $this->loadModel('story'); $this->loadModel('tree'); $this->loadModel('product'); @@ -482,7 +482,7 @@ class projectrelease extends control $this->view->browseType = $browseType; $this->view->param = $param; $this->view->pager = $pager; - $this->view->projectID = $this->session->project; + $this->view->projectID = $release->project; $this->display(); } @@ -554,7 +554,7 @@ class projectrelease extends control /* Set menu. */ $release = $this->projectrelease->getByID($releaseID); $build = $this->loadModel('build')->getByID($release->build); - $this->commonAction($release->product); + $this->commonAction($release->project, $release->product); /* Load pager. */ $this->app->loadClass('pager', $static = true); @@ -569,7 +569,7 @@ class projectrelease extends control $this->config->bug->search['style'] = 'simple'; $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product)); $this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($release->product, $viewType = 'bug', $startModuleID = 0); - $this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($release->product, 0, 'id_desc', $this->session->project); + $this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($release->product, 0, 'id_desc', $release->project); $this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($release->product, $branch = 0, $params = ''); $this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values']; if($this->session->currentProductType == 'normal')