diff --git a/module/execution/control.php b/module/execution/control.php
index 0f3f306bda..407d833f02 100644
--- a/module/execution/control.php
+++ b/module/execution/control.php
@@ -3138,7 +3138,7 @@ class execution extends control
foreach($executions as $execution)
{
- if(isset($orderedExecutions[$execution->parent])) unset($orderedExecutions[$execution->parent]);
+ if(isset($orderedExecutions[$execution->parent]) and $project->model != 'waterfall') unset($orderedExecutions[$execution->parent]);
$execution->teams = zget($teams, $execution->id, array());
$orderedExecutions[$execution->id] = $execution;
}
@@ -3160,11 +3160,20 @@ class execution extends control
$projectExecutions = array();
$parentIdList = array();
+ $childrenIdList = array();
foreach($orderedExecutions as $execution)
{
- $projectExecutions[$execution->project][] = $execution;
if($execution->type != 'stage') continue;
- if($execution->grade == 2 and $execution->project != $execution->parent) $parentIdList[$execution->parent] = $execution->parent;
+ if($execution->grade == 2 and $execution->project != $execution->parent)
+ {
+ $parentIdList[$execution->parent] = $execution->parent;
+ $childrenIdList[$execution->parent][] = $execution->id;
+ }
+ }
+ foreach($orderedExecutions as $id => $execution)
+ {
+ $execution->children = isset($childrenIdList[$execution->id]) ? $childrenIdList[$execution->id] : array();
+ $projectExecutions[$execution->project][] = $execution;
}
$parents = array();
diff --git a/module/execution/view/ajaxgetdropmenu.html.php b/module/execution/view/ajaxgetdropmenu.html.php
index f5c2d77aa6..d504cfd1a3 100644
--- a/module/execution/view/ajaxgetdropmenu.html.php
+++ b/module/execution/view/ajaxgetdropmenu.html.php
@@ -71,7 +71,6 @@ foreach($executions as $projectID => $projectExecutions)
if($executionCounts[$projectID]['others']) $normalExecutionsHtml .= '
';
if($executionCounts[$projectID]['closed']) $closedExecutionsHtml .= '';
}
-
foreach($projectExecutions as $index => $execution)
{
$kanbanLink = $this->createLink('execution', 'kanban', "executionID=%s");
@@ -80,27 +79,63 @@ foreach($executions as $projectID => $projectExecutions)
if($execution->type == 'kanban' and $link != $kanbanLink) $link = $kanbanLink;
$selected = $execution->id == $executionID ? 'selected' : '';
- if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account])))
+ if(!empty($execution->children))
{
- $myExecutionsHtml .= '- ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$execution->name}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
';
+ foreach($execution->children as $id)
+ {
+ $selected = $id == $executionID ? 'selected' : '';
+ if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account])))
+ {
+ $myExecutionsHtml .= '- ' . html::a(sprintf($link, $id), $executionNames[$id], '', "class='$selected clickable' title='{$executionNames[$id]}' data-key='" . zget($executionsPinYin, $executionNames[$id], '') . "' data-app='{$this->app->tab}'") . '
';
- if($selected == 'selected') $tabActive = 'myExecution';
+ if($selected == 'selected') $tabActive = 'myExecution';
- $myExecutions ++;
+ $myExecutions ++;
+ }
+ else if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account]))
+ {
+ $normalExecutionsHtml .= '- ' . html::a(sprintf($link, $id), $executionNames[$id], '', "class='$selected clickable' title='{$executionNames[$id]}' data-key='" . zget($executionsPinYin, $executionNames[$id], '') . "' data-app='{$this->app->tab}'") . '
';
+
+ if($selected == 'selected') $tabActive = 'other';
+
+ $others ++;
+ }
+ else if($execution->status == 'done' or $execution->status == 'closed')
+ {
+ $closedExecutionsHtml .= '- ' . html::a(sprintf($link, $id), $executionNames[$id], '', "class='$selected clickable' title='{$executionNames[$id]}' data-key='" . zget($executionsPinYin, $executionNames[$id], '') . "' data-app='{$this->app->tab}'") . '
';
+
+ if($selected == 'selected') $tabActive = 'closed';
+ }
+ }
}
- else if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account]))
+ elseif($execution->grade == 2 and $execution->parent != $execution->project)
{
- $normalExecutionsHtml .= '- ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$execution->name}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
';
-
- if($selected == 'selected') $tabActive = 'other';
-
- $others ++;
+ continue;
}
- else if($execution->status == 'done' or $execution->status == 'closed')
+ else
{
- $closedExecutionsHtml .= '- ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='$execution->name' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
';
+ if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account])))
+ {
+ $myExecutionsHtml .= '- ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
';
- if($selected == 'selected') $tabActive = 'closed';
+ if($selected == 'selected') $tabActive = 'myExecution';
+
+ $myExecutions ++;
+ }
+ else if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account]))
+ {
+ $normalExecutionsHtml .= '- ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
';
+
+ if($selected == 'selected') $tabActive = 'other';
+
+ $others ++;
+ }
+ else if($execution->status == 'done' or $execution->status == 'closed')
+ {
+ $closedExecutionsHtml .= '- ' . html::a(sprintf($link, $execution->id), $executionNames[$execution->id], '', "class='$selected clickable' title='{$executionNames[$execution->id]}' data-key='" . zget($executionsPinYin, $execution->name, '') . "' data-app='{$this->app->tab}'") . '
';
+
+ if($selected == 'selected') $tabActive = 'closed';
+ }
}
/* If the execution is the last one in the project, print the closed label. */
diff --git a/module/project/model.php b/module/project/model.php
index b65d3d13af..b46a01e92b 100644
--- a/module/project/model.php
+++ b/module/project/model.php
@@ -2285,6 +2285,17 @@ class projectModel extends model
}
/* In the case of the waterfall model, calculate the sub-stage. */
+ if($projectID == 0)
+ {
+ foreach($executions as $key => $execution)
+ {
+ if($execution->type == 'stage')
+ {
+ $execution->children = isset($children[$execution->id]) ? $children[$execution->id] : array();
+ unset($children[$execution->id]);
+ }
+ }
+ }
$project = $this->getByID($projectID);
if($project and $project->model == 'waterfall')
{