From 915b7533cf4ed3a1122c4d688b33129f14168305 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Thu, 17 Dec 2020 13:27:47 +0800 Subject: [PATCH] * Fix bug. --- framework/router.class.php | 20 ++++++------- module/action/model.php | 9 ++++-- module/common/lang/zh-cn.php | 11 ------- module/custom/model.php | 40 ++++++++++++++++++++++++++ module/product/model.php | 33 ++++++++++----------- module/product/view/create.html.php | 2 +- module/program/view/prjcreate.html.php | 2 +- module/program/view/prjedit.html.php | 2 +- 8 files changed, 74 insertions(+), 45 deletions(-) diff --git a/framework/router.class.php b/framework/router.class.php index 899c5e9006..372f3dbcc7 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -162,17 +162,17 @@ class router extends baseRouter /* Get story concept in project and product. */ $URSRList = $this->dbh->query('SELECT `key`, `value` FROM' . TABLE_LANG . "WHERE module = 'custom' and section = 'URSRList' and lang = \"{$this->clientLang}\"")->fetchAll(); - $URList = array(); - $SRList = array(); + $URPairs = array(); + $SRPairs = array(); foreach($URSRList as $id => $value) { $URSR = json_decode($value->value); - $URList[$value->key] = $URSR->URName; - $SRList[$value->key] = $URSR->SRName; + $URPairs[$value->key] = $URSR->URName; + $SRPairs[$value->key] = $URSR->SRName; } - $lang->URCommon = zget($URList, $config->URSR); - $lang->SRCommon = zget($SRList, $config->URSR); + $lang->URCommon = zget($URPairs, $config->URSR); + $lang->SRCommon = zget($SRPairs, $config->URSR); $lang->projectURCommon = $lang->URCommon; $lang->productURCommon = $lang->URCommon; $lang->projectSRCommon = $lang->SRCommon; @@ -182,16 +182,16 @@ class router extends baseRouter if($projectID) { $storyConcept = $this->dbh->query('SELECT `storyConcept` FROM' . TABLE_PROJECT . "WHERE id = {$projectID}")->fetch(); - $lang->projectURCommon = zget($URList, $storyConcept->storyConcept, $lang->URCommon); - $lang->projectSRCommon = zget($SRList, $storyConcept->storyConcept, $lang->SRCommon); + $lang->projectURCommon = zget($URPairs, $storyConcept->storyConcept, $lang->URCommon); + $lang->projectSRCommon = zget($SRPairs, $storyConcept->storyConcept, $lang->SRCommon); } $productID = $this->session->product; if($productID) { $storyConcept = $this->dbh->query('SELECT `storyConcept` FROM' . TABLE_PRODUCT . "WHERE id = {$productID}")->fetch(); - $lang->productURCommon = zget($URList, $storyConcept->storyConcept, $lang->URCommon); - $lang->productSRCommon = zget($SRList, $storyConcept->storyConcept, $lang->SRCommon); + $lang->productURCommon = zget($URPairs, $storyConcept->storyConcept, $lang->URCommon); + $lang->productSRCommon = zget($SRPairs, $storyConcept->storyConcept, $lang->SRCommon); } } } diff --git a/module/action/model.php b/module/action/model.php index 8533290b3e..ff171ac9c2 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -922,12 +922,15 @@ class actionModel extends model */ public function getStoryConcept($action) { - $this->app->loadLang('custom'); + $this->loadModel('custom'); $story = $this->loadModel('story')->getByID($action->objectID); $product = $this->loadModel('product')->getByID($story->product); - $URCommon = zget($this->lang->custom->URList, $product->storyConcept, $this->lang->URCommon); - $SRCommon = zget($this->lang->custom->SRList, $product->storyConcept, $this->lang->SRCommon); + $URPairs = $this->custom->getURPairs(); + $SRPairs = $this->custom->getSRPairs(); + + $URCommon = zget($URPairs, $product->storyConcept); + $SRCommon = zget($SRPairs, $product->storyConcept); return $story->type == 'story' ? $SRCommon : $URCommon; } diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index dc6443fbda..f2d2c1c870 100755 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -125,10 +125,6 @@ $lang->typeAB = '类型'; $lang->common = new stdclass(); $lang->common->common = '公有模块'; -global $config; -$URCommon = isset($lang->URCommon) ? $lang->URCommon : '用户需求'; -$SRCommon = isset($lang->SRCommon) ? $lang->SRCommon : '软件需求'; - /* 主导航菜单。*/ $lang->mainNav = new stdclass(); $lang->mainNav->my = ' 地盘|my|index|'; @@ -944,13 +940,6 @@ $lang->projectstory->menu->requirement = array('link' => "{$lang->projectURCommo $lang->projectstory->menu->story = array('link' => "{$lang->projectSRCommon}|projectstory|story", 'subModule' => ''); $lang->projectstory->menu->track = array('link' => '跟踪矩阵|projectstory|track', 'subModule' => ''); -$lang->waterfallproduct->menu->plan = array('link' => "计划|productplan|browse|productID={PRODUCT}", 'subModule' => 'productplan'); -$lang->waterfallproduct->menu->story = '需求|product|browse|product={PRODUCT}'; -$lang->waterfallproduct->menu->track = '跟踪矩阵|story|track|product={PRODUCT}'; - -$lang->waterfallproduct->menu->requirement = array('link' => "{$URCommon}|product|browse|productID={PRODUCT}&branch=&browseType=unclosed¶m=0&storyType=requirement"); -$lang->waterfallproduct->menu->story = array('link' => "{$SRCommon}|product|browse|productID={PRODUCT}"); - $lang->nc->menu = $lang->auditplan->menu; $lang->noMenuModule = array('my', 'todo', 'effort', 'program', 'product', 'productplan', 'projectbuild', 'story', 'branch', 'release', 'attend', 'leave', 'makeup', 'overtime', 'lieu', 'custom', 'admin', 'mail', 'extension', 'dev', 'backup', 'action', 'cron', 'issue', 'risk', 'pssp', 'sms', 'message', 'webhook', 'search'); diff --git a/module/custom/model.php b/module/custom/model.php index bd2267cfde..282f8489e6 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -488,6 +488,46 @@ class customModel extends model return $URSRPairs; } + /** + * Get UR pairs. + * + * @access public + * @return void + */ + public function getURPairs() + { + $URSRList = $this->dao->select('`key`,`value`')->from(TABLE_LANG)->where('module')->eq('custom')->andWhere('section')->eq('URSRList')->andWhere('lang')->eq($this->app->clientLang)->fetchPairs(); + + $URPairs = array(); + foreach($URSRList as $key => $value) + { + $URSR = json_decode($value); + $URPairs[$key] = $URSR->URName; + } + + return $URPairs; + } + + /** + * Get SR pairs. + * + * @access public + * @return void + */ + public function getSRPairs() + { + $URSRList = $this->dao->select('`key`,`value`')->from(TABLE_LANG)->where('module')->eq('custom')->andWhere('section')->eq('URSRList')->andWhere('lang')->eq($this->app->clientLang)->fetchPairs(); + + $SRPairs = array(); + foreach($URSRList as $key => $value) + { + $URSR = json_decode($value); + $SRPairs[$key] = $URSR->SRName; + } + + return $SRPairs; + } + /** * Get UR and SR list. * diff --git a/module/product/model.php b/module/product/model.php index 90463bf3a0..eeb4b47afd 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -443,21 +443,14 @@ class productModel extends model */ public function getStoryConceptByProduct($productID = 0) { - $product = $this->getById($productID); - $URSRList = $this->dao->select('`key`,`value`')->from(TABLE_LANG)->where('module')->eq('custom')->andWhere('section')->eq('URSRList')->andWhere('lang')->eq($this->app->clientLang)->fetchPairs(); - - $URList = array(); - $SRList = array(); - foreach($URSRList as $key => $value) - { - $URSR = json_decode($value); - $URList[$key] = $URSR->URName; - $SRList[$key] = $URSR->SRName; - } + $this->loadModel('custom'); + $product = $this->getById($productID); + $URPairs = $this->custom->getURPairs(); + $SRPairs = $this->custom->getSRPairs(); $concept = new stdClass(); - $concept->UR = zget($URList, $product->storyConcept); - $concept->SR = zget($SRList, $product->storyConcept); + $concept->UR = zget($URPairs, $product->storyConcept, $this->lang->URCommon); + $concept->SR = zget($SRPairs, $product->storyConcept, $this->lang->SRCommon); return $concept; } @@ -1412,32 +1405,36 @@ class productModel extends model */ public function replaceStoryConcept($productID = 0) { - $this->app->loadLang('custom'); + $this->loadModel('custom'); $product = $this->getByID($productID); $lastProduct = $this->getByID($this->cookie->lastProduct); + $URPairs = $this->custom->getURPairs(); + $SRPairs = $this->custom->getSRPairs(); + /* Replace menu lang. */ foreach($this->lang->product->menu as $key => $menu) { if($key == 'requirement') { $link = explode('|', $menu['link']); - $link[0] = zget($this->lang->custom->URList, $product->storyConcept, $this->lang->URCommon); + $link[0] = zget($URPairs, $product->storyConcept, $this->lang->URCommon); $this->lang->product->menu->$key = implode('|', $link); } if($key == 'story') { $link = explode('|', $menu['link']); - $link[0] = zget($this->lang->custom->SRList, $product->storyConcept, $this->lang->SRCommon); + $link[0] = zget($SRPairs, $product->storyConcept, $this->lang->SRCommon); $this->lang->product->menu->$key = implode('|', $link); } } - $lastSRCommon = zget($this->lang->custom->SRList, $lastProduct->storyConcept, $this->lang->SRCommon); - $SRCommon = zget($this->lang->custom->SRList, $product->storyConcept, $this->lang->SRCommon); + $lastSRCommon = zget($SRPairs, $lastProduct->storyConcept, $this->lang->SRCommon); + $SRCommon = zget($SRPairs, $product->storyConcept, $this->lang->SRCommon); $this->lang->story->createStory = str_replace($lastSRCommon, $SRCommon, $this->lang->story->create); $this->lang->story->createRequirement = str_replace($lastSRCommon, $SRCommon, $this->lang->story->createRequirement); $this->lang->story->noStory = str_replace($lastSRCommon, $SRCommon, $this->lang->story->noStory); + $this->lang->story->title = str_replace($lastSRCommon, $SRCommon, $this->lang->story->title); } } diff --git a/module/product/view/create.html.php b/module/product/view/create.html.php index e50b54598c..2dfbf0c763 100644 --- a/module/product/view/create.html.php +++ b/module/product/view/create.html.php @@ -57,7 +57,7 @@