Merge branch dev/task-145049 of zentao/zentaopms (#9463)

This commit is contained in:
刘刚
2025-06-12 15:13:54 +08:00
committed by Gitfox
9 changed files with 15 additions and 9 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ class project extends control
$project = $this->project->fetchByID($projectID);
/* Query user's project and program. */
$projects = $this->project->getListByCurrentUser('*', empty($project->isTpl));
$projects = $this->project->getListByCurrentUser('*', !empty($project->isTpl) ? 'onlyTpl' : '');
$involvedProjects = $this->project->getInvolvedListByCurrentUser();
$programs = $this->loadModel('program')->getPairs(true);
+4 -3
View File
@@ -69,19 +69,20 @@ class projectModel extends model
* Get project list by current user.
*
* @param string $fields
* @param bool $filterTpl
* @param string $filterTpl
* @access public
* @return array
*/
public function getListByCurrentUser(string $fields = '*', bool $filterTpl = true) :array
public function getListByCurrentUser(string $fields = '*', string $filterTpl = '') :array
{
if(!$filterTpl) dao::$filterTpl = 'skip';
if($filterTpl == 'skip') dao::$filterTpl = 'skip';
return $this->dao->select($fields)->from(TABLE_PROJECT)
->where('type')->eq('project')
->beginIF($this->config->vision)->andWhere('vision')->eq($this->config->vision)->fi()
->andWhere('deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi()
->beginIF($filterTpl == 'onlyTpl')->andWhere('isTpl')->eq('1')->fi()
->orderBy('order_asc,id_desc')
->fetchAll('id');
}