Merge branch 'zentaopms_284' of https://gitlab.zcorp.cc/easycorp/zentaopms into zentaopms_284
This commit is contained in:
@@ -72,7 +72,7 @@ class build extends control
|
||||
if($this->app->tab == 'project')
|
||||
{
|
||||
$this->project->setMenu($projectID);
|
||||
$executions = $this->execution->getPairs($projectID, 'all', 'stagefilter');
|
||||
$executions = $this->execution->getPairs($projectID, 'all', 'stagefilter|leaf');
|
||||
$executionID = empty($executionID) ? key($executions) : $executionID;
|
||||
$productGroups = $executionID ? $this->product->getProducts($executionID) : array();
|
||||
$branchGroups = $executionID ? $this->project->getBranchesByProject($executionID) : array();
|
||||
@@ -81,7 +81,7 @@ class build extends control
|
||||
elseif($this->app->tab == 'execution')
|
||||
{
|
||||
$execution = $this->execution->getByID($executionID);
|
||||
$executions = $this->execution->getPairs($execution->project);
|
||||
$executions = $this->execution->getPairs($execution->project, 'all', 'stagefilter|leaf');
|
||||
$projectID = $execution->project;
|
||||
$productGroups = $this->product->getProducts($executionID);
|
||||
$branchGroups = $this->project->getBranchesByProject($executionID);
|
||||
@@ -92,7 +92,7 @@ class build extends control
|
||||
{
|
||||
$execution = $this->execution->getByID($executionID);
|
||||
$projectID = $execution ? $execution->project : 0;
|
||||
$executions = $this->execution->getPairs($projectID);
|
||||
$executions = $this->execution->getPairs($projectID, 'all', 'stagefilter|leaf');
|
||||
$productGroups = $this->product->getProducts($executionID);
|
||||
$branchGroups = $this->project->getBranchesByProject($executionID);
|
||||
}
|
||||
|
||||
+16
-1
@@ -158,6 +158,12 @@ class doc extends control
|
||||
{
|
||||
if($execution->multiple)
|
||||
{
|
||||
if($execution->type == 'stage' and $execution->grade > 1)
|
||||
{
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$execution->name = implode('/', $parentExecutions);
|
||||
}
|
||||
|
||||
$executionPrefix = isset($projects[$execution->project]) ? $projects[$execution->project] . '/' : '';
|
||||
$executions[$executionID] = $executionPrefix . $execution->name;
|
||||
}
|
||||
@@ -240,7 +246,16 @@ class doc extends control
|
||||
if(!empty($lib->execution))
|
||||
{
|
||||
$execution = $this->execution->getByID($lib->execution);
|
||||
if($execution->type == 'stage') $this->lang->doc->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->execution);
|
||||
if($execution->type == 'stage')
|
||||
{
|
||||
if($execution->grade > 1)
|
||||
{
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$execution->name = implode('/', $parentExecutions);
|
||||
}
|
||||
|
||||
$this->lang->doc->execution = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->doc->execution);
|
||||
}
|
||||
|
||||
$this->view->execution = $execution;
|
||||
}
|
||||
|
||||
@@ -1580,6 +1580,11 @@ class docModel extends model
|
||||
$orderedExecutions = array();
|
||||
foreach($executions as $id => $execution)
|
||||
{
|
||||
if($execution->type == 'stage' and $execution->grade != 1)
|
||||
{
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$execution->name = implode('/', $parentExecutions);
|
||||
}
|
||||
$execution->name = zget($projectPairs, $execution->project) . ' / ' . $execution->name;
|
||||
|
||||
if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM == $this->app->user->account)
|
||||
|
||||
@@ -1809,6 +1809,8 @@ class execution extends control
|
||||
$comment = $project->hasProduct ? join(',', $_POST['products']) : '';
|
||||
$this->loadModel('action')->create($this->objectType, $executionID, 'opened', '', $comment);
|
||||
|
||||
$this->loadModel('programplan')->computeProgress($executionID, 'create');
|
||||
|
||||
$message = $this->executeHooks($executionID);
|
||||
if($message) $this->lang->saveSuccess = $message;
|
||||
|
||||
@@ -2233,6 +2235,8 @@ class execution extends control
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'start');
|
||||
|
||||
$this->loadModel('common')->syncPPEStatus($executionID);
|
||||
$this->executeHooks($executionID);
|
||||
if(isonlybody() and $from == 'kanban')
|
||||
@@ -2322,6 +2326,9 @@ class execution extends control
|
||||
$actionID = $this->action->create($this->objectType, $executionID, 'Suspended', $this->post->comment);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'suspend');
|
||||
|
||||
$this->executeHooks($executionID);
|
||||
if(isonlybody() and $from == 'kanban')
|
||||
{
|
||||
@@ -2360,6 +2367,8 @@ class execution extends control
|
||||
$this->execution->activate($executionID);
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
|
||||
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'activate');
|
||||
|
||||
$this->executeHooks($executionID);
|
||||
if(isonlybody() and $from == 'kanban')
|
||||
{
|
||||
@@ -2406,6 +2415,8 @@ class execution extends control
|
||||
$this->execution->close($executionID);
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
|
||||
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID, 'close');
|
||||
|
||||
$this->executeHooks($executionID);
|
||||
if(isonlybody() and $from == 'kanban')
|
||||
{
|
||||
@@ -3078,6 +3089,8 @@ class execution extends control
|
||||
$this->execution->updateUserView($executionID);
|
||||
$this->loadModel('common')->syncPPEStatus($executionID);
|
||||
|
||||
if($execution->type == 'stage') $this->loadModel('programplan')->computeProgress($executionID);
|
||||
|
||||
$this->session->set('execution', '');
|
||||
$message = $this->executeHooks($executionID);
|
||||
if($message) $this->lang->saveSuccess = $message;
|
||||
|
||||
@@ -547,11 +547,29 @@ $lang->execution->action->startbychildactivate = '$date, activating the sub stag
|
||||
$lang->execution->action->waitbychilddelete = '$date, deleting the sub stage sets the execution status as waitting.' . "\n";
|
||||
$lang->execution->action->closebychilddelete = '$date, deleting the sub stage sets the execution status as closing.' . "\n";
|
||||
$lang->execution->action->closebychildclose = '$date, closing the sub stage sets the execution status as closing.' . "\n";
|
||||
$lang->execution->action->waitbychild = '$date, the stage status is <strong>Wait</strong> as the system judges that all its sub-stages statuses are <strong>Wait</strong>.';
|
||||
$lang->execution->action->suspendedbychild = '$date, the stage status is <strong>Suspended</strong> as the system judges that all its sub-stages statuses are <strong>Suspended</strong>.';
|
||||
$lang->execution->action->closedbychild = '$date, the stage status is <strong>Closed</strong> as the system judges that all its sub-stages are <strong>Closed</strong>.';
|
||||
$lang->execution->action->startbychildstart = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Started</strong>.';
|
||||
$lang->execution->action->startbychildactivate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
|
||||
$lang->execution->action->startbychildsuspend = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Suspended</strong>.';
|
||||
$lang->execution->action->startbychildclose = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Closed</strong>.';
|
||||
$lang->execution->action->startbychildcreate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Created</strong>. ';
|
||||
$lang->execution->action->startbychild = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
|
||||
|
||||
$lang->execution->startbychildactivate = 'activated';
|
||||
$lang->execution->waitbychilddelete = 'stop';
|
||||
$lang->execution->closebychilddelete = 'closed';
|
||||
$lang->execution->closebychildclose = 'closed';
|
||||
$lang->execution->waitbychild = 'activated';
|
||||
$lang->execution->suspendedbychild = 'suspended';
|
||||
$lang->execution->closedbychild = 'closed';
|
||||
$lang->execution->startbychildstart = 'started';
|
||||
$lang->execution->startbychildactivate = 'activated';
|
||||
$lang->execution->startbychildsuspend = 'activated';
|
||||
$lang->execution->startbychildclose = 'activated';
|
||||
$lang->execution->startbychildcreate = 'activated';
|
||||
$lang->execution->startbychild = 'activated';
|
||||
|
||||
$lang->execution->statusColorList = array();
|
||||
$lang->execution->statusColorList['wait'] = '#0991FF';
|
||||
|
||||
@@ -547,11 +547,29 @@ $lang->execution->action->startbychildactivate = '$date, activating the sub stag
|
||||
$lang->execution->action->waitbychilddelete = '$date, deleting the sub stage sets the execution status as waitting.' . "\n";
|
||||
$lang->execution->action->closebychilddelete = '$date, deleting the sub stage sets the execution status as closing.' . "\n";
|
||||
$lang->execution->action->closebychildclose = '$date, closing the sub stage sets the execution status as closing.' . "\n";
|
||||
$lang->execution->action->waitbychild = '$date, the stage status is <strong>Wait</strong> as the system judges that all its sub-stages statuses are <strong>Wait</strong>.';
|
||||
$lang->execution->action->suspendedbychild = '$date, the stage status is <strong>Suspended</strong> as the system judges that all its sub-stages statuses are <strong>Suspended</strong>.';
|
||||
$lang->execution->action->closedbychild = '$date, the stage status is <strong>Closed</strong> as the system judges that all its sub-stages are <strong>Closed</strong>.';
|
||||
$lang->execution->action->startbychildstart = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Started</strong>.';
|
||||
$lang->execution->action->startbychildactivate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
|
||||
$lang->execution->action->startbychildsuspend = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Suspended</strong>.';
|
||||
$lang->execution->action->startbychildclose = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Closed</strong>.';
|
||||
$lang->execution->action->startbychildcreate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Created</strong>. ';
|
||||
$lang->execution->action->startbychild = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
|
||||
|
||||
$lang->execution->startbychildactivate = 'activated';
|
||||
$lang->execution->waitbychilddelete = 'stop';
|
||||
$lang->execution->closebychilddelete = 'closed';
|
||||
$lang->execution->closebychildclose = 'closed';
|
||||
$lang->execution->waitbychild = 'activated';
|
||||
$lang->execution->suspendedbychild = 'suspended';
|
||||
$lang->execution->closedbychild = 'closed';
|
||||
$lang->execution->startbychildstart = 'started';
|
||||
$lang->execution->startbychildactivate = 'activated';
|
||||
$lang->execution->startbychildsuspend = 'activated';
|
||||
$lang->execution->startbychildclose = 'activated';
|
||||
$lang->execution->startbychildcreate = 'activated';
|
||||
$lang->execution->startbychild = 'activated';
|
||||
|
||||
$lang->execution->statusColorList = array();
|
||||
$lang->execution->statusColorList['wait'] = '#0991FF';
|
||||
|
||||
@@ -547,11 +547,29 @@ $lang->execution->action->startbychildactivate = '$date, activating the sub stag
|
||||
$lang->execution->action->waitbychilddelete = '$date, deleting the sub stage sets the execution status as waitting.' . "\n";
|
||||
$lang->execution->action->closebychilddelete = '$date, deleting the sub stage sets the execution status as closing.' . "\n";
|
||||
$lang->execution->action->closebychildclose = '$date, closing the sub stage sets the execution status as closing.' . "\n";
|
||||
$lang->execution->action->waitbychild = '$date, the stage status is <strong>Wait</strong> as the system judges that all its sub-stages statuses are <strong>Wait</strong>.';
|
||||
$lang->execution->action->suspendedbychild = '$date, the stage status is <strong>Suspended</strong> as the system judges that all its sub-stages statuses are <strong>Suspended</strong>.';
|
||||
$lang->execution->action->closedbychild = '$date, the stage status is <strong>Closed</strong> as the system judges that all its sub-stages are <strong>Closed</strong>.';
|
||||
$lang->execution->action->startbychildstart = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Started</strong>.';
|
||||
$lang->execution->action->startbychildactivate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
|
||||
$lang->execution->action->startbychildsuspend = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Suspended</strong>.';
|
||||
$lang->execution->action->startbychildclose = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Closed</strong>.';
|
||||
$lang->execution->action->startbychildcreate = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Created</strong>. ';
|
||||
$lang->execution->action->startbychild = '$date, the stage status is <strong>Doing</strong> as the system judges that its sub-stages are <strong>Activated</strong>.';
|
||||
|
||||
$lang->execution->startbychildactivate = 'activated';
|
||||
$lang->execution->waitbychilddelete = 'stop';
|
||||
$lang->execution->closebychilddelete = 'closed';
|
||||
$lang->execution->closebychildclose = 'closed';
|
||||
$lang->execution->waitbychild = 'activated';
|
||||
$lang->execution->suspendedbychild = 'suspended';
|
||||
$lang->execution->closedbychild = 'closed';
|
||||
$lang->execution->startbychildstart = 'started';
|
||||
$lang->execution->startbychildactivate = 'activated';
|
||||
$lang->execution->startbychildsuspend = 'activated';
|
||||
$lang->execution->startbychildclose = 'activated';
|
||||
$lang->execution->startbychildcreate = 'activated';
|
||||
$lang->execution->startbychild = 'activated';
|
||||
|
||||
$lang->execution->statusColorList = array();
|
||||
$lang->execution->statusColorList['wait'] = '#0991FF';
|
||||
|
||||
@@ -547,11 +547,30 @@ $lang->execution->action->startbychildactivate = '$date, 系统判断由于子
|
||||
$lang->execution->action->waitbychilddelete = '$date, 系统判断由于子阶段删除,将' . $lang->executionCommon . '状态置为未开始。' . "\n";
|
||||
$lang->execution->action->closebychilddelete = '$date, 系统判断由于子阶段删除,将' . $lang->executionCommon . '状态置为已关闭。' . "\n";
|
||||
$lang->execution->action->closebychildclose = '$date, 系统判断由于子阶段关闭,将' . $lang->executionCommon . '状态置为已关闭。' . "\n";
|
||||
$lang->execution->action->waitbychild = '$date, 系统判断由于子阶段 <strong>全部为未开始</strong> ,将阶段状态置为 <strong>未开始</strong> 。';
|
||||
$lang->execution->action->suspendedbychild = '$date, 系统判断由于子阶段 <strong>全部挂起</strong> ,将阶段状态置为 <strong>已挂起</strong> 。';
|
||||
$lang->execution->action->closedbychild = '$date, 系统判断由于子阶段 <strong>全部关闭</strong> ,将阶段状态置为 <strong>已关闭</strong> 。';
|
||||
$lang->execution->action->startbychildstart = '$date, 系统判断由于子阶段 <strong>开始</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
|
||||
$lang->execution->action->startbychildactivate = '$date, 系统判断由于子阶段 <strong>激活</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
|
||||
$lang->execution->action->startbychildsuspend = '$date, 系统判断由于子阶段 <strong>挂起</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
|
||||
$lang->execution->action->startbychildclose = '$date, 系统判断由于子阶段 <strong>关闭</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
|
||||
$lang->execution->action->startbychildcreate = '$date, 系统判断由于 <strong>创建</strong> 子阶段 ,将阶段状态置为 <strong>进行中</strong> 。';
|
||||
$lang->execution->action->startbychild = '$date, 系统判断由于子阶段 <strong>激活</strong> ,将阶段状态置为 <strong>进行中</strong> 。';
|
||||
|
||||
|
||||
$lang->execution->startbychildactivate = '激活了';
|
||||
$lang->execution->waitbychilddelete = '停止了';
|
||||
$lang->execution->closebychilddelete = '关闭了';
|
||||
$lang->execution->closebychildclose = '关闭了';
|
||||
$lang->execution->waitbychild = '激活了';
|
||||
$lang->execution->suspendedbychild = '挂起了';
|
||||
$lang->execution->closedbychild = '关闭了';
|
||||
$lang->execution->startbychildstart = '开始了';
|
||||
$lang->execution->startbychildactivate = '激活了';
|
||||
$lang->execution->startbychildsuspend = '激活了';
|
||||
$lang->execution->startbychildclose = '激活了';
|
||||
$lang->execution->startbychildcreate = '激活了';
|
||||
$lang->execution->startbychild = '激活了';
|
||||
|
||||
$lang->execution->statusColorList = array();
|
||||
$lang->execution->statusColorList['wait'] = '#0991FF';
|
||||
|
||||
+25
-34
@@ -1078,17 +1078,6 @@ class executionModel extends model
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
/* Update the status of the parent stage. */
|
||||
if($oldExecution->type == 'stage')
|
||||
{
|
||||
$parent = $this->getByID($oldExecution->parent);
|
||||
if($parent->type == 'stage' and in_array($parent->status, array('closed', 'wait')))
|
||||
{
|
||||
$this->dao->update(TABLE_EXECUTION)->set('status')->eq('doing')->where('id')->eq($parent->id)->exec();
|
||||
$this->loadModel('action')->create('execution', $parent->id, 'startbychildactivate');
|
||||
}
|
||||
}
|
||||
|
||||
return $changes;
|
||||
}
|
||||
|
||||
@@ -1141,27 +1130,6 @@ class executionModel extends model
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
|
||||
/* Update the status of the parent stage. */
|
||||
if($oldExecution->type == 'stage')
|
||||
{
|
||||
$parent = $this->getByID($oldExecution->parent);
|
||||
if($parent->type == 'stage')
|
||||
{
|
||||
$isClosed = true;
|
||||
$children = $this->getChildExecutions($oldExecution->parent);
|
||||
foreach($children as $childID => $childExecution)
|
||||
{
|
||||
if($childExecution->status != 'closed') $isClosed = false;
|
||||
}
|
||||
|
||||
if($isClosed)
|
||||
{
|
||||
$this->dao->update(TABLE_EXECUTION)->set('status')->eq('closed')->where('id')->eq($parent->id)->exec();
|
||||
$this->loadModel('action')->create('execution', $parent->id, 'closebychildclose');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->loadModel('score')->create('execution', 'close', $oldExecution);
|
||||
return $changes;
|
||||
}
|
||||
@@ -1319,7 +1287,7 @@ class executionModel extends model
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $type all|sprint|stage|kanban
|
||||
* @param string $mode all|noclosed|stagefilter|withdelete|multiple or empty
|
||||
* @param string $mode all|noclosed|stagefilter|withdelete|multiple|leaf or empty
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
@@ -1356,16 +1324,34 @@ class executionModel extends model
|
||||
->orderBy($orderBy)
|
||||
->fetchAll();
|
||||
|
||||
/* If mode == leaf, only show leaf executions. */
|
||||
$allExecutions = $this->dao->select('id,name,parent')->from(TABLE_EXECUTION)
|
||||
->where('type')->notin(array('program', 'project'))
|
||||
->beginIf($projectID)->andWhere('project')->eq($projectID)->fi()
|
||||
->fetchAll('id');
|
||||
|
||||
$parents = array();
|
||||
foreach($allExecutions as $exec)
|
||||
{
|
||||
$parents[$exec->parent] = true;
|
||||
}
|
||||
|
||||
$pairs = array();
|
||||
$noMultiples = array();
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if(strpos($mode, 'leaf') !== false and isset($parents[$execution->id])) continue; // Only show leaf.
|
||||
if(strpos($mode, 'noclosed') !== false and ($execution->status == 'done' or $execution->status == 'closed')) continue;
|
||||
if(strpos($mode, 'stagefilter') !== false and isset($executionModel) and $executionModel == 'waterfall' and in_array($execution->attribute, array('request', 'design', 'review'))) continue; // Some stages of waterfall not need.
|
||||
|
||||
if(empty($execution->multiple)) $noMultiples[$execution->id] = $execution->project;
|
||||
|
||||
$pairs[$execution->id] = $execution->name;
|
||||
/* Set execution name. */
|
||||
$paths = array_slice(explode(',', trim($execution->path, ',')), 1);
|
||||
$executionName = '';
|
||||
foreach($paths as $path) $executionName .= '/' . $allExecutions[$path]->name;
|
||||
|
||||
$pairs[$execution->id] = $executionName;
|
||||
}
|
||||
|
||||
if($noMultiples)
|
||||
@@ -1671,6 +1657,11 @@ class executionModel extends model
|
||||
if($execution->parent < 0 and $execution->type == 'stage') unset($executions[$key]);
|
||||
if($execution->projectName) $execution->name = $execution->projectName . ' / ' . $execution->name;
|
||||
}
|
||||
elseif($param === 'hasParentName')
|
||||
{
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$executions[$execution->id]->name = implode('/', $parentExecutions);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($executions[$execution->parent]) and $execution->type == 'stage')
|
||||
|
||||
@@ -1382,7 +1382,7 @@ class kanban extends control
|
||||
$this->view->projects = array($this->lang->kanban->allProjects) + $this->project->getPairsByProgram('', 'all', false, '', '', '', 'multiple');
|
||||
$this->view->selectedProjectID = $selectedProjectID;
|
||||
$this->view->lanePairs = $this->kanban->getLanePairsByGroup($groupID);
|
||||
$this->view->executions2Imported = $this->execution->getStatData($selectedProjectID, 'undone', 0, 0, false, '', 'id_asc', $pager);
|
||||
$this->view->executions2Imported = $this->execution->getStatData($selectedProjectID, 'undone', 0, 0, false, 'hasParentName', 'id_asc', $pager);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted');
|
||||
$this->view->pager = $pager;
|
||||
$this->view->kanbanID = $kanbanID;
|
||||
|
||||
@@ -1281,6 +1281,9 @@ class kanbanModel extends model
|
||||
}
|
||||
$objectCard->execType = $object->type;
|
||||
$objectCard->progress = isset($executionProgress[$objectID]->progress) ? $executionProgress[$objectID]->progress : 0;
|
||||
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($object->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$objectCard->name = implode('/', $parentExecutions);
|
||||
}
|
||||
|
||||
$objectCard->desc = strip_tags(htmlspecialchars_decode($object->desc));
|
||||
|
||||
+26
-29
@@ -1438,7 +1438,7 @@ class productModel extends model
|
||||
}
|
||||
$orderBy = $hasWaterfall ? 't2.begin_asc,t2.id_asc' : 't2.begin_desc,t2.id_desc';
|
||||
|
||||
$executions = $this->dao->select('t2.id,t2.name,t2.grade,t2.parent,t2.attribute,t2.multiple,t3.name as projectName')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
$executions = $this->dao->select('t2.id,t2.name,t2.grade,t2.path,t2.parent,t2.attribute,t2.multiple,t3.name as projectName')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.project = t2.id')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t2.project = t3.id')
|
||||
->where('t1.product')->eq($productID)
|
||||
@@ -1452,38 +1452,35 @@ class productModel extends model
|
||||
->orderBy($orderBy)
|
||||
->fetchAll('id');
|
||||
|
||||
/* The waterfall project needs to show the hierarchy and remove the parent stage. */
|
||||
$executionPairs = array('0' => '');
|
||||
if($hasWaterfall)
|
||||
/* Only show leaf executions. */
|
||||
$allExecutions = $this->dao->select('id,name,attribute,parent')->from(TABLE_EXECUTION)->where('type')->notin(array('program', 'project'))->fetchAll('id');
|
||||
$parents = array();
|
||||
foreach($allExecutions as $exec)
|
||||
{
|
||||
foreach($executions as $id => $execution)
|
||||
{
|
||||
if($execution->grade == 2 and isset($executions[$execution->parent]))
|
||||
{
|
||||
$execution->name = $executions[$execution->parent]->name . '/' . $execution->name;
|
||||
$executions[$execution->parent]->children[$id] = $execution->name;
|
||||
unset($executions[$id]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if(isset($execution->children))
|
||||
{
|
||||
$executionPairs = $executionPairs + $execution->children;
|
||||
continue;
|
||||
}
|
||||
if(strpos($mode, 'stagefilter') !== false and in_array($execution->attribute, array('request', 'design', 'review'))) continue; // Some stages of waterfall not need.
|
||||
$executionPairs[$execution->id] = $execution->name;
|
||||
}
|
||||
$parents[$exec->parent] = true;
|
||||
}
|
||||
else
|
||||
|
||||
$executionPairs = array('0' => '');
|
||||
foreach($executions as $execID=> $execution)
|
||||
{
|
||||
$this->app->loadLang('project');
|
||||
foreach($executions as $execution)
|
||||
if(isset($parents[$execID])) continue; // Only show leaf.
|
||||
if(strpos($mode, 'stagefilter') !== false and in_array($execution->attribute, array('request', 'design', 'review'))) continue; // Some stages of waterfall not need.
|
||||
|
||||
if(empty($execution->multiple))
|
||||
{
|
||||
$executionPairs[$execution->id] = $execution->name;
|
||||
if(empty($execution->multiple)) $executionPairs[$execution->id] = $execution->projectName . "({$this->lang->project->disableExecution})";
|
||||
$this->app->loadLang('project');
|
||||
$executionPairs[$execution->id] = $execution->projectName . "({$this->lang->project->disableExecution})";
|
||||
}
|
||||
else
|
||||
{
|
||||
$paths = array_slice(explode(',', trim($execution->path, ',')), 1);
|
||||
$executionName = $projectID != 0 ? '' : $execution->projectName;
|
||||
foreach($paths as $path)
|
||||
{
|
||||
$executionName .= '/' . $allExecutions[$path]->name;
|
||||
}
|
||||
|
||||
$executionPairs[$execID] = $executionName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,8 +212,9 @@ class programplan extends control
|
||||
*/
|
||||
public function edit($planID = 0, $projectID = 0)
|
||||
{
|
||||
$this->app->loadLang('project');
|
||||
$this->loadModel('project');
|
||||
$this->app->loadLang('execution');
|
||||
$this->app->loadLang('stage');
|
||||
$plan = $this->programplan->getByID($planID);
|
||||
|
||||
global $lang;
|
||||
@@ -234,12 +235,14 @@ class programplan extends control
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate));
|
||||
}
|
||||
|
||||
$this->app->loadLang('stage');
|
||||
$this->view->title = $this->lang->programplan->edit;
|
||||
$this->view->position[] = $this->lang->programplan->edit;
|
||||
$this->view->parentStage = $this->programplan->getParentStageList($this->session->project, $planID, $plan->product);
|
||||
$this->view->isCreateTask = $this->programplan->isCreateTask($planID);
|
||||
$this->view->plan = $plan;
|
||||
$parentStage = $this->project->getByID($plan->parent, 'stage');
|
||||
|
||||
$this->view->title = $this->lang->programplan->edit;
|
||||
$this->view->position[] = $this->lang->programplan->edit;
|
||||
$this->view->isCreateTask = $this->programplan->isCreateTask($planID);
|
||||
$this->view->plan = $plan;
|
||||
$this->view->parentStageList = $this->programplan->getParentStageList($this->session->project, $planID, $plan->product);
|
||||
$this->view->enableOptionalAttr = (empty($parentStage) or (!empty($parentStage) and $parentStage->attribute == 'mix'));
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -328,4 +331,19 @@ class programplan extends control
|
||||
return $this->send(array('result' => 'success'));
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxGetAttribute($stageID)
|
||||
{
|
||||
$this->app->loadLang('stage');
|
||||
|
||||
$attribute = $this->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($stageID)->fetch('attribute');
|
||||
if(empty($attribute) or $attribute == 'mix')
|
||||
{
|
||||
return print(html::select('attribute', $this->lang->stage->typeList, $attribute, "class='form-control chosen'"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return print(zget($this->lang->stage->typeList, $attribute));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
function changeParentStage(stageID)
|
||||
{
|
||||
$.get(createLink('programplan', 'ajaxGetAttribute', 'stageID=' + stageID), function(attribute)
|
||||
{
|
||||
$('#attributeType td').html(attribute);
|
||||
$("#attribute" + "_chosen").remove();
|
||||
$("#attribute").next('.picker').remove();
|
||||
$("#attribute").chosen();
|
||||
})
|
||||
}
|
||||
@@ -726,7 +726,7 @@ class programplanModel extends model
|
||||
$plan->name = $names[$key];
|
||||
if($setCode) $plan->code = $codes[$key];
|
||||
$plan->percent = $percents[$key];
|
||||
$plan->attribute = empty($parentID) ? $attributes[$key] : $parentAttribute;
|
||||
$plan->attribute = (empty($parentID) or $parentAttribute == 'mix') ? $attributes[$key] : $parentAttribute;
|
||||
$plan->milestone = $milestone[$key];
|
||||
$plan->begin = empty($begin[$key]) ? '0000-00-00' : $begin[$key];
|
||||
$plan->end = empty($end[$key]) ? '0000-00-00' : $end[$key];
|
||||
@@ -971,6 +971,8 @@ class programplanModel extends model
|
||||
{
|
||||
$this->action->create('execution', $stageID, 'opened');
|
||||
}
|
||||
|
||||
$this->computeProgress($stageID, 'create');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1361,7 +1363,6 @@ class programplanModel extends model
|
||||
->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->where('t1.product')->eq($productID)
|
||||
->andWhere('t2.project')->eq($executionID)
|
||||
->andWhere('t2.grade')->eq(1)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
|
||||
->orderBy('t2.id desc')
|
||||
@@ -1381,4 +1382,73 @@ class programplanModel extends model
|
||||
|
||||
return $parentStage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute stage status.
|
||||
*
|
||||
* @param int $stage
|
||||
* @param strihg $action
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function computeProgress($stageID, $action = '')
|
||||
{
|
||||
$stage = $this->loadModel('execution')->getByID($stageID);
|
||||
if(empty($stage) or empty($stage->path) or $stage->type != 'stage') return false;
|
||||
|
||||
$this->loadModel('execution');
|
||||
$this->loadModel('action');
|
||||
$action = strtolower($action);
|
||||
$parentIdList = explode(',', trim($stage->path, ','));
|
||||
$parentIdList = array_reverse($parentIdList);
|
||||
foreach($parentIdList as $id)
|
||||
{
|
||||
$parent = $this->execution->getByID($id);
|
||||
if($parent->type != 'stage' or $id == $stageID) continue;
|
||||
|
||||
$statusCount = array();
|
||||
$children = $this->execution->getChildExecutions($parent->id);
|
||||
foreach($children as $childID => $childExecution) $statusCount[$childExecution->status] = empty($statusCount[$childExecution->status]) ? 1 : $statusCount[$childExecution->status] ++;
|
||||
|
||||
if(isset($statusCount['wait']) and count($statusCount) == 1)
|
||||
{
|
||||
if($parent->status != 'wait')
|
||||
{
|
||||
$parentStatus = 'wait';
|
||||
$parentAction = 'waitbychild';
|
||||
}
|
||||
}
|
||||
elseif(isset($statusCount['suspended']) and count($statusCount) == 1)
|
||||
{
|
||||
if($parent->status != 'suspended')
|
||||
{
|
||||
$parentStatus = 'suspended';
|
||||
$parentAction = 'suspendedbychild';
|
||||
}
|
||||
}
|
||||
elseif(isset($statusCount['closed']) and count($statusCount) == 1)
|
||||
{
|
||||
if($parent->status != 'closed')
|
||||
{
|
||||
$parentStatus = 'closed';
|
||||
$parentAction = 'closedbychild';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($parent->status != 'doing')
|
||||
{
|
||||
$parentStatus = 'doing';
|
||||
$parentAction = 'startbychild' . $action;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($parentStatus))
|
||||
{
|
||||
$this->dao->update(TABLE_EXECUTION)->set('status')->eq($parentStatus)->where('id')->eq($id)->exec();
|
||||
$this->action->create('execution', $id, $parentAction, '', $parentAction);
|
||||
}
|
||||
unset($parentStatus, $parentAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="w-100px"><?php echo $lang->programplan->parent;?></th>
|
||||
<td colspan='2'><?php echo html::select('parent', $parentStage, $plan->parent, "class='form-control chosen '");?></td>
|
||||
<td colspan='2'><?php echo html::select('parent', $parentStageList, $plan->parent, "class='form-control chosen '");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->programplan->name;?> </th>
|
||||
@@ -46,9 +46,11 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="<?php if($plan->grade == 2) echo "hidden";?>" id="attributeType">
|
||||
<th><?php echo $lang->programplan->attribute;?> </th>
|
||||
<td colspan='2'><?php echo html::select('attribute', $lang->stage->typeList, $plan->attribute, "class='form-control'");?></td>
|
||||
<tr id="attributeType">
|
||||
<th><?php echo $lang->programplan->attribute;?></th>
|
||||
<td colspan='2'>
|
||||
<?php echo $enableOptionalAttr ? html::select('attribute', $lang->stage->typeList, $plan->attribute, "class='form-control'") : zget($lang->stage->typeList, $plan->attribute);?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if($plan->setMilestone):?>
|
||||
<tr>
|
||||
@@ -101,16 +103,17 @@
|
||||
$("#parent").change(function()
|
||||
{
|
||||
var parent = $(this).children("option:selected").val();
|
||||
|
||||
if(parent == 0)
|
||||
{
|
||||
$("#attributeType").removeClass('hidden');
|
||||
$("#acl").attr('disabled', false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#attributeType").addClass('hidden');
|
||||
$("#acl").attr('disabled', true);
|
||||
}
|
||||
|
||||
changeParentStage(parent);
|
||||
});
|
||||
</script>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
+12
-1
@@ -2203,7 +2203,18 @@ class repoModel extends model
|
||||
{
|
||||
$pairs = array();
|
||||
$executions = $this->loadModel('execution')->getList(0, 'all', 'undone', 0, $product, $branch);
|
||||
foreach($executions as $execution) $pairs[$execution->id] = $execution->name;
|
||||
$parents = $this->dao->select('distinct parent,parent')->from(TABLE_EXECUTION)->where('type')->eq('stage')->andWhere('grade')->gt(1)->andWhere('deleted')->eq(0)->fetchPairs();
|
||||
foreach($executions as $execution)
|
||||
{
|
||||
if(!empty($parents[$execution->id])) continue;
|
||||
|
||||
if($execution->type == 'stage' and $execution->grade > 1)
|
||||
{
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$execution->name = implode('/', $parentExecutions);
|
||||
}
|
||||
$pairs[$execution->id] = $execution->name;
|
||||
}
|
||||
return $pairs;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user