From 6f82d035a6e446cb2610aa4f2deafea50848c1da Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Mon, 22 Mar 2021 16:03:12 +0800 Subject: [PATCH] * Fix the related link of project story. --- module/action/model.php | 4 +- module/story/control.php | 6 +-- module/tree/model.php | 93 +++++++++++++++++++++++++++++++++++++--- 3 files changed, 93 insertions(+), 10 deletions(-) diff --git a/module/action/model.php b/module/action/model.php index 40a2f8e63b..d182353308 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -253,7 +253,7 @@ class actionModel extends model { $name = $this->dao->select('name')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch('name'); $productID = trim($action->product, ','); - if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "productID=$productID"), $name) : $name; + if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "projectID=$action->execution&productID=$productID"), $name) : $name; } elseif($actionName == 'linked2plan') { @@ -293,7 +293,7 @@ class actionModel extends model { $name = $this->dao->select('name')->from(TABLE_PROJECT)->where('id')->eq($action->extra)->fetch('name'); $productID = trim($action->product, ','); - if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "productID=$productID"), "#$action->extra " . $name) : "#$action->extra " . $name; + if($name) $action->extra = common::hasPriv('projectstory', 'story') ? html::a(helper::createLink('projectstory', 'story', "projectID=$action->execution&productID=$productID"), "#$action->extra " . $name) : "#$action->extra " . $name; } elseif($actionName == 'unlinkedfrombuild') { diff --git a/module/story/control.php b/module/story/control.php index 3dd13d73cd..9180c37940 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -109,7 +109,7 @@ class story extends control { $execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch(); $moduleName = $execution->type == 'project' ? 'projectstory' : 'execution'; - $param = $execution->type == 'project' ? "project=$objectID" : "executionID=$objectID"; + $param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID"; $response['locate'] = $this->createLink($moduleName, 'story', $param); } $this->send($response); @@ -163,7 +163,7 @@ class story extends control setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', false, true); $execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch(); $moduleName = $execution->type == 'project' ? 'projectstory' : 'execution'; - $param = $execution->type == 'project' ? "productID=$productID" : "executionID=$objectID&orderBy=id_desc&browseType=unclosed"; + $param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID&orderBy=id_desc&browseType=unclosed"; $response['locate'] = $this->createLink($moduleName, 'story', $param); } if($this->app->getViewType() == 'xhtml') $response['locate'] = $this->createLink('story', 'view', "storyID=$storyID"); @@ -406,7 +406,7 @@ class story extends control { setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', false, false); $moduleName = $execution->type == 'project' ? 'projectstory' : 'execution'; - $param = $execution->type == 'project' ? "productID=$productID" : "executionID=$executionID&orderBy=id_desc&browseType=unclosed"; + $param = $execution->type == 'project' ? "projectID=$executionID&productID=$productID" : "executionID=$executionID&orderBy=id_desc&browseType=unclosed"; $link = $this->createLink($moduleName, 'story', $param); die(js::locate($link, 'parent')); } diff --git a/module/tree/model.php b/module/tree/model.php index 2b6ba00adf..707be62826 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -698,6 +698,89 @@ class treeModel extends model return $menu; } + /** + * Get the tree menu of case in html. + * + * @param int $rootID + * @param int $productID + * @param int $startModule + * @param int $userFunc + * @param string $extra + * @access public + * @return void + */ + public function getCaseTreeMenu($rootID, $productID = 0, $startModule = 0, $userFunc, $extra = '') + { + $extra = array('projectID' => $rootID, 'productID' => $productID, 'tip' => true, 'extra' => $extra); + + /* If createdVersion <= 4.1, go to getTreeMenu(). */ + $products = $this->loadModel('product')->getProductPairsByProject($rootID); + $branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products)); + + /* createdVersion > 4.1. */ + $menu = "