diff --git a/module/doc/model.php b/module/doc/model.php index ec02f17058..28f7146cf2 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1411,7 +1411,7 @@ class docModel extends model } if($type == 'project') { - $projects = $this->loadModel('project')->getListByCurrentUser('*', false); + $projects = $this->loadModel('project')->getListByCurrentUser(); $involvedProjects = $this->project->getInvolvedListByCurrentUser(); $spaceID = $this->project->checkAccess($spaceID, $projects); diff --git a/module/execution/model.php b/module/execution/model.php index 0f9d44910d..d25e4c7f64 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -108,7 +108,8 @@ class executionModel extends model if(!$executionID && $this->session->execution) $executionID = $this->session->execution; if(!$executionID) $executionID = key($executions); if($execution->multiple && !$execution->isTpl && !isset($executions[$executionID])) $executionID = key($executions); - if($execution->multiple && !$execution->isTpl && $executions && (!isset($executions[$executionID]) || !$this->checkPriv($executionID))) return $this->accessDenied(); + $canAccess = !empty($executions) && isset($executions[$executionID]) && $this->checkPriv($executionID); + if($execution->multiple && !$execution->isTpl && !$canAccess) return $this->accessDenied(); if(empty($executionID)) return; /* Replaces the iterated language with the stage. */ @@ -589,6 +590,7 @@ class executionModel extends model public function batchChangeStatus(array $executionIdList, string $status): array { /* Sort the IDs, the child stage comes first, and the parent stage follows. */ + if(!defined('AUTOTPL')) define('AUTOTPL', false); $executionList = $this->dao->select('id,name,status,grade,deliverable')->from(TABLE_EXECUTION)->where('id')->in($executionIdList)->orderBy('grade_desc')->fetchAll('id'); $this->loadModel('programplan'); diff --git a/module/project/control.php b/module/project/control.php index fe76dbbec2..18e0c1d80a 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -102,9 +102,10 @@ class project extends control $_COOKIE['showClosed'] = 1; $project = $this->project->fetchByID($projectID); + if(!empty($project->isTpl) && !defined('AUTOTPL')) define('AUTOTPL', false); /* Query user's project and program. */ - $projects = $this->project->getListByCurrentUser('*', !$project->isTpl); + $projects = $this->project->getListByCurrentUser(); $involvedProjects = $this->project->getInvolvedListByCurrentUser(); $programs = $this->loadModel('program')->getPairs(true); diff --git a/module/project/model.php b/module/project/model.php index bad53bd7e4..38cd4d3587 100755 --- a/module/project/model.php +++ b/module/project/model.php @@ -68,11 +68,10 @@ class projectModel extends model * Get project list by current user. * * @param string $fields - * @param bool $autoTpl * @access public * @return array */ - public function getListByCurrentUser(string $fields = '*', bool $autoTpl = true) :array + public function getListByCurrentUser(string $fields = '*') :array { return $this->dao->select($fields)->from(TABLE_PROJECT) ->where('type')->eq('project')