* [task#150567] Add builtin stage and points for IPD project flow.
This commit is contained in:
@@ -447,6 +447,7 @@ define('TABLE_DEMANDPOOL', '`' . $config->db->prefix . 'demandpool`');
|
||||
define('TABLE_DEMAND', '`' . $config->db->prefix . 'demand`');
|
||||
define('TABLE_DEMANDSPEC', '`' . $config->db->prefix . 'demandspec`');
|
||||
define('TABLE_DEMANDREVIEW', '`' . $config->db->prefix . 'demandreview`');
|
||||
define('TABLE_DECISION', '`' . $config->db->prefix . 'decision`');
|
||||
define('TABLE_API', '`' . $config->db->prefix . 'api`');
|
||||
define('TABLE_API_SPEC', '`' . $config->db->prefix . 'apispec`');
|
||||
define('TABLE_APISTRUCT', '`' . $config->db->prefix . 'apistruct`');
|
||||
|
||||
@@ -1255,6 +1255,7 @@ class projectModel extends model
|
||||
if($project->acl != 'open') $this->loadModel('user')->updateUserView(array($projectID), 'project');
|
||||
|
||||
if(empty($project->multiple) and $project->model != 'waterfall' and $project->model != 'waterfallplus') $this->loadModel('execution')->createDefaultSprint($projectID);
|
||||
if(!empty($project->workflowGroup) && $project->model == 'ipd') $this->loadModel('stage')->addBuiltinPoint($project->workflowGroup);
|
||||
|
||||
return $projectID;
|
||||
}
|
||||
|
||||
@@ -195,4 +195,63 @@ class stageModel extends model
|
||||
{
|
||||
return (float)$this->dao->select('sum(percent) as total')->from(TABLE_STAGE)->where('deleted')->eq('0')->andWhere('workflowGroup')->eq($groupID)->fetch('total');
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加内置评审点。
|
||||
* Add the builtin point.
|
||||
*
|
||||
* @param int $groupID
|
||||
* @return void
|
||||
*/
|
||||
public function addBuiltinPoint(int $groupID)
|
||||
{
|
||||
$workflowGroup = $this->dao->select('*')->from(TABLE_WORKFLOWGROUP)->where('id')->eq($groupID)->fetch();
|
||||
if($workflowGroup->projectModel != 'ipd') return;
|
||||
|
||||
$builtinPoints = $this->dao->select('*')->from(TABLE_DECISION)->where('workflowGroup')->eq($groupID)->andWhere('builtin')->eq('1')->fetchAll();
|
||||
if(!empty($builtinPoints)) return;
|
||||
|
||||
$this->app->loadConfig('review');
|
||||
$this->app->loadConfig('project');
|
||||
$stageList = $this->dao->select('*')->from(TABLE_STAGE)->where('workflowGroup')->eq($groupID)->fetchAll('id');
|
||||
if(empty($stageList))
|
||||
{
|
||||
$stageTypeList = array();
|
||||
if($workflowGroup->projectType == 'ipd') $stageTypeList = $this->config->project->categoryStages['IPD'];
|
||||
if($workflowGroup->projectType == 'tpd') $stageTypeList = $this->config->project->categoryStages['TPD'];
|
||||
if($workflowGroup->projectType == 'cbb') $stageTypeList = $this->config->project->categoryStages['CBB'];
|
||||
if(in_array($workflowGroup->projectType, array('cpdproduct', 'cpdproject'))) $stageTypeList= $this->config->project->categoryStages['CPD'];
|
||||
|
||||
foreach($stageTypeList as $stageType)
|
||||
{
|
||||
$builtinStage = new stdClass();
|
||||
$builtinStage->workflowGroup = $groupID;
|
||||
$builtinStage->createdBy = 'system';
|
||||
$builtinStage->createdDate = helper::now();
|
||||
$builtinStage->name = zget($this->lang->stage->ipdTypeList, $stageType, '');
|
||||
$builtinStage->type = $stageType;
|
||||
$this->dao->insert(TABLE_STAGE)->data($builtinStage)->exec();
|
||||
|
||||
$stageID = $this->dao->lastInsertID();
|
||||
$stageList[$stageID] = $builtinStage;
|
||||
}
|
||||
}
|
||||
|
||||
$decision = new stdClass();
|
||||
$decision->builtin = '1';
|
||||
$decision->createdBy = 'system';
|
||||
$decision->createdDate = helper::now();
|
||||
$decision->workflowGroup = $groupID;
|
||||
foreach($stageList as $id => $stage)
|
||||
{
|
||||
foreach($this->config->review->ipdReviewPoint->{$stage->type} as $point)
|
||||
{
|
||||
$decision->stage = $id;
|
||||
$decision->title = $point;
|
||||
$decision->type = strpos($point, 'TR') !== false ? 'TR' : 'DCP';
|
||||
$decision->category = $point;
|
||||
$this->dao->insert(TABLE_DECISION)->data($decision)->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12517,6 +12517,7 @@ class upgradeModel extends model
|
||||
if(empty($stageGroup)) return true;
|
||||
|
||||
$this->app->loadConfig('project');
|
||||
$this->app->loadConfig('review');
|
||||
$typeCodeGroup = $this->dao->select('projectModel, code, id')->from(TABLE_WORKFLOWGROUP)->where('main')->eq('1')->andWhere('projectModel')->in('waterfall,waterfallplus,ipd')->fetchGroup('projectModel', 'code');
|
||||
foreach($typeCodeGroup as $projectModel => $flowList)
|
||||
{
|
||||
@@ -12532,6 +12533,25 @@ class upgradeModel extends model
|
||||
$stage->workflowGroup = $typeCodeGroup[$projectModel][$flowCode]->id;
|
||||
if(empty($stage->editedDate)) $stage->editedDate = null;
|
||||
$this->dao->insert(TABLE_STAGE)->data($stage)->exec();
|
||||
$stageID = $this->dao->lastInsertID();
|
||||
|
||||
/* 添加IPD项目流程阶段的评审点。*/
|
||||
if($projectModel == 'ipd')
|
||||
{
|
||||
$decision = new stdClass();
|
||||
$decision->builtin = '1';
|
||||
$decision->createdBy = 'system';
|
||||
$decision->createdDate = helper::now();
|
||||
foreach($this->config->review->ipdReviewPoint->{$stage->type} as $point)
|
||||
{
|
||||
$decision->workflowGroup = $stage->workflowGroup;
|
||||
$decision->stage = $stageID;
|
||||
$decision->title = $point;
|
||||
$decision->type = strpos($point, 'TR') !== false ? 'TR' : 'DCP';
|
||||
$decision->category = $point;
|
||||
$this->dao->insert(TABLE_DECISION)->data($decision)->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user