From bc180ce00c1d99e9cc7bee8530f3b30993fd87e9 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Fri, 11 Dec 2020 15:08:04 +0800 Subject: [PATCH] * Adjust code. --- db/update20.0.alpha.sql | 5 +---- db/zentao.sql | 4 +--- module/budget/control.php | 20 ++++++++++---------- module/budget/model.php | 22 +++++++++++----------- module/budget/view/summary.html.php | 8 ++++---- module/doc/model.php | 2 +- module/programplan/model.php | 12 ------------ 7 files changed, 28 insertions(+), 45 deletions(-) diff --git a/db/update20.0.alpha.sql b/db/update20.0.alpha.sql index f29cdf4c9e..0cb26e6052 100644 --- a/db/update20.0.alpha.sql +++ b/db/update20.0.alpha.sql @@ -318,10 +318,7 @@ CREATE TABLE IF NOT EXISTS `zt_weeklyreport`( UNIQUE KEY `week` (`PRJ`,`weekStart`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES -('system','custom','','hourPoint','1'), -('system','custom','','URAndSR','1'), -('system','custom','common','URSRName','{\"URCommon\":{\"zh-cn\":\"\\u7528\\u6237\\u9700\\u6c42\"},\"SRCommon\":{\"zh-cn\":\"\\u8f6f\\u4ef6\\u9700\\u6c42\"}}'); +REPLACE INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES ('system','custom','','hourPoint','1'); 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 6f24f5cc00..391179e74e 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -4101,8 +4101,6 @@ INSERT INTO `zt_lang` (`lang`, `module`, `section`, `key`, `value`, `system`) VA ('zh-cn', 'custom', 'SRList', '3', '故事', '1'), ('zh-cn', 'custom', 'SRList', '4', '故事', '1'); -INSERT INTO `zt_config` (`owner`, `module`, `section`, `key`, `value`) VALUES -('system','custom','','hourPoint','1'), -('system','custom','','URAndSR','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'); diff --git a/module/budget/control.php b/module/budget/control.php index f4fe835c3c..e0b690534c 100644 --- a/module/budget/control.php +++ b/module/budget/control.php @@ -48,7 +48,7 @@ class budget extends control $this->view->orderBy = $orderBy; $this->view->pager = $pager; $this->view->modules = $this->loadModel('tree')->getOptionMenu(0, 'subject'); - $this->view->stages = $this->loadModel('programplan')->getPlanPairsForBudget($this->session->PRJ); + $this->view->stages = $this->loadModel('project')->getExecutionsByProject($this->session->PRJ, 'all', 0, true); $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); $this->display(); } @@ -67,11 +67,11 @@ class budget extends control $this->view->position[] = $this->lang->budget->common; $this->view->position[] = $this->lang->budget->summary; - $this->view->subjects = $subjects; - $this->view->subSubject = $this->budget->getSubSubject($subjects); - $this->view->plans = $this->loadModel('programplan')->getPlanPairsForBudget($this->session->PRJ); - $this->view->summary = $this->budget->getSummary($this->session->PRJ, $subjects); - $this->view->modules = $this->loadModel('tree')->getOptionMenu(0, $viewType = 'subject', $startModuleID = 0); + $this->view->subjects = $subjects; + $this->view->hasSubSubject = $this->budget->checkSubSubject($subjects); + $this->view->plans = $this->loadModel('project')->getExecutionsByProject($this->session->PRJ, 'all', 0, true); + $this->view->summary = $this->budget->getSummary($this->session->PRJ, $subjects); + $this->view->modules = $this->loadModel('tree')->getOptionMenu(0, $viewType = 'subject', $startModuleID = 0); $this->display(); } @@ -103,7 +103,7 @@ class budget extends control $this->view->position[] = $this->lang->budget->create; $this->view->subjects = array(0 => '') + $this->budget->getSubjectOption(); - $this->view->plans = $this->loadModel('programplan')->getPlanPairsForBudget($this->session->PRJ); + $this->view->plans = $this->loadModel('project')->getExecutionsByProject($this->session->PRJ, 'all', 0, true); $this->display(); } @@ -140,7 +140,7 @@ class budget extends control $this->view->position[] = $this->lang->budget->edit; $this->view->subjects = array('' => '') + $this->budget->getSubjectOption(); - $this->view->plans = $this->loadModel('programplan')->getPlanPairsForBudget($this->session->PRJ); + $this->view->plans = $this->loadModel('project')->getExecutionsByProject($this->session->PRJ, 'all', 0, true); $this->view->budget = $this->budget->getByID($budgetID); $this->display(); } @@ -159,7 +159,7 @@ class budget extends control $this->view->position[] = $this->lang->budget->view; $this->view->subjects = $this->budget->getSubjectOption(); - $this->view->plans = $this->loadModel('programplan')->getPlanPairsForBudget($this->session->PRJ); + $this->view->plans = $this->loadModel('project')->getExecutionsByProject($this->session->PRJ, 'all', 0, true); $this->view->budget = $this->budget->getByID($budgetID); $this->view->actions = $this->loadModel('action')->getList('budget', $budgetID); $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); @@ -215,7 +215,7 @@ class budget extends control $this->view->position[] = $this->lang->budget->batchCreate; $this->view->subjects = array('' => '') + $this->budget->getSubjectOption(); - $this->view->plans = $this->loadModel('programplan')->getPlanPairsForBudget($this->session->PRJ); + $this->view->plans = $this->loadModel('project')->getExecutionsByProject($this->session->PRJ, 'all', 0, true); $this->display(); } } diff --git a/module/budget/model.php b/module/budget/model.php index 858d2ce026..9fb288708a 100644 --- a/module/budget/model.php +++ b/module/budget/model.php @@ -81,7 +81,7 @@ class budgetModel extends model * @access public * @return array */ - public function getSubjects($projectID) + public function getSubjectPairs($projectID) { return $this->dao->select('subject')->from(TABLE_BUDGET)->where('PRJ')->eq($projectID)->andWhere('deleted')->eq(0)->orderBy('subject_asc')->fetchPairs(); } @@ -96,12 +96,12 @@ class budgetModel extends model { $this->loadModel('tree'); - $structure = array(); - $subjects = $this->getSubjects($this->session->PRJ); + $structure = array(); + $subjectPairs = $this->getSubjectPairs($this->session->PRJ); + $subjects = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->in($subjectPairs)->fetchAll('id'); - foreach($subjects as $subjectID) + foreach($subjects as $subject) { - $subject = $this->tree->getById($subjectID); if($subject->grade == 1) { $structure[$subject->id][] = $subject->id; @@ -115,17 +115,17 @@ class budgetModel extends model } /** - * Existence of sub-subjects. + * Check if has sub-subjects. * * @param array $subjects * @access public * @return bool */ - public function getSubSubject($subjects) + public function checkSubSubject($subjects) { foreach($subjects as $id => $subject) { - if($subject[0] != $id) return true; + if(count($subject) > 1 || $id != $subject[0]) return true; } return false; @@ -147,14 +147,14 @@ class budgetModel extends model /* Assign each subject to a stage. */ $summary['stages'] = array(); $summary['subjects'] = array(); - foreach($stages as $stage) + foreach($stages as $stageID) { foreach($subjects as $subject) { foreach($subject as $children) { - $summary['stages'][$stage][$children] = 0; - $summary['subjects'][$children] = 0; + $summary['stages'][$stageID][$children] = 0; + $summary['subjects'][$children] = 0; } } } diff --git a/module/budget/view/summary.html.php b/module/budget/view/summary.html.php index ec68631338..d8c8057851 100644 --- a/module/budget/view/summary.html.php +++ b/module/budget/view/summary.html.php @@ -32,15 +32,15 @@ - + $subject):?> - + - - + $subject):?> + diff --git a/module/doc/model.php b/module/doc/model.php index f32bd4ce88..6a70e92f01 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1307,7 +1307,7 @@ class docModel extends model $searchTitle = $this->get->title; if($type == 'product') { - $storyIdList = $this->dao->select('id')->from(TABLE_STORY)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($this->app->user->view->products)->andWhere('type')->in('story,requirement')->get(); + $storyIdList = $this->dao->select('id')->from(TABLE_STORY)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($this->app->user->view->products)->get(); $bugIdList = $this->dao->select('id')->from(TABLE_BUG)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($this->app->user->view->products)->get(); $releaseIdList = $this->dao->select('id')->from(TABLE_RELEASE)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($this->app->user->view->products)->get(); $planIdList = $this->dao->select('id')->from(TABLE_PRODUCTPLAN)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($this->app->user->view->products)->get(); diff --git a/module/programplan/model.php b/module/programplan/model.php index ea6e9f71e0..5e2c0a317b 100644 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -85,18 +85,6 @@ class programplanModel extends model return $this->processPlans($plans); } - /** - * Get plan pairs for budget. - * - * @param int $programID - * @access public - * @return array - */ - public function getPlanPairsForBudget($programID = 0) - { - return $this->loadModel('project')->getExecutionsByProject($programID, 'all', 0, true); - } - /** * Get plans. *
budget->subject . '/' . $lang->budget->stage;?>budget->subject . '/' . $lang->budget->stage;?> budget->summary;?>budget->summary;?>