diff --git a/module/execution/control.php b/module/execution/control.php index 453acd3dc3..30a2d214fe 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -4019,7 +4019,7 @@ class execution extends control * @access public * @return void */ - public function all($status = 'undone', $orderBy = 'order_asc', $productID = 0, $param = '', $recTotal = 0, $recPerPage = 100, $pageID = 1) + public function all($status = 'undone', $orderBy = 'order_asc', $productID = 0, $param = '', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->app->loadLang('my'); $this->app->loadLang('stage'); @@ -4049,7 +4049,7 @@ class execution extends control $this->view->title = $this->lang->execution->allExecutions; $this->view->position[] = $this->lang->execution->allExecutions; $this->view->executionStats = $executionStats; - $this->view->allExecutionsNum = $this->execution->getStatData(0, 'all', 0, 0, false, '', 'id_asc', null, true); + $this->view->allExecutionsNum = $this->execution->getExecutionCounts(0, 'all'); $this->view->productList = $this->product->getProductPairsByProject(0); $this->view->productID = $productID; $this->view->pager = $pager; diff --git a/module/execution/model.php b/module/execution/model.php index 7bc9810b97..bbb2e7c6ad 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1857,6 +1857,35 @@ class executionModel extends model ->fetchPairs('id', 'id'); } + /** + * Get execution count. + * + * @param int $projectID + * @param string $browseType all|undone|wait|doing|suspended|closed|involved|review + * @access public + * @return int + */ + public function getExecutionCounts($projectID = 0, $browseType = 'all') + { + $executions = $this->dao->select('t1.*,t2.name projectName, t2.model as projectModel')->from(TABLE_EXECUTION)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') + ->where('t1.type')->in('sprint,stage,kanban') + ->andWhere('t1.deleted')->eq('0') + ->andWhere('t1.vision')->eq($this->config->vision) + ->andWhere('t1.multiple')->eq('1') + ->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() + ->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi() + ->beginIF(!in_array($browseType, array('all', 'undone', 'involved', 'review', 'bySearch')))->andWhere('t1.status')->eq($browseType)->fi() + ->beginIF($browseType == 'undone')->andWhere('t1.status')->notIN('done,closed')->fi() + ->beginIF($browseType == 'review') + ->andWhere("FIND_IN_SET('{$this->app->user->account}', t1.reviewers)") + ->andWhere('t1.reviewStatus')->eq('doing') + ->fi() + ->fetchAll('id'); + + return count($executions); + } + /** * Get execution stat data. @@ -1868,11 +1897,10 @@ class executionModel extends model * @param string|int $param skipParent * @param string $orderBy * @param object $pager - * @param bool $isCount true for count, false for fetchAll. * @access public * @return array */ - public function getStatData($projectID = 0, $browseType = 'undone', $productID = 0, $branch = 0, $withTasks = false, $param = '', $orderBy = 'id_asc', $pager = null, $isCount = false) + public function getStatData($projectID = 0, $browseType = 'undone', $productID = 0, $branch = 0, $withTasks = false, $param = '', $orderBy = 'id_asc', $pager = null) { if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getExecutionStats($browseType); @@ -1910,7 +1938,7 @@ class executionModel extends model ->andWhere('t1.multiple')->eq('1') ->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() ->beginIF(!empty($executionQuery))->andWhere($executionQuery)->fi() - ->beginIF($productID)->andWhere('t3.product')->eq((int)$productID)->fi() + ->beginIF($productID)->andWhere('t3.product')->eq($productID)->fi() ->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi() ->beginIF(!in_array($browseType, array('all', 'undone', 'involved', 'review', 'bySearch')))->andWhere('t1.status')->eq($browseType)->fi() ->beginIF($browseType == 'undone')->andWhere('t1.status')->notIN('done,closed')->fi() @@ -1922,8 +1950,6 @@ class executionModel extends model ->page($pager, 't1.id') ->fetchAll('id'); - if($isCount) return count($executions); - if(empty($productID) and !empty($executions)) $projectProductIdList = $this->dao->select('project, GROUP_CONCAT(product) as product')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($executions))->groupBy('project')->fetchPairs(); $hours = $this->loadModel('project')->computerProgress($executions);