From 2b85fd21f4870a796c59123e9e1a30429210bdb3 Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Thu, 4 Mar 2021 15:07:28 +0800 Subject: [PATCH] * Adjust the common module. --- db/update15.0.sql | 2 + db/zentao.sql | 6 +-- module/common/model.php | 59 +++++++++++------------ module/common/view/datatable.fix.html.php | 2 +- module/common/view/header.html.php | 2 +- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/db/update15.0.sql b/db/update15.0.sql index 979d915174..e05c76f15c 100644 --- a/db/update15.0.sql +++ b/db/update15.0.sql @@ -72,6 +72,8 @@ REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ( ALTER TABLE `zt_config` MODIFY COLUMN `value` longtext NOT NULL AFTER `key`; +UPDATE `zt_config` SET `key` = 'CRExecution' WHERE `module` = 'common' AND `key` = 'CRProject'; + -- DROP TABLE IF EXISTS `zt_stakeholder`; CREATE TABLE IF NOT EXISTS `zt_stakeholder` ( `id` mediumint(8) NOT NULL AUTO_INCREMENT PRIMARY KEY, diff --git a/db/zentao.sql b/db/zentao.sql index 3c97839d0d..987fe80b2f 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -4130,9 +4130,9 @@ INSERT INTO `zt_lang` (`lang`, `module`, `section`, `key`, `value`, `system`) VA ('zh-cn', 'custom', 'URSRList', '3', '{\"SRName\":\"\\u6545\\u4e8b\",\"URName\":\"\\u9700\\u6c42\"}', '1'), ('zh-cn', 'custom', 'URSRList', '4', '{\"SRName\":\"\\u6545\\u4e8b\",\"URName\":\"\\u53f2\\u8bd7\"}', '1'); -INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'hourPoint', '1'); -INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRProduct', '1'); -INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRProject', '1'); +INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'hourPoint', '1'); +INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRProduct', '1'); +INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'common', '', 'CRExecution', '1'); INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'custom', '', 'URSR', '3'); INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'program', '', 'unitList', 'CNY,USD'); INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system', 'program', '', 'defaultCurrency', 'CNY'); diff --git a/module/common/model.php b/module/common/model.php index 923954bc3b..2fe896a978 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -392,7 +392,7 @@ class commonModel extends model { if($group == 'program') { - $link = helper::createLink($menuItem->link['module'], $menuItem->link['method'], $vars, '', '', $app->session->PRJ); + $link = helper::createLink($menuItem->link['module'], $menuItem->link['method'], $vars, '', '', $app->session->project); } elseif($group == 'product' && $menuItem->name == 'doc') { @@ -472,7 +472,7 @@ class commonModel extends model if(isset($lang->$model->subMenu->$key)) { $programSubMenu = $lang->$model->subMenu->$key; - $subMenu = common::createSubMenu($programSubMenu, $app->session->PRJ); + $subMenu = common::createSubMenu($programSubMenu, $app->session->project); if(!empty($subMenu)) { @@ -748,9 +748,8 @@ class commonModel extends model foreach ($lang->searchObjects as $key => $value) { $class = $key == $searchObject ? "class='selected'" : ''; - if($key == 'program') $key = 'program-pgmproduct'; - if($key == 'project') $key = 'program-index'; - if($key == 'execution') $key = 'project-view'; + if($key == 'program') $key = 'program-product'; + if($key == 'project') $key = 'project-index'; if($key == 'deploystep') $key = 'deploy-viewstep'; echo "
  • {$value}
  • "; @@ -1170,7 +1169,7 @@ EOD; if(strtolower($module) == 'story' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create'); if(strtolower($module) == 'bug' and strtolower($method) == 'tostory') ($module = 'story') and ($method = 'create'); if(strtolower($module) == 'bug' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create'); - if($config->systemMode == 'classic' and strtolower($module) == 'program' and strpos($method, 'PRJ') === 0) ($module = 'project') and ($method = substr(strtolower($method), 3)); + if($config->systemMode == 'classic' and strtolower($module) == 'project') $method = substr(strtolower($method), 3); if(!commonModel::hasPriv($module, $method, $object)) return false; $link = helper::createLink($module, $method, $vars, '', $onlyBody, $programID); @@ -1728,7 +1727,7 @@ EOD; if(!defined('IN_UPGRADE') and $inProject) { /* Check program priv. */ - if($this->session->PRJ and strpos(",{$this->app->user->view->projects},", ",{$this->session->PRJ},") === false and !$this->app->user->admin) $this->loadModel('program')->accessDenied(); + if($this->session->project and strpos(",{$this->app->user->view->projects},", ",{$this->session->project},") === false and !$this->app->user->admin) $this->loadModel('program')->accessDenied(); $this->resetProgramPriv($module, $method); if(!commonModel::hasPriv($module, $method)) $this->deny($module, $method, false); } @@ -1769,7 +1768,7 @@ EOD; /* If is the program admin, have all program privs. */ $inProject = isset($lang->navGroup->$module) && $lang->navGroup->$module == 'project'; if($module == 'program' && strpos($method, 'prj') !== false) $inProject = true; - if($inProject && $app->session->PRJ && strpos(",{$app->user->rights['projects']},", ",{$app->session->PRJ},") !== false) return true; + if($inProject && $app->session->project && strpos(",{$app->user->rights['projects']},", ",{$app->session->project},") !== false) return true; /* If not super admin, check the rights. */ $rights = $app->user->rights['rights']; @@ -1809,8 +1808,8 @@ EOD; public function resetProgramPriv($module, $method) { /* Get user program priv. */ - if(!$this->app->session->PRJ) return; - $program = $this->dao->findByID($this->app->session->PRJ)->from(TABLE_PROJECT)->fetch(); + if(!$this->app->session->project) return; + $program = $this->dao->findByID($this->app->session->project)->from(TABLE_PROJECT)->fetch(); $programRights = $this->dao->select('t3.module, t3.method')->from(TABLE_GROUP)->alias('t1') ->leftJoin(TABLE_USERGROUP)->alias('t2')->on('t1.id = t2.group') ->leftJoin(TABLE_GROUPPRIV)->alias('t3')->on('t2.group=t3.group') @@ -1856,20 +1855,20 @@ EOD; if($module == 'todo' and ($method == 'create' or $method == 'batchcreate')) return true; if($module == 'effort' and ($method == 'batchcreate' or $method == 'createforobject')) return true; - /* Limited project. */ - $limitedProject = false; - if(!empty($module) && $module == 'task' && !empty($object->project) or - !empty($module) && $module == 'project' && !empty($object->id) + /* Limited execution. */ + $limitedExecution = false; + if(!empty($module) && $module == 'task' && !empty($object->execution) or + !empty($module) && $module == 'execution' && !empty($object->id) ) { $objectID = ''; - if($module == 'project' and !empty($object->id)) $objectID = $object->id; - if($module == 'task' and !empty($object->project))$objectID = $object->project; + if($module == 'execution' and !empty($object->id)) $objectID = $object->id; + if($module == 'task' and !empty($object->execution))$objectID = $object->execution; - $limitedProjects = !empty($_SESSION['limitedProjects']) ? $_SESSION['limitedProjects'] : ''; - if($objectID and strpos(",{$limitedProjects},", ",$objectID,") !== false) $limitedProject = true; + $limitedExecutions = !empty($_SESSION['limitedExecutions']) ? $_SESSION['limitedExecutions'] : ''; + if($objectID and strpos(",{$limitedExecutions},", ",$objectID,") !== false) $limitedExecution = true; } - if(empty($app->user->rights['rights']['my']['limited']) && !$limitedProject) return true; + if(empty($app->user->rights['rights']['my']['limited']) && !$limitedExecution) return true; if(!empty($method) && strpos($method, 'batch') === 0) return false; if(!empty($method) && strpos($method, 'link') === 0) return false; @@ -2177,12 +2176,12 @@ EOD; if($product->status == 'closed') return false; } - /* Check the project is closed. */ + /* Check the execution is closed. */ $productModuleList = array('story', 'bug', 'testtask'); - if(!in_array($module, $productModuleList) and !empty($object->project) and is_numeric($object->project) and empty($config->CRProject)) + if(!in_array($module, $productModuleList) and !empty($object->execution) and is_numeric($object->execution) and empty($config->CRExecution)) { - $project = $app->control->loadModel('project')->getByID($object->project); - if($project->status == 'closed') return false; + $execution = $app->control->loadModel('execution')->getByID($object->execution); + if($execution->status == 'closed') return false; } return true; @@ -2191,7 +2190,7 @@ EOD; /** * Check object can modify. * - * @param string $type product|project + * @param string $type product|Execution * @param object $object * @static * @access public @@ -2201,8 +2200,8 @@ EOD; { global $config; - if($type == 'product' and empty($config->CRProduct) and $object->status == 'closed') return false; - if($type == 'project' and empty($config->CRProject) and $object->status == 'closed') return false; + if($type == 'product' and empty($config->CRProduct) and $object->status == 'closed') return false; + if($type == 'execution' and empty($config->CRExecution) and $object->status == 'closed') return false; return true; } @@ -2382,8 +2381,8 @@ EOD; $link = is_array($setting) ? $setting['link'] : $setting; if(strpos($link, "{PRODUCT}") !== false) $link = str_replace('{PRODUCT}', $app->session->product, $link); - if(strpos($link, "{EXECUTION}") !== false) $link = str_replace('{EXECUTION}', $app->session->project, $link); - if(strpos($link, "{PROJECT}") !== false) $link = str_replace('{PROJECT}', $app->session->PRJ, $link); + if(strpos($link, "{EXECUTION}") !== false) $link = str_replace('{EXECUTION}', $app->session->execution, $link); + if(strpos($link, "{PROJECT}") !== false) $link = str_replace('{PROJECT}', $app->session->project, $link); if(is_array($setting)) { @@ -2411,7 +2410,7 @@ EOD; public static function getProgramMainMenu($moduleName) { global $app, $lang, $dbh, $config; - $program = $dbh->query("SELECT * FROM " . TABLE_PROGRAM . " WHERE `id` = '{$app->session->PRJ}'")->fetch(); + $program = $dbh->query("SELECT * FROM " . TABLE_PROGRAM . " WHERE `id` = '{$app->session->project}'")->fetch(); if(empty($program)) return; self::initProgramSubmenu(); @@ -2446,7 +2445,7 @@ EOD; public static function getProgramModuleMenu($moduleName, $methodName) { global $app, $lang, $dbh; - $program = $dbh->query("SELECT * FROM " . TABLE_PROJECT . " WHERE `id` = '{$app->session->PRJ}'")->fetch(); + $program = $dbh->query("SELECT * FROM " . TABLE_PROJECT . " WHERE `id` = '{$app->session->project}'")->fetch(); if(empty($program)) return; if($program->model == 'waterfall') { diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php index ae9bf2b79a..95a77574d5 100644 --- a/module/common/view/datatable.fix.html.php +++ b/module/common/view/datatable.fix.html.php @@ -81,7 +81,7 @@ $(function() datatable->showModule;?> datatable->showModuleList, isset($config->datatable->$datatableId->showModule) ? $config->datatable->$datatableId->showModule : '');?> - moduleName == 'project' && $app->methodName == 'task'):?> + moduleName == 'execution' && $app->methodName == 'task'):?> datatable->showAllModule;?> datatable->showAllModuleList, isset($config->project->task->allModule) ? $config->project->task->allModule : 0);?> diff --git a/module/common/view/header.html.php b/module/common/view/header.html.php index a86181b8fd..7b1ea13f6b 100755 --- a/module/common/view/header.html.php +++ b/module/common/view/header.html.php @@ -23,7 +23,7 @@ $isQa = $rawModule == 'qa'; qa->switcherMenu) ? $lang->qa->switcherMenu : '';?> config->systemMode == 'new'):?> program->switcherMenu) ? $lang->program->switcherMenu : '';?> - loadModel('project')->getSwitcher($this->session->PRJ, $app->rawModule, $app->rawMethod);?> + loadModel('project')->getSwitcher($this->session->project, $app->rawModule, $app->rawMethod);?> config->systemMode == 'classic'):?> project->switcherMenu) ? $lang->project->switcherMenu : '';;?>