This commit is contained in:
zhujinyong
2023-02-24 10:25:57 +08:00
parent 9e73c11871
commit d0ab2da0d1
4 changed files with 91 additions and 68 deletions
+46 -25
View File
@@ -50,6 +50,41 @@ class executionModel extends model
return print(js::locate(helper::createLink('execution', 'all')));
}
/**
* Get features of execution.
*
* @param object $execution
* @access public
* @return array
*/
public function getExecutionFeatures($execution)
{
$features = array('story' => true, 'task' => true, 'qa' => true, 'devops' => true, 'burn' => true, 'build' => true, 'other' => true);
/* Unset story, bug, build and testtask if type is ops. */
if($execution->lifetime == 'ops')
{
$features['story'] = false;
$features['qa'] = false;
$features['build'] = false;
$features['burn'] = false;
}
else if(in_array($execution->attribute, array('request', 'design', 'review')))
{
$features['qa'] = false;
$features['devops'] = false;
$features['build'] = false;
$features['other'] = false;
if(in_array($execution->attribute, array('request', 'review')))
{
$features['story'] = false;
}
}
return $features;
}
/**
* Set menu.
*
@@ -105,30 +140,16 @@ class executionModel extends model
if(isset($execution->acl) and $execution->acl != 'private') unset($this->lang->execution->menu->settings['subMenu']->whitelist);
/* Unset story, bug, build and testtask if type is ops. */
if($execution and $execution->lifetime == 'ops')
{
unset($this->lang->execution->menu->story);
unset($this->lang->execution->menu->qa);
unset($this->lang->execution->menu->build);
unset($this->lang->execution->menu->burn);
}
$stageFilter = array('request', 'design', 'review');
if(isset($execution->attribute) and in_array($execution->attribute, $stageFilter))
{
if(in_array($execution->attribute, array('request', 'review')))
{
unset($this->lang->execution->menu->story);
unset($this->lang->execution->menu->view['subMenu']->groupTask);
unset($this->lang->execution->menu->view['subMenu']->tree);
unset($this->lang->execution->menu->other);
}
unset($this->lang->execution->menu->devops);
unset($this->lang->execution->menu->qa);
unset($this->lang->execution->menu->build);
}
/* Redjust menus. */
$features = $this->getExecutionFeatures($execution);
if(!$features['story']) unset($this->lang->execution->menu->story);
if(!$features['story']) unset($this->lang->execution->menu->view['subMenu']->groupTask);
if(!$features['story']) unset($this->lang->execution->menu->view['subMenu']->tree);
if(!$features['qa']) unset($this->lang->execution->menu->qa);
if(!$features['devops']) unset($this->lang->execution->menu->devops);
if(!$features['build']) unset($this->lang->execution->menu->build);
if(!$features['burn']) unset($this->lang->execution->menu->burn);
if(!$features['other']) unset($this->lang->execution->menu->other);
if($executions and (!isset($executions[$executionID]) or !$this->checkPriv($executionID))) $this->accessDenied();
@@ -448,7 +469,7 @@ class executionModel extends model
->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin)
->checkFlow()
->exec();
/* Add the creater to the team. */
if(!dao::isError())
{