From b12cf02ef08e0795009758d3caa2909908b17e3b Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Mon, 9 Nov 2020 15:35:01 +0800 Subject: [PATCH] * Code for UR name and SR name. --- db/update20.0.alpha.sql | 3 +-- db/zentao.sql | 3 +-- framework/router.class.php | 20 ++++++++------------ module/custom/control.php | 12 ++++++------ module/custom/model.php | 4 ++-- 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/db/update20.0.alpha.sql b/db/update20.0.alpha.sql index 26ea5d5538..957a26ba2e 100644 --- a/db/update20.0.alpha.sql +++ b/db/update20.0.alpha.sql @@ -321,8 +321,7 @@ CREATE TABLE IF NOT EXISTS `zt_weeklyreport`( REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system','custom','','hourPoint','1'), ('system','custom','','URAndSR','1'), -('system','custom','waterfall','URSRName','{\"URCommon\":{\"zh-cn\":\"\\u7528\\u6237\\u9700\\u6c42\"},\"SRCommon\":{\"zh-cn\":\"\\u8f6f\\u4ef6\\u9700\\u6c42\"}}'), -('system','custom','scrum','URSRName','{\"URCommon\":{\"zh-cn\":\"\\u53f2\\u8bd7\"},\"SRCommon\":{\"zh-cn\":\"\\u6545\\u4e8b\"}}'); +('system','custom','common','URSRName','{"URCommon":{"zh-cn":"\u7528\u6237\u9700\u6c42"},"SRCommon":{"zh-cn":"\u8f6f\u4ef6\u9700\u6c42"}}'); ALTER TABLE `zt_block` ADD `type` char(30) NOT NULL AFTER `module`; ALTER TABLE `zt_block` ADD UNIQUE `account_module_type_order` (`account`, `module`, `type`, `order`), DROP INDEX `accountModuleOrder`; diff --git a/db/zentao.sql b/db/zentao.sql index 0ace818b92..cd71138ae5 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -4055,5 +4055,4 @@ INSERT INTO `zt_stage` (`name`,`percent`,`type`,`createdBy`,`createdDate`,`edite INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system','custom','','hourPoint','1'), ('system','custom','','URAndSR','1'), -('system','custom','waterfall','URSRName','{\"URCommon\":{\"zh-cn\":\"\\u7528\\u6237\\u9700\\u6c42\"},\"SRCommon\":{\"zh-cn\":\"\\u8f6f\\u4ef6\\u9700\\u6c42\"}}'), -('system','custom','scrum','URSRName','{\"URCommon\":{\"zh-cn\":\"\\u53f2\\u8bd7\"},\"SRCommon\":{\"zh-cn\":\"\\u6545\\u4e8b\"}}'); +('system','custom','common','URSRName','{"URCommon":{"zh-cn":"\u7528\u6237\u9700\u6c42"},"SRCommon":{"zh-cn":"\u8f6f\u4ef6\u9700\u6c42"}}'); diff --git a/framework/router.class.php b/framework/router.class.php index 6315b70a11..f2bae43a23 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -154,6 +154,11 @@ class router extends baseRouter $model->model = 'scrum'; if($this->session->PRJ) $model = $this->dbh->query('SELECT model FROM' . TABLE_PROJECT . "WHERE id = {$this->session->PRJ}")->fetch(); + if(isset($model->model) && $model->model == 'waterfall') + { + $projectIndex = 2; + } + foreach($commonSettings as $setting) { if($setting->key == 'productProject') list($productIndex, $projectIndex) = explode('_', $setting->value); @@ -163,21 +168,12 @@ class router extends baseRouter if($setting->key == 'URSRName') { - if(isset($model->model) && $setting->section == $model->model) - { - $URSRName = json_decode($setting->value, true); - if(isset($URSRName['URCommon'][$this->clientLang])) $lang->URCommon = $URSRName['URCommon'][$this->clientLang]; - if(isset($URSRName['SRCommon'][$this->clientLang])) $lang->SRCommon = $URSRName['SRCommon'][$this->clientLang]; - } + $URSRName = json_decode($setting->value, true); + if(isset($URSRName['URCommon'][$this->clientLang])) $lang->URCommon = $URSRName['URCommon'][$this->clientLang]; + if(isset($URSRName['SRCommon'][$this->clientLang])) $lang->SRCommon = $URSRName['SRCommon'][$this->clientLang]; } } - if(isset($model->model) && $model->model == 'waterfall') - { - $projectIndex = 2; - //$planIndex = 1; - } - $config->storyCommon = $storyIndex; $config->URAndSR = $URAndSR; diff --git a/module/custom/control.php b/module/custom/control.php index 33081b4b80..9c8516aa53 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -400,7 +400,7 @@ class custom extends control { if($type == 'concept') { - $this->custom->setURAndSR('waterfall'); + $this->custom->setURAndSR(); } if($type == 'user' and isset($_POST['keys'])) @@ -457,11 +457,11 @@ class custom extends control { $URSRName = $this->dao->select("`value`")->from(TABLE_CONFIG) ->where('module')->eq('custom') - ->andWhere('section')->eq('waterfall') + ->andWhere('section')->eq('common') ->andWhere('`key`')->eq('URSRName') ->fetch('value'); - $this->view->URSRName = json_decode($URSRName); + $this->view->URSRName = json_decode($URSRName); } $this->view->title = $this->lang->custom->common; @@ -487,7 +487,7 @@ class custom extends control if($type == 'concept') { $this->custom->setConcept(); - $this->custom->setURAndSR('scrum'); + $this->custom->setURAndSR(); } if($type == 'user' && isset($_POST['keys'])) @@ -518,11 +518,11 @@ class custom extends control { $URSRName = $this->dao->select("`value`")->from(TABLE_CONFIG) ->where('module')->eq('custom') - ->andWhere('section')->eq('scrum') + ->andWhere('section')->eq('common') ->andWhere('`key`')->eq('URSRName') ->fetch('value'); - $this->view->URSRName = json_decode($URSRName); + $this->view->URSRName = json_decode($URSRName); } if($type == 'user') diff --git a/module/custom/model.php b/module/custom/model.php index b1dad3352c..e997ea0708 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -584,7 +584,7 @@ class customModel extends model * @access public * @return void */ - public function setURAndSR($template = 'waterfall') + public function setURAndSR() { $data = fixer::input('post')->get(); @@ -595,7 +595,7 @@ class customModel extends model $URSRName = isset($this->config->custom->URSRName) ? json_decode($this->config->custom->URSRName, true) : array(); $URSRName['URCommon'][$clientLang] = $data->URCommon[$clientLang]; $URSRName['SRCommon'][$clientLang] = $data->SRCommon[$clientLang]; - $this->setting->setItem("system.custom.$template.URSRName", json_encode($URSRName)); + $this->setting->setItem("system.custom.common.URSRName", json_encode($URSRName)); } }