From 311b80803c4ec8793ebacbcf294ef2bd68fc7921 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 23 Jan 2026 13:16:22 +0800 Subject: [PATCH 1/3] * [bug#69226,done,1h] query template data when the project is template. --- module/execution/model.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/execution/model.php b/module/execution/model.php index 031ff5a1d8..d9c3343585 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1162,7 +1162,8 @@ class executionModel extends model $projectModel = ''; if($projectID) { - $projectModel = $this->dao->select('model')->from(TABLE_EXECUTION)->where('id')->eq($projectID)->andWhere('deleted')->eq(0)->fetch('model'); + $projectInfo = $this->dao->select('model,isTpl')->from(TABLE_EXECUTION)->where('id')->eq($projectID)->andWhere('deleted')->eq(0)->fetch(); + $projectModel = isset($projectInfo->model) ? $projectInfo->model : ''; $orderBy = in_array($projectModel, array('waterfall', 'waterfallplus')) ? 'sortStatus_asc,begin_asc,id_asc' : 'id_desc'; /* Waterfall execution, when all phases are closed, in reverse order of date. */ @@ -1171,6 +1172,8 @@ class executionModel extends model $statistic = $this->dao->select("count(id) as executions, sum(IF(INSTR('closed', status) < 1, 0, 1)) as closedExecutions")->from(TABLE_EXECUTION)->where('project')->eq($projectID)->andWhere('deleted')->eq('0')->fetch(); if($statistic->executions == $statistic->closedExecutions) $orderBy = 'sortStatus_asc,begin_desc,id_asc'; } + + if(!empty($projectInfo->isTpl)) $this->dao->filterTpl('never'); } /* Order by status's content whether or not done. */ From 74cacb5278b9db519f2c0205625833abe14321d9 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 23 Jan 2026 13:17:11 +0800 Subject: [PATCH 2/3] * [unittest] fix getPairs error. --- module/execution/test/model/getpairs.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/execution/test/model/getpairs.php b/module/execution/test/model/getpairs.php index 1190727ade..3710f6a452 100755 --- a/module/execution/test/model/getpairs.php +++ b/module/execution/test/model/getpairs.php @@ -57,7 +57,6 @@ $count = array(0, 1); $modeList = array('', 'all', 'noclosed', 'stagefilter', 'withdelete', 'multiple', 'leaf', 'order_asc', 'noprefix', 'withobject', 'hideMultiple'); $executionTester = new executionModelTest(); -$executionTester->executionModel->app->user->admin = true; r($executionTester->getPairsTest($projectIDList[0], $count[0], $modeList[0])) && p('105') && e('敏捷项目1(不启用迭代的项目)'); // 敏捷项目执行查看 r($executionTester->getPairsTest($projectIDList[1], $count[0], $modeList[0])) && p('109') && e('/阶段13'); // 瀑布项目执行查看 r($executionTester->getPairsTest($projectIDList[2], $count[0], $modeList[0])) && p('126') && e('/看板30'); // 看板项目执行查看 From a47ec256fde9062e0377957121ecc70857adcb79 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 23 Jan 2026 13:18:52 +0800 Subject: [PATCH 3/3] * [refac] adjust code order. --- module/execution/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index d9c3343585..59b07b9b0b 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1166,14 +1166,14 @@ class executionModel extends model $projectModel = isset($projectInfo->model) ? $projectInfo->model : ''; $orderBy = in_array($projectModel, array('waterfall', 'waterfallplus')) ? 'sortStatus_asc,begin_asc,id_asc' : 'id_desc'; + if(!empty($projectInfo->isTpl)) $this->dao->filterTpl('never'); + /* Waterfall execution, when all phases are closed, in reverse order of date. */ if(in_array($projectModel, array('waterfall', 'waterfallplus'))) { $statistic = $this->dao->select("count(id) as executions, sum(IF(INSTR('closed', status) < 1, 0, 1)) as closedExecutions")->from(TABLE_EXECUTION)->where('project')->eq($projectID)->andWhere('deleted')->eq('0')->fetch(); if($statistic->executions == $statistic->closedExecutions) $orderBy = 'sortStatus_asc,begin_desc,id_asc'; } - - if(!empty($projectInfo->isTpl)) $this->dao->filterTpl('never'); } /* Order by status's content whether or not done. */