From 02fb955dc2826d08a3789df1c3e4050f1eaaefdc Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 23 Mar 2021 14:37:03 +0800 Subject: [PATCH] * Fix bug. --- module/execution/control.php | 20 +++++++++++++------ .../execution/view/ajaxgetdropmenu.html.php | 10 +++++----- module/repo/control.php | 4 ++-- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 4b3b58e4ea..8aa893e9b1 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2543,18 +2543,26 @@ class execution extends control $orderedExecutions = array(); $projects = $this->loadModel('program')->getProjectList(0, 'all', 0, 'order_asc'); + $executionGroups = $this->dao->select('*')->from(TABLE_EXECUTION) + ->where('id')->in($this->app->user->view->sprints) + ->andWhere('deleted')->eq(0) + ->andWhere('project')->in(array_keys($projects)) + ->orderBy('id_desc') + ->fetchGroup('project', 'id'); + + $teams = $this->dao->select('root,account')->from(TABLE_TEAM) + ->where('root')->in($this->app->user->view->sprints) + ->andWhere('type')->eq('execution') + ->fetchGroup('root', 'account'); + foreach($projects as $project) { - $executions = $this->dao->select('*')->from(TABLE_EXECUTION) - ->where('id')->in($this->app->user->view->sprints) - ->andWhere('deleted')->eq(0) - ->andWhere('project')->eq($project->id) - ->orderBy('id_desc') - ->fetchAll('id'); + $executions = zget($executionGroups, $project->id, array()); foreach($executions as $execution) { if(isset($orderedExecutions[$execution->parent])) unset($orderedExecutions[$execution->parent]); + $execution->teams = zget($teams, $execution->id, array()); $orderedExecutions[$execution->id] = $execution; } } diff --git a/module/execution/view/ajaxgetdropmenu.html.php b/module/execution/view/ajaxgetdropmenu.html.php index 29c07c7064..99180c3099 100644 --- a/module/execution/view/ajaxgetdropmenu.html.php +++ b/module/execution/view/ajaxgetdropmenu.html.php @@ -11,8 +11,8 @@ $normalProjectsHtml = ''; $closedProjectsHtml = ''; foreach($executions as $execution) { - if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM == $this->app->user->account) $iCharges++; - if($execution->status != 'done' and $execution->status != 'closed' and !($execution->PM == $this->app->user->account)) $others++; + if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account]))) $iCharges++; + if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account])) $others++; if($execution->status == 'done' or $execution->status == 'closed') $dones++; $executionNames[] = $execution->name; } @@ -22,11 +22,11 @@ foreach($executions as $execution) { $selected = $execution->id == $executionID ? 'selected' : ''; $executionName = zget($projects, $execution->project) . '/' . $execution->name; - if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM == $this->app->user->account) + if($execution->status != 'done' and $execution->status != 'closed' and ($execution->PM == $this->app->user->account or isset($execution->teams[$this->app->user->account]))) { $myProjectsHtml .= html::a(sprintf($link, $execution->id), " " . $executionName, '', "class='text-important $selected' title='{$executionName}' data-key='" . zget($executionsPinYin, $execution->name, '') . "'"); } - else if($execution->status != 'done' and $execution->status != 'closed' and !($execution->PM == $this->app->user->account)) + else if($execution->status != 'done' and $execution->status != 'closed' and $execution->PM != $this->app->user->account and !isset($execution->teams[$this->app->user->account])) { $normalProjectsHtml .= html::a(sprintf($link, $execution->id), " " . $executionName, '', "class='$selected' title='{$executionName}' data-key='" . zget($executionsPinYin, $execution->name, '') . "'"); } @@ -39,7 +39,7 @@ foreach($executions as $execution) {$lang->execution->mine}"; + echo "