* Adjust code.

This commit is contained in:
Yagami
2020-12-11 16:03:17 +08:00
parent 894da720a3
commit bc180ce00c
7 changed files with 28 additions and 45 deletions
+1 -4
View File
@@ -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`;
+1 -3
View File
@@ -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');
+10 -10
View File
@@ -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();
}
}
+11 -11
View File
@@ -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;
}
}
}
+4 -4
View File
@@ -32,15 +32,15 @@
<?php if(!empty($subjects)):?>
<table class='table table-bordered'>
<tr class='text-center table-title'>
<th rowspan="<?php echo $subSubject ? 2 : 1;?>"><?php echo $lang->budget->subject . '/' . $lang->budget->stage;?></th>
<th rowspan="<?php echo $hasSubSubject ? 2 : 1;?>"><?php echo $lang->budget->subject . '/' . $lang->budget->stage;?></th>
<?php foreach($subjects as $id => $subject):?>
<th colspan="<?php echo count($subject);?>"><?php echo zget($modules, $id);?></th>
<?php endforeach;?>
<th rowspan="<?php echo $subSubject ? 2 : 1;?>"><?php echo $lang->budget->summary;?></th>
<th rowspan="<?php echo $hasSubSubject ? 2 : 1;?>"><?php echo $lang->budget->summary;?></th>
</tr>
<tr class='text-center table-title'>
<?php foreach($subjects as $subject):?>
<?php if($id == $subject[0] && !$subSubject) continue;?>
<?php foreach($subjects as $id => $subject):?>
<?php if($id == $subject[0] && !$hasSubSubject) continue;?>
<?php foreach($subject as $subjectID):?>
<th><?php echo zget($modules, $subjectID);?></th>
<?php endforeach;?>
+1 -1
View File
@@ -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();
-12
View File
@@ -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.
*