diff --git a/module/execution/control.php b/module/execution/control.php
index 9dcebbcacf..8c9cc4122a 100644
--- a/module/execution/control.php
+++ b/module/execution/control.php
@@ -2615,10 +2615,18 @@ class execution extends control
$execution = $this->commonAction($executionID);
if($execution->type != 'kanban') return print(js::locate(inlink('view', "executionID=$executionID")));
- if($execution->lifetime == 'ops' or in_array($execution->attribute, array('request', 'review')))
+ $features = $this->execution->getExecutionFeatures($execution);
+ $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $browseType, $orderBy, 0, $groupBy);
+
+ /* Remove lanes if no feature. */
+ foreach($kanbanData as $regionID => $region)
{
- $browseType = 'task';
- unset($this->lang->kanban->group->task['story']);
+ foreach($region->groups as $groupID => $group)
+ {
+ if(!$features['story'] and $group->lanes[0]->type == 'story') unset($kanbanData[$regionID]->groups[$groupID]);
+ if(!$features['qa'] and $group->lanes[0]->type == 'bug') unset($kanbanData[$regionID]->groups[$groupID]);
+ $kanbanData[$regionID]->groups = array_values($kanbanData[$regionID]->groups);
+ }
}
/* Set Session. */
@@ -2688,6 +2696,7 @@ class execution extends control
$this->view->projectID = $projectID;
$this->view->project = $this->loadModel('project')->getByID($projectID);
$this->view->allPlans = $allPlans;
+ $this->view->features = $features;
$this->view->kanbanData = $kanbanData;
$this->view->executionActions = $executionActions;
$this->view->kanban = $this->lang->execution->kanban;
@@ -2744,7 +2753,7 @@ class execution extends control
/* Show lanes of the attribute: no story&bug in request, no bug in design. */
if(!isset($this->lang->execution->menu->story)) unset($kanbanGroup['story']);
- if(!isset($this->lang->execution->menu->qa)) unset($kanbanGroup['bug']);
+ if(!isset($this->lang->execution->menu->qa)) unset($kanbanGroup['bug']);
/* Determines whether an object is editable. */
$canBeChanged = common::canModify('execution', $execution);
@@ -2783,6 +2792,7 @@ class execution extends control
$this->view->productNum = count($products);
$this->view->allPlans = $allPlans;
$this->view->browseType = $browseType;
+ $this->view->features = $this->execution->getExecutionFeatures($execution);
$this->view->kanbanGroup = $kanbanGroup;
$this->view->execution = $execution;
$this->view->groupBy = $groupBy;
diff --git a/module/execution/model.php b/module/execution/model.php
index d156eafa60..9f68c3f3ae 100755
--- a/module/execution/model.php
+++ b/module/execution/model.php
@@ -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())
{
diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php
index f89f2e2f00..58293d2cde 100644
--- a/module/execution/view/kanban.html.php
+++ b/module/execution/view/kanban.html.php
@@ -61,40 +61,27 @@ js::set('rdSearchValue', '');
js::set('defaultMinColWidth', $this->config->minColWidth);
js::set('defaultMaxColWidth', $this->config->maxColWidth);
-$canSortRegion = (commonModel::hasPriv('kanban', 'sortRegion') and count($regions) > 1);
-$canCreateRegion = (common::hasPriv('kanban', 'createRegion') and $groupBy == 'default');
+$canSortRegion = commonModel::hasPriv('kanban', 'sortRegion') && count($regions) > 1;
+$canCreateRegion = common::hasPriv('kanban', 'createRegion') && $groupBy == 'default';
$canEditRegion = commonModel::hasPriv('kanban', 'editRegion');
$canDeleteRegion = commonModel::hasPriv('kanban', 'deleteRegion');
$canCreateLane = commonModel::hasPriv('kanban', 'createLane');
$canCreateTask = common::hasPriv('task', 'create');
$canBatchCreateTask = common::hasPriv('task', 'batchCreate');
-$canImportTask = (common::hasPriv('execution', 'importTask') and $execution->multiple);
+$canImportTask = common::hasPriv('execution', 'importTask') && $execution->multiple;
-if($execution->lifetime != 'ops' and !in_array($execution->attribute, array('request', 'review')))
-{
- $canCreateBug = ($productID and common::hasPriv('bug', 'create'));
- $canBatchCreateBug = ($productID and common::hasPriv('bug', 'batchCreate') and $execution->multiple);
- $canImportBug = ($productID and common::hasPriv('execution', 'importBug'));
- $canCreateStory = ($productID and common::hasPriv('story', 'create'));
- $canBatchCreateStory = ($productID and common::hasPriv('story', 'batchCreate'));
- $canLinkStory = ($productID and common::hasPriv('execution', 'linkStory') and !empty($execution->hasProduct));
- $canLinkStoryByPlan = ($productID and common::hasPriv('execution', 'importplanstories') and !empty($project->hasProduct));
- $hasStoryButton = ($canCreateStory or $canBatchCreateStory or $canLinkStory or $canLinkStoryByPlan);
- $hasBugButton = ($canCreateBug or $canBatchCreateBug);
-}
-else
-{
- $canCreateBug = false;
- $canBatchCreateBug = false;
- $canImportBug = false;
- $canCreateStory = false;
- $canBatchCreateStory = false;
- $canLinkStory = false;
- $canLinkStoryByPlan = false;
- $hasStoryButton = false;
- $hasBugButton = false;
-}
-$hasTaskButton = ($canCreateTask or $canBatchCreateTask or $canImportBug);
+$canCreateBug = $features['qa'] && $productID && common::hasPriv('bug', 'create');
+$canBatchCreateBug = $features['qa'] && $productID && common::hasPriv('bug', 'batchCreate') && $execution->multiple;
+$canImportBug = $features['qa'] && $productID && common::hasPriv('execution', 'importBug');
+$hasBugButton = $features['qa'] && ($canCreateBug || $canBatchCreateBug);
+
+$canCreateStory = $features['story'] && $productID && common::hasPriv('story', 'create');
+$canBatchCreateStory = $features['story'] && $productID && common::hasPriv('story', 'batchCreate');
+$canLinkStory = $features['story'] && $productID && common::hasPriv('execution', 'linkStory') && !empty($execution->hasProduct);
+$canLinkStoryByPlan = $features['story'] && $productID && common::hasPriv('execution', 'importplanstories') && !empty($project->hasProduct);
+$hasStoryButton = $features['story'] && ($canCreateStory || $canBatchCreateStory || $canLinkStory || $canLinkStoryByPlan);
+
+$hasTaskButton = $canCreateTask || $canBatchCreateTask || $canImportBug;
js::set('priv',
array(
@@ -134,7 +121,7 @@ js::set('priv',
'canDeleteStory' => common::hasPriv('story', 'delete'),
'canChangeStory' => common::hasPriv('story', 'change'),
'canCloseStory' => common::hasPriv('story', 'close'),
- 'canUnlinkStory' => (common::hasPriv('execution', 'unlinkStory') and !empty($execution->hasProduct)),
+ 'canUnlinkStory' => (common::hasPriv('execution', 'unlinkStory') && !empty($execution->hasProduct)),
'canViewStory' => common::hasPriv('execution', 'storyView'),
)
);
@@ -142,13 +129,17 @@ js::set('priv',
-lifetime == 'ops' or in_array($execution->attribute, array('request', 'review'))):?>
+
- lifetime != 'ops' and !in_array($execution->attribute, array('request', 'review'))):?>
+
+ kanban->type['story']);
+ if(!$features['qa']) unset($lang->kanban->type['bug']);
+ ?>
kanban->type, $browseType, 'class="form-control chosen" data-max_drop_width="215"');?>
@@ -226,13 +217,14 @@ js::set('priv',
' . html::a('#linkStoryByPlan', $lang->execution->linkStoryByPlan, '', 'data-toggle="modal"') . '';?>
';?>
' . html::a(helper::createLink('bug', 'create', "productID=$productID&branch=0&extra=executionID=$execution->id", '', true), $lang->bug->create, '', "class='iframe'") . '';?>
- ' . html::a(helper::createLink('bug', 'batchCreate', "productID=$productID&branch=$branchID&executionID=$execution->id", '', true), $lang->bug->batchCreate, '', "class='iframe'") . '';
if($productNum > 1) $batchCreateBugLink = '
' . html::a('#batchCreateBug', $lang->bug->batchCreate, '', "data-toggle='modal'") . '';
echo $batchCreateBugLink;
- }?>
+ }
+ ?>
';?>
' . html::a(helper::createLink('task', 'create', "execution=$execution->id", '', true), $lang->task->create, '', "class='iframe'") . '';?>
' . html::a(helper::createLink('execution', 'importBug', "executionID=$execution->id", '', true), $lang->execution->importBug, '', "class='iframe' data-width=90%") . '';?>
diff --git a/module/execution/view/taskkanban.html.php b/module/execution/view/taskkanban.html.php
index 222751e4da..764e74419a 100644
--- a/module/execution/view/taskkanban.html.php
+++ b/module/execution/view/taskkanban.html.php
@@ -17,7 +17,7 @@