From d80141e0e5feb83441e8cefd6f3a4aa583b7117e Mon Sep 17 00:00:00 2001 From: wangyuting Date: Thu, 29 May 2025 02:23:18 +0000 Subject: [PATCH] * [bug#62932,done,2h,0h] set template project autoTpl is false. --- lib/base/dao/dao.class.php | 1 + module/execution/model.php | 8 +++----- module/product/model.php | 4 ++-- module/programplan/model.php | 1 - module/project/model.php | 4 ++-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index f817b7fea2..f0e6ab0ecf 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -741,6 +741,7 @@ class baseDAO { $this->setTable($table); if($this->mode == 'raw') $this->sqlobj->from($table); + if((strpos($table, "`{$this->config->db->prefix}project`") !== false || strpos($table, "`{$this->config->db->prefix}task`") !== false) && defined('AUTOTPL')) $this->autoTpl = AUTOTPL; return $this; } diff --git a/module/execution/model.php b/module/execution/model.php index 453a026a14..0f9d44910d 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -144,8 +144,10 @@ class executionModel extends model } /* 模板执行过滤部分导航菜单。 */ - if($execution->isTpl) + if(!empty($execution->isTpl)) { + define('AUTOTPL', false); + /* 模板执行不显示1.5级导航。 */ $this->config->hasDropmenuApps = array_diff($this->config->hasDropmenuApps, array('project', 'execution')); @@ -1187,7 +1189,6 @@ class executionModel extends model return $this->dao->select('*,whitelist')->from(TABLE_EXECUTION) ->where('id')->in($executionIdList) ->beginIF($mode != 'all')->andWhere('deleted')->eq(0)->fi() - ->setAutoTpl(false) ->fetchAll('id'); } @@ -2031,7 +2032,6 @@ class executionModel extends model ->beginIF($filterStatus)->andWhere('t1.status')->notin('closed,cancel')->fi() ->andWhere('t1.execution')->in($executionIdList) ->orderBy('t1.order_asc, t1.id_desc') - ->setAutoTpl(false) ->fetchGroup('execution', 'id'); $today = helper::today(); @@ -3800,7 +3800,6 @@ class executionModel extends model ->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account') ->where('t1.deleted')->eq(0) ->andWhere($condition) - ->setAutoTpl(false) ->orderBy($orderBy) ->page($pager, 't1.id') ->fetchAll('id'); @@ -5289,7 +5288,6 @@ class executionModel extends model return $this->dao->select('id,name')->from(TABLE_EXECUTION) ->where('id')->in($executionIdList) ->beginIF(!empty($type))->andWhere('type')->in($type)->fi() - ->setAutoTpl(false) ->orderBy($orderBy) ->fetchPairs(); } diff --git a/module/product/model.php b/module/product/model.php index b266353ad6..0f143b857e 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -52,7 +52,7 @@ class productModel extends model */ public function getByIdList(array $productIdList): array { - return $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in($productIdList)->setAutoTpl(false)->fetchAll('id', false); + return $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in($productIdList)->fetchAll('id', false); } /** @@ -65,7 +65,7 @@ class productModel extends model */ public function getListByAcl(string $acl): array { - return $this->dao->select('id, program, PO, QD, RD, feedback, ticket, acl, whitelist, reviewer, PMT, createdBy')->from(TABLE_PRODUCT)->where('acl')->in($acl)->setAutoTpl(false)->fetchAll('id'); + return $this->dao->select('id, program, PO, QD, RD, feedback, ticket, acl, whitelist, reviewer, PMT, createdBy')->from(TABLE_PRODUCT)->where('acl')->in($acl)->fetchAll('id'); } /** diff --git a/module/programplan/model.php b/module/programplan/model.php index e67c87851b..8634d78d33 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -869,7 +869,6 @@ class programplanModel extends model ->where('t1.deleted')->eq(0) ->andWhere('t1.project')->eq($projectID) ->andWhere('t1.execution')->in($planIdList) - ->setAutoTpl(false) ->orderBy('execution_asc, order_asc, id_asc') ->fetchAll('id'); } diff --git a/module/project/model.php b/module/project/model.php index 4b369b158f..bad53bd7e4 100755 --- a/module/project/model.php +++ b/module/project/model.php @@ -47,7 +47,6 @@ class projectModel extends model return $this->dao->select('id, project, type, parent, path, openedBy, PO, PM, QD, RD, acl')->from(TABLE_PROJECT) ->where('acl')->in($acl) ->beginIF($type)->andWhere('type')->in($type)->fi() - ->setAutoTpl(false) ->fetchAll('id'); } @@ -80,7 +79,6 @@ class projectModel extends model ->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() - ->setAutoTpl($autoTpl) ->orderBy('order_asc,id_desc') ->fetchAll('id'); } @@ -2296,6 +2294,8 @@ class projectModel extends model if($project->acl == 'open') unset($this->lang->project->menu->settings['subMenu']->whitelist); if($this->app->getModuleName() == 'repo' || $this->app->getModuleName() == 'mr') $this->loadModel('repo')->setHideMenu($projectID); + + if(!empty($project->isTpl)) define('AUTOTPL', false); return $projectID; }