diff --git a/module/program/model.php b/module/program/model.php index 22cf6dd8cb..736c5060b3 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -838,10 +838,12 @@ class programModel extends model ->groupBy('PRJ') ->fetchAll('PRJ'); + $this->app->loadClass('pager', $static = true); foreach($projects as $projectID => $project) { $orderBy = $project->model == 'waterfall' ? 'path_asc,id_asc' : 'id_desc'; - $project->executions = $this->project->getExecutionStats($projectID, $status, 0, 0, $itemCounts, $orderBy); + $pager = $project->model == 'waterfall' ? null : new pager(0, 1, 1); + $project->executions = $this->project->getExecutionStats($projectID, 'undone', 0, 0, 30, $orderBy, $pager); $project->teamCount = isset($teams[$projectID]) ? $teams[$projectID]->count : 0; $project->estimate = isset($estimates[$projectID]) ? $estimates[$projectID]->estimate : 0; $project->parentName = $this->getPRJParentName($project->parent); diff --git a/module/project/control.php b/module/project/control.php index 7864a50243..c21a0276cb 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -2469,7 +2469,7 @@ class project extends control * @access public * @return void */ - public function all($status = 'undone', $projectID = 0, $orderBy = 'path_asc,id_asc', $productID = 0, $recTotal = 0, $recPerPage = 10, $pageID = 1) + public function all($status = 'all', $projectID = 0, $orderBy = 'path_asc,id_asc', $productID = 0, $recTotal = 0, $recPerPage = 10, $pageID = 1) { $this->app->loadLang('my'); $this->app->loadLang('programplan'); diff --git a/module/project/model.php b/module/project/model.php index bed6d7b3aa..4b8f6bc399 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -962,7 +962,7 @@ class projectModel extends model ->beginIF($status == 'undone')->andWhere('status')->notIN('done,closed')->fi() ->beginIF($status != 'all' and $status != 'undone')->andWhere('status')->in($status)->fi() ->andWhere('deleted')->eq('0') - ->orderBy('path_asc') + ->orderBy('path_asc,id_asc') ->beginIF($limit)->limit($limit)->fi() ->fetchAll('id'); @@ -1005,7 +1005,8 @@ class projectModel extends model { $executions = $this->dao->select('*')->from(TABLE_EXECUTION) ->where('project')->eq($projectID) - ->andWhere('type')->eq('stage') + ->beginIF($status == 'undone')->andWhere('status')->notIN('done,closed')->fi() + ->beginIF($status != 'all' and $status != 'undone')->andWhere('status')->eq($status)->fi() ->andWhere('deleted')->eq('0') ->orderBy($orderBy) ->page($pager) @@ -1017,15 +1018,16 @@ class projectModel extends model ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.project=t2.id') ->where('t1.product')->eq($productID) ->andWhere('t2.project')->eq($projectID) - ->andWhere('t2.type')->eq('stage') + ->beginIF($status == 'undone')->andWhere('t2.status')->notIN('done,closed')->fi() + ->beginIF($status != 'all' and $status != 'undone')->andWhere('t2.status')->eq($status)->fi() ->andWhere('t2.deleted')->eq('0') ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); } - $hours = array(); - $emptyHour = array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0); + $hours = array(); + $emptyHour = array('totalEstimate' => 0, 'totalConsumed' => 0, 'totalLeft' => 0, 'progress' => 0); /* Get all tasks and compute totalEstimate, totalConsumed, totalLeft, progress according to them. */ $tasks = $this->dao->select('id, project, estimate, consumed, `left`, status, closedReason')