From cf704887b1e061446363b8e4116b03a53a256ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=98=B3?= Date: Tue, 27 May 2025 09:41:16 +0800 Subject: [PATCH 01/21] * [pipeline] adjust pipeline. --- .gitfox/lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitfox/lint.yaml b/.gitfox/lint.yaml index 318f4d8ff9..abf897e7cc 100644 --- a/.gitfox/lint.yaml +++ b/.gitfox/lint.yaml @@ -39,7 +39,7 @@ spec: type: run spec: container: - image: hub.zentao.net/ci/zentao-package:master + image: hub.zentao.net/ci/zentao-package:master-250527 script: - DOWNGRADE_CODE_DIR=$(mktemp -d) - mkdir $DOWNGRADE_CODE_DIR/diff From c27263c0375ec31e3a31d52968f5046945e4af61 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Mon, 26 May 2025 08:59:30 +0000 Subject: [PATCH 02/21] * [task#143677,done,0.3h,0h] Fix bug. --- lib/base/dao/dao.class.php | 6 +++--- module/project/model.php | 2 +- module/project/ui/view.html.php | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index 864bc41dfb..852612ab59 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -873,7 +873,7 @@ class baseDAO { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $sql, $matches) ? $matches[1] : ''; - $replace = $alias ? "wHeRe $alias.`isTpl` = '0' AND" : "wHeRe `isTpl` = '0' AND"; + $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe (`isTpl` = '0' OR `isTpl` IS NULL) AND"; $sql = str_ireplace("wHeRe", $replace, $sql); } else @@ -886,7 +886,7 @@ class baseDAO if(strpos($sql, "`$table`") !== false) { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $sql, $mainMatches) ? $mainMatches[1] : ''; - $replace = $alias ? "wHeRe $alias.`isTpl` = '0' AND" : "wHeRe `isTpl` = '0' AND"; + $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe (`isTpl` = '0' OR `isTpl` IS NULL) AND"; $sql = str_ireplace("wHeRe", $replace, $sql); } @@ -895,7 +895,7 @@ class baseDAO if(strpos($sql, "`$table`") !== false && !preg_match("/`isTpl`\s*=\s*('1'|1)/", $subSQL)) { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $subSQL, $subMatches) ? $subMatches[1] : ''; - $replace = $alias ? "wHeRe $alias.`isTpl` = '0' AND" : "wHeRe isTpl = '0' AND"; + $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe (`isTpl` = '0' OR `isTpl` IS NULL) AND"; $subSQL = str_ireplace("wHeRe", $replace, $subSQL); } $sql = str_ireplace("$$index", $subSQL, $sql); diff --git a/module/project/model.php b/module/project/model.php index 302d607324..a459fff199 100755 --- a/module/project/model.php +++ b/module/project/model.php @@ -1233,7 +1233,7 @@ class projectModel extends model $linkedProductsCount = $this->projectTao->getLinkedProductsCount($project, $postData->rawdata); } - $needCreateProduct = !$project->hasProduct || isset($postData->rawdata->newProduct) || empty($linkedProductsCount); + $needCreateProduct = !$project->hasProduct || isset($postData->rawdata->newProduct) || (empty($linkedProductsCount) && !$project->isTpl); if($needCreateProduct && !$this->projectTao->createProduct($projectID, $project, $postData, $program)) return false; /* Save order. */ diff --git a/module/project/ui/view.html.php b/module/project/ui/view.html.php index e3e719c0ed..ecbd679065 100644 --- a/module/project/ui/view.html.php +++ b/module/project/ui/view.html.php @@ -302,6 +302,7 @@ row /* Linked product and plan. */ $project->hasProduct ? h::table ( + setID('products'), setClass('table condensed bordered productsBox'), h::thead ( @@ -345,6 +346,7 @@ row /* Project team. */ h::table ( + setID('teams'), setClass('table condensed bordered teams ' . ($project->hasProduct ? 'mt-4' : '')), h::thead ( From e590d72705697293b2c1bca185bf863ff50c1c9d Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 02:05:12 +0000 Subject: [PATCH 03/21] * [task#143677,done,1h,0h] Fix search task error. --- module/execution/model.php | 16 ++++++++++++++-- module/programplan/model.php | 3 +++ module/project/zen.php | 2 +- module/task/tao.php | 3 +++ 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 8019d389c8..58e17f0edb 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1145,6 +1145,9 @@ class executionModel extends model { return $this->dao->select('*,whitelist')->from(TABLE_EXECUTION) ->where('id')->in($executionIdList) + ->andWhere('(isTpl')->eq('0') + ->orWhere('isTpl')->eq('1') + ->markRight(1) ->beginIF($mode != 'all')->andWhere('deleted')->eq(0)->fi() ->fetchAll('id'); } @@ -1448,9 +1451,9 @@ class executionModel extends model ->andWhere('t1.deleted')->eq('0') ->andWhere('t1.vision')->eq($this->config->vision) ->andWhere('t1.multiple')->eq('1') + ->andWhere('t1.isTpl')->eq($project->isTpl) ->beginIF($project->model == 'ipd')->andWhere('t1.enabled')->eq('on')->fi() - ->beginIF($project->isTpl)->andWhere('t1.isTpl')->eq('1')->fi() - ->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() + ->beginIF(!$this->app->user->admin && !$project->isTpl)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() ->beginIF(!empty($executionQuery))->andWhere($executionQuery)->fi() ->beginIF($productID)->andWhere('t3.product')->eq($productID)->fi() ->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi() @@ -1986,6 +1989,9 @@ class executionModel extends model ->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where('t1.deleted')->eq(0) + ->andWhere('(t1.isTpl')->eq('0') + ->orWhere('t1.isTpl')->eq('1') + ->markRight(1) ->beginIF($filterStatus)->andWhere('t1.status')->notin('closed,cancel')->fi() ->andWhere('t1.execution')->in($executionIdList) ->orderBy('t1.order_asc, t1.id_desc') @@ -3756,6 +3762,9 @@ class executionModel extends model ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account') ->where('t1.deleted')->eq(0) + ->andWhere('(t1.isTpl')->eq('0') + ->orWhere('t1.isTpl')->eq('1') + ->markRight(1) ->andWhere($condition) ->orderBy($orderBy) ->page($pager, 't1.id') @@ -5244,6 +5253,9 @@ class executionModel extends model return $this->dao->select('id,name')->from(TABLE_EXECUTION) ->where('id')->in($executionIdList) + ->andWhere('(isTpl')->eq('1') + ->orWhere('isTpl')->eq('0') + ->markRight(1) ->beginIF(!empty($type))->andWhere('type')->in($type)->fi() ->orderBy($orderBy) ->fetchPairs(); diff --git a/module/programplan/model.php b/module/programplan/model.php index 8634d78d33..f1d62fafea 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -867,6 +867,9 @@ class programplanModel extends model $tasks = $this->dao->select('t1.*,t2.version AS latestStoryVersion, t2.status AS storyStatus')->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where('t1.deleted')->eq(0) + ->andWhere('(t1.isTpl')->eq('0') + ->orWhere('t1.isTpl')->eq('1') + ->markRight(1) ->andWhere('t1.project')->eq($projectID) ->andWhere('t1.execution')->in($planIdList) ->orderBy('execution_asc, order_asc, id_asc') diff --git a/module/project/zen.php b/module/project/zen.php index e6c8884eaf..cdefdb4e7c 100755 --- a/module/project/zen.php +++ b/module/project/zen.php @@ -329,7 +329,7 @@ class projectZen extends project $hasProduct = isset($copyProject->hasProduct) ? $copyProject->hasProduct : 1; if($this->config->edition != 'open') { - $workflowGroups = $this->loadModel('workflowgroup')->getPairs('project', $model, $hasProduct, 'normal', '0'); + $workflowGroups = $this->loadModel('workflowgroup')->getPairs('project', $model, (int)$hasProduct, 'normal', '0'); $this->view->workflowGroupPairs = $workflowGroups; $this->view->workflowGroups = $this->workflowgroup->appendBuildinLabel($workflowGroups); } diff --git a/module/task/tao.php b/module/task/tao.php index d3fb94ff4d..1661a4353d 100644 --- a/module/task/tao.php +++ b/module/task/tao.php @@ -486,6 +486,8 @@ class taskTao extends taskModel $actionIDList = array(); if($type == 'assignedbyme') $actionIDList = $this->dao->select('objectID')->from(TABLE_ACTION)->where('objectType')->eq('task')->andWhere('action')->eq('assigned')->andWhere('actor')->eq($this->app->user->account)->fetchPairs('objectID', 'objectID'); + $execution = $this->fetchByID($executionID, 'project'); + $tasks = $this->dao->select($fields) ->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') @@ -493,6 +495,7 @@ class taskTao extends taskModel ->beginIF($productID)->leftJoin(TABLE_MODULE)->alias('t4')->on('t1.module = t4.id')->fi() ->beginIF($this->config->edition == 'max' or $this->config->edition == 'ipd')->leftJoin(TABLE_DESIGN)->alias('t5')->on('t1.design= t5.id')->fi() ->where('t1.execution')->eq((int)$executionID) + ->beginIF($execution->isTpl)->andWhere('t1.isTpl')->eq('1')->fi() ->beginIF($type == 'myinvolved') ->andWhere("((t3.`account` = '{$this->app->user->account}') OR t1.`assignedTo` = '{$this->app->user->account}' OR t1.`finishedby` = '{$this->app->user->account}')") ->fi() From 8e94ea9efea26eb403314be9c8dccea451919f05 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 02:08:30 +0000 Subject: [PATCH 04/21] * Optimize code. --- lib/base/dao/dao.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index 852612ab59..70e945d33d 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -873,7 +873,7 @@ class baseDAO { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $sql, $matches) ? $matches[1] : ''; - $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe (`isTpl` = '0' OR `isTpl` IS NULL) AND"; + $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe `isTpl` = '0' AND"; $sql = str_ireplace("wHeRe", $replace, $sql); } else @@ -886,7 +886,7 @@ class baseDAO if(strpos($sql, "`$table`") !== false) { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $sql, $mainMatches) ? $mainMatches[1] : ''; - $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe (`isTpl` = '0' OR `isTpl` IS NULL) AND"; + $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe `isTpl` = '0' AND"; $sql = str_ireplace("wHeRe", $replace, $sql); } @@ -895,7 +895,7 @@ class baseDAO if(strpos($sql, "`$table`") !== false && !preg_match("/`isTpl`\s*=\s*('1'|1)/", $subSQL)) { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $subSQL, $subMatches) ? $subMatches[1] : ''; - $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe (`isTpl` = '0' OR `isTpl` IS NULL) AND"; + $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe `isTpl` = '0' AND"; $subSQL = str_ireplace("wHeRe", $replace, $subSQL); } $sql = str_ireplace("$$index", $subSQL, $sql); From abbe30163f1656d762b986020bf1d601d2ef259c Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 05:42:17 +0000 Subject: [PATCH 05/21] * Optimize code. --- lib/base/dao/dao.class.php | 6 +++--- module/product/model.php | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index 70e945d33d..5ef6316aec 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -873,7 +873,7 @@ class baseDAO { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $sql, $matches) ? $matches[1] : ''; - $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe `isTpl` = '0' AND"; + $replace = $alias ? "wHeRe $alias.`isTpl` = '0' AND" : "wHeRe `isTpl` = '0' AND"; $sql = str_ireplace("wHeRe", $replace, $sql); } else @@ -886,7 +886,7 @@ class baseDAO if(strpos($sql, "`$table`") !== false) { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $sql, $mainMatches) ? $mainMatches[1] : ''; - $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe `isTpl` = '0' AND"; + $replace = $alias ? "wHeRe $alias.`isTpl` = '0' AND" : "wHeRe `isTpl` = '0' AND"; $sql = str_ireplace("wHeRe", $replace, $sql); } @@ -895,7 +895,7 @@ class baseDAO if(strpos($sql, "`$table`") !== false && !preg_match("/`isTpl`\s*=\s*('1'|1)/", $subSQL)) { $alias = preg_match("/`$table`\s+as\s+(\w+)/i", $subSQL, $subMatches) ? $subMatches[1] : ''; - $replace = $alias ? "wHeRe ($alias.`isTpl` = '0' OR $alias.`isTpl` IS NULL) AND" : "wHeRe `isTpl` = '0' AND"; + $replace = $alias ? "wHeRe $alias.`isTpl` = '0' AND" : "wHeRe `isTpl` = '0' AND"; $subSQL = str_ireplace("wHeRe", $replace, $subSQL); } $sql = str_ireplace("$$index", $subSQL, $sql); diff --git a/module/product/model.php b/module/product/model.php index 631c7670fb..9f02124a1d 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -1633,6 +1633,12 @@ class productModel extends model ->beginIF($status == 'involved')->leftJoin(TABLE_PROJECTPRODUCT)->alias('t3')->on('t3.product = t1.id')->fi() ->beginIF($status == 'involved')->leftJoin(TABLE_TEAM)->alias('t4')->on("t4.root = t3.project and t4.type='project'")->fi() ->where('t1.deleted')->eq(0) + ->beginIF(!$programID) + ->andWhere('(t2.`isTpl`')->eq('0') + ->orWhere('t2.`isTpl`')->eq('1') + ->orWhere('t2.`isTpl`')->isNULL() + ->markRight(1) + ->fi() ->beginIF($shadow !== 'all')->andWhere('t1.shadow')->eq((int)$shadow)->fi() ->beginIF($programID)->andWhere('t1.program')->eq($programID)->fi() ->beginIF($line > 0)->andWhere('t1.line')->eq($line)->fi() From 71112c020d9712b5bbdb2ca03803f4ca936184c5 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:04:31 +0000 Subject: [PATCH 06/21] * Add unittest extract. --- module/task/tao.php | 4 ++-- module/task/test/tao/fetchexecutiontasks.php | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/module/task/tao.php b/module/task/tao.php index 1661a4353d..6f795ece95 100644 --- a/module/task/tao.php +++ b/module/task/tao.php @@ -486,7 +486,7 @@ class taskTao extends taskModel $actionIDList = array(); if($type == 'assignedbyme') $actionIDList = $this->dao->select('objectID')->from(TABLE_ACTION)->where('objectType')->eq('task')->andWhere('action')->eq('assigned')->andWhere('actor')->eq($this->app->user->account)->fetchPairs('objectID', 'objectID'); - $execution = $this->fetchByID($executionID, 'project'); + if($executionID) $execution = $this->fetchByID($executionID, 'project'); $tasks = $this->dao->select($fields) ->from(TABLE_TASK)->alias('t1') @@ -495,7 +495,7 @@ class taskTao extends taskModel ->beginIF($productID)->leftJoin(TABLE_MODULE)->alias('t4')->on('t1.module = t4.id')->fi() ->beginIF($this->config->edition == 'max' or $this->config->edition == 'ipd')->leftJoin(TABLE_DESIGN)->alias('t5')->on('t1.design= t5.id')->fi() ->where('t1.execution')->eq((int)$executionID) - ->beginIF($execution->isTpl)->andWhere('t1.isTpl')->eq('1')->fi() + ->beginIF(!empty($execution->isTpl))->andWhere('t1.isTpl')->eq('1')->fi() ->beginIF($type == 'myinvolved') ->andWhere("((t3.`account` = '{$this->app->user->account}') OR t1.`assignedTo` = '{$this->app->user->account}' OR t1.`finishedby` = '{$this->app->user->account}')") ->fi() diff --git a/module/task/test/tao/fetchexecutiontasks.php b/module/task/test/tao/fetchexecutiontasks.php index 0ccf30f6d6..ef79fb4124 100755 --- a/module/task/test/tao/fetchexecutiontasks.php +++ b/module/task/test/tao/fetchexecutiontasks.php @@ -66,6 +66,18 @@ title=taskModel->fetchExecutionTasks(); timeout=0 cid=1 + +- 测试获取执行ID 2 product 1 type array('wait', 'doing', 'done', 'pause', 'cancel') module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 +- 测试获取执行ID 2 product 1 type array('wait', 'doing', 'done', 'pause', 'cancel') module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 +- 测试获取执行ID 2 product 0 type all module array(2) orederBy 'status_asc, id_desc' 的任务第2条的name属性 @任务2 +- 测试获取执行ID 2 product 0 type all module array(2) orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 2 product 0 type all module array(8) orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 2 product 0 type all module array(8) orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 2 product 0 type all module array(2,8) orederBy 'status_asc, id_desc' 的任务第2条的name属性 @任务2 +- 测试获取执行ID 2 product 0 type all module array(2,8) orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 2 product 0 type all module 空 orederBy 'pri_desc' 的任务第20条的name属性 @任务20 +- 测试获取执行ID 2 product 0 type all module 空 orederBy 'pri_desc' 的任务数量 @10 + */ $executionIdList = array(0, 1, 2); From c26c27082b9577c53e50b316436338d12bfa89ad Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:04:53 +0000 Subject: [PATCH 07/21] * Add unittest extract. --- module/task/test/tao/fetchexecutiontasks.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/module/task/test/tao/fetchexecutiontasks.php b/module/task/test/tao/fetchexecutiontasks.php index ef79fb4124..9bced55531 100755 --- a/module/task/test/tao/fetchexecutiontasks.php +++ b/module/task/test/tao/fetchexecutiontasks.php @@ -66,7 +66,19 @@ title=taskModel->fetchExecutionTasks(); timeout=0 cid=1 +- 测试获取执行ID 0 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 0 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 1 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 2 product 1 type wait module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 2 product 1 type doing module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 2 product 1 type doing module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 2 product 1 type done module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 2 product 1 type done module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 2 product 1 type pause module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 +- 测试获取执行ID 2 product 1 type pause module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 +- 测试获取执行ID 2 product 1 type cancel module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 2 product 1 type cancel module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 - 测试获取执行ID 2 product 1 type array('wait', 'doing', 'done', 'pause', 'cancel') module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 - 测试获取执行ID 2 product 1 type array('wait', 'doing', 'done', 'pause', 'cancel') module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 - 测试获取执行ID 2 product 0 type all module array(2) orederBy 'status_asc, id_desc' 的任务第2条的name属性 @任务2 From cb8a751aeadd186c1d670e367d0c28b36baa8f42 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:05:13 +0000 Subject: [PATCH 08/21] * Add unittest extract. --- module/task/test/tao/fetchexecutiontasks.php | 21 ++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/module/task/test/tao/fetchexecutiontasks.php b/module/task/test/tao/fetchexecutiontasks.php index 9bced55531..8e346e107d 100755 --- a/module/task/test/tao/fetchexecutiontasks.php +++ b/module/task/test/tao/fetchexecutiontasks.php @@ -69,7 +69,28 @@ cid=1 - 测试获取执行ID 0 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务 @0 - 测试获取执行ID 0 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 - 测试获取执行ID 1 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 1 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @10 +- 测试获取执行ID 1 product 1 type all module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 2 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务第18条的name属性 @任务18 +- 测试获取执行ID 2 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @10 +- 测试获取执行ID 2 product 1 type all module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 +- 测试获取执行ID 2 product 1 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 2 product 1 type assignedbyme module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 2 product 1 type assignedbyme module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 2 product 1 type myinvolved module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 +- 测试获取执行ID 2 product 1 type myinvolved module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 2 product 1 type undone module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 +- 测试获取执行ID 2 product 1 type undone module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 +- 测试获取执行ID 2 product 1 type needconfirm module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 +- 测试获取执行ID 2 product 1 type needconfirm module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 2 product 1 type assignedtome module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 +- 测试获取执行ID 2 product 1 type assignedtome module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 2 product 1 type finishedbyme module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 +- 测试获取执行ID 2 product 1 type finishedbyme module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 2 product 1 type delayed module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 2 product 1 type delayed module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 2 product 1 type wait module 空 orederBy 'status_asc, id_desc' 的任务 @0 - 测试获取执行ID 2 product 1 type wait module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 - 测试获取执行ID 2 product 1 type doing module 空 orederBy 'status_asc, id_desc' 的任务 @0 - 测试获取执行ID 2 product 1 type doing module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 From 9b8b803715bdd0a6a437cdceffa724ce37eab907 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:05:23 +0000 Subject: [PATCH 09/21] * Add unittest extract. --- module/task/test/tao/fetchexecutiontasks.php | 31 +++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/module/task/test/tao/fetchexecutiontasks.php b/module/task/test/tao/fetchexecutiontasks.php index 8e346e107d..a5cf587b8f 100755 --- a/module/task/test/tao/fetchexecutiontasks.php +++ b/module/task/test/tao/fetchexecutiontasks.php @@ -71,7 +71,36 @@ cid=1 - 测试获取执行ID 1 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 - 测试获取执行ID 1 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @10 - 测试获取执行ID 1 product 1 type all module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 - +- 测试获取执行ID 1 product 1 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 1 product 1 type undone module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 1 product 1 type needconfirm module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 1 product 1 type needconfirm module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 1 product 1 type assignedtome module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 1 product 1 type assignedtome module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 +- 测试获取执行ID 1 product 1 type finishedbyme module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 1 product 1 type finishedbyme module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 +- 测试获取执行ID 1 product 1 type delayed module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 1 product 1 type delayed module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 1 product 1 type wait module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 1 product 1 type wait module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 +- 测试获取执行ID 1 product 1 type doing module 空 orederBy 'status_asc, id_desc' 的任务第11条的name属性 @任务11 +- 测试获取执行ID 1 product 1 type doing module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 +- 测试获取执行ID 1 product 1 type done module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 1 product 1 type done module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 1 product 1 type pause module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 1 product 1 type pause module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 1 product 1 type cancel module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 1 product 1 type cancel module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 1 product 1 type array('wait', 'doing', 'done', 'pause', 'cancel') module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 1 product 1 type array('wait', 'doing', 'done', 'pause', 'cancel') module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 1 product 0 type all module array(2) orederBy 'status_asc, id_desc' 的任务第17条的name属性 @任务17 +- 测试获取执行ID 1 product 0 type all module array(2) orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 1 product 0 type all module array(8) orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 1 product 0 type all module array(8) orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 1 product 0 type all module array(2,8) orederBy 'status_asc, id_desc' 的任务第17条的name属性 @任务17 +- 测试获取执行ID 1 product 0 type all module array(2,8) orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 1 product 0 type all module 空 orederBy 'pri_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 1 product 0 type all module 空 orederBy 'pri_desc' 的任务数量 @10 - 测试获取执行ID 2 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务第18条的name属性 @任务18 - 测试获取执行ID 2 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @10 - 测试获取执行ID 2 product 1 type all module 空 orederBy 'status_asc, id_desc' 的任务第6条的name属性 @任务6 From 3d4ed4717f0913a2bd51f2787ca1a78f9a83fbde Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:05:32 +0000 Subject: [PATCH 10/21] * Add unittest extract. --- module/task/test/tao/fetchexecutiontasks.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/module/task/test/tao/fetchexecutiontasks.php b/module/task/test/tao/fetchexecutiontasks.php index a5cf587b8f..ecd079cd5e 100755 --- a/module/task/test/tao/fetchexecutiontasks.php +++ b/module/task/test/tao/fetchexecutiontasks.php @@ -72,6 +72,11 @@ cid=1 - 测试获取执行ID 1 product 0 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @10 - 测试获取执行ID 1 product 1 type all module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 - 测试获取执行ID 1 product 1 type all module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 +- 测试获取执行ID 1 product 1 type assignedbyme module 空 orederBy 'status_asc, id_desc' 的任务 @0 +- 测试获取执行ID 1 product 1 type assignedbyme module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 +- 测试获取执行ID 1 product 1 type myinvolved module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 +- 测试获取执行ID 1 product 1 type myinvolved module 空 orederBy 'status_asc, id_desc' 的任务数量 @1 +- 测试获取执行ID 1 product 1 type undone module 空 orederBy 'status_asc, id_desc' 的任务第1条的name属性 @任务1 - 测试获取执行ID 1 product 1 type undone module 空 orederBy 'status_asc, id_desc' 的任务数量 @2 - 测试获取执行ID 1 product 1 type needconfirm module 空 orederBy 'status_asc, id_desc' 的任务 @0 - 测试获取执行ID 1 product 1 type needconfirm module 空 orederBy 'status_asc, id_desc' 的任务数量 @0 From 5cc1f363b3757ca8b7cf829371e942b27edf8353 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:07:00 +0000 Subject: [PATCH 11/21] * Add unittest extract. --- module/project/test/model/create.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module/project/test/model/create.php b/module/project/test/model/create.php index 03e4c72525..5c1c6c0825 100755 --- a/module/project/test/model/create.php +++ b/module/project/test/model/create.php @@ -18,6 +18,12 @@ title=测试 projectModel->create(); timeout=0 cid=1 +- 执行projectClass模块的create方法,参数是$normalProject, $postData 属性name @测试新增项目一 +- 执行projectClass模块的create方法,参数是$emptyNameProject, $postData 第message[name]条的0属性 @『项目名称』不能为空。 +- 执行projectClass模块的create方法,参数是$emptyEndProject, $postData 第message[end]条的0属性 @『计划完成』不能为空。 +- 执行projectClass模块的create方法,参数是$beginGtEndProject, $postData 第message[end]条的0属性 @『计划完成』应当大于『2022-02-07』。 +- 执行projectClass模块的create方法,参数是$emptyBeginProject, $postData 第message[begin]条的0属性 @『计划开始』不能为空。 + */ global $tester; From 5fd95ebc4a2d2aedc1245ccca4f007c27c35df14 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:10:11 +0000 Subject: [PATCH 12/21] * Add unittest extract. --- module/execution/test/model/getpairsbylist.php | 6 ++++++ module/execution/test/model/getsearchtasks.php | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/module/execution/test/model/getpairsbylist.php b/module/execution/test/model/getpairsbylist.php index 941b4f3b89..cf8d712b63 100644 --- a/module/execution/test/model/getpairsbylist.php +++ b/module/execution/test/model/getpairsbylist.php @@ -13,6 +13,12 @@ title=测试executionModel->getByIdListTest(); timeout=0 cid=1 +- 测试查找执行 ID 1 2 3 的名称 @项目集1,项目集2,项目集3 +- 测试查找执行 ID 4 5 6 的名称 @项目集4,项目集5,项目集6 +- 测试查找执行 ID 7 8 9 的名称 @项目集7,项目集8,项目集9 +- 测试查找执行 ID 10 11 12 的名称 @项目集10,项目11,项目12 +- 测试查找执行 ID 13 14 15 的名称 @项目13,项目14,项目15 + */ $executionIdList = array('1,2,3', '4,5,6', '7,8,9', '10,11,12', '13,14,15'); diff --git a/module/execution/test/model/getsearchtasks.php b/module/execution/test/model/getsearchtasks.php index eacd888731..ba9b47087d 100755 --- a/module/execution/test/model/getsearchtasks.php +++ b/module/execution/test/model/getsearchtasks.php @@ -39,6 +39,23 @@ title=executionModel->getSearchTasks(); timeout=0 cid=1 +- 测试通过sql语句获取3个任务 id 倒序 execution = '3' and deleted = '0' and parent >= 0第10条的name属性 @任务10 +- 测试通过sql语句获取3个任务 id 正序 execution = '3' and deleted = '0' and parent >= 0第1条的name属性 @任务1 +- 测试通过sql语句获取5个任务 id 倒序 execution = '3' and deleted = '0' and parent >= 0第10条的name属性 @任务10 +- 测试通过sql语句获取5个任务 id 正序 execution = '3' and deleted = '0' and parent >= 0第1条的name属性 @任务1 +- 测试通过sql语句获取3个任务 id 倒序 type = 'devel' and fromBug != '0' and parent >= 0第8条的name属性 @任务8 +- 测试通过sql语句获取3个任务 id 正序 type = 'devel' and fromBug != '0' and parent >= 0第2条的name属性 @任务2 +- 测试通过sql语句获取5个任务 id 倒序 type = 'devel' and fromBug != '0' and parent >= 0第8条的name属性 @任务8 +- 测试通过sql语句获取5个任务 id 正序 type = 'devel' and fromBug != '0' and parent >= 0第2条的name属性 @任务2 +- 测试通过sql语句获取3个任务 id 倒序 execution = '3' and story != '0' and parent >= 0第10条的name属性 @任务10 +- 测试通过sql语句获取3个任务 id 正序 execution = '3' and story != '0' and parent >= 0第2条的name属性 @任务2 +- 测试通过sql语句获取5个任务 id 倒序 execution = '3' and story != '0' and parent >= 0第10条的name属性 @任务10 +- 测试通过sql语句获取5个任务 id 正序 execution = '3' and story != '0' and parent >= 0第2条的name属性 @任务2 +- 测试通过sql语句获取3个任务 id 倒序 module like '%2%' and type = 'design' and parent >= 0第6条的name属性 @任务6 +- 测试通过sql语句获取3个任务 id 正序 module like '%2%' and type = 'design' and parent >= 0第6条的name属性 @任务6 +- 测试通过sql语句获取5个任务 id 倒序 module like '%2%' and type = 'design' and parent >= 0第6条的name属性 @任务6 +- 测试通过sql语句获取5个任务 id 正序 module like '%2%' and type = 'design' and parent >= 0第6条的name属性 @任务6 + */ $condition = array(); From 74f8b669daf64cb55fed206cd819353454fbbb4b Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:10:25 +0000 Subject: [PATCH 13/21] * Add unittest extract. --- .../test/model/gettaskgroupbyexecution.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/module/execution/test/model/gettaskgroupbyexecution.php b/module/execution/test/model/gettaskgroupbyexecution.php index af6dc048f4..32ae4004a8 100755 --- a/module/execution/test/model/gettaskgroupbyexecution.php +++ b/module/execution/test/model/gettaskgroupbyexecution.php @@ -43,6 +43,21 @@ title=测试 executionModel->getTaskGroupByExecution(); timeout=0 cid=1 +- 测试空数据 @0 +- 测试获取执行的任务 @3 +- 测试获取执行ID=3的任务关联需求版本跟需求状态 + - 第1条的storyVersion属性 @1 + - 第1条的storyStatus属性 @active + - 第1条的needConfirm属性 @~~ +- 测试获取执行ID=4的任务关联需求版本跟需求状态 + - 第2条的storyVersion属性 @1 + - 第2条的storyStatus属性 @~~ + - 第2条的needConfirm属性 @~~ +- 测试获取执行ID=5的任务关联需求版本跟需求状态 + - 第9条的storyVersion属性 @2 + - 第9条的storyStatus属性 @active + - 第9条的needConfirm属性 @1 + */ From b0ded566c1de93afed4f5e1cea3a94107da1e36e Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:14:11 +0000 Subject: [PATCH 14/21] * Add unittest extract. --- .../test/model/fetchexecutionlist.php | 22 +++++++++++++++++++ module/execution/test/model/getbyidlist.php | 14 +++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/module/execution/test/model/fetchexecutionlist.php b/module/execution/test/model/fetchexecutionlist.php index 47e28d60a5..00b15e1b62 100755 --- a/module/execution/test/model/fetchexecutionlist.php +++ b/module/execution/test/model/fetchexecutionlist.php @@ -23,6 +23,28 @@ title=测试 executionModel->fetchExecutionList(); timeout=0 cid=1 + +- 获取敏捷项目下未关闭的执行 + - 第101条的project属性 @11 + - 第101条的name属性 @迭代5 +- 获取敏捷项目下未开始的执行 + - 第101条的project属性 @11 + - 第101条的name属性 @迭代5 +- 获取敏捷项目下进行中的执行 + - 第103条的project属性 @11 + - 第103条的name属性 @迭代7 +- 获取敏捷项目下已暂停的执行 @0 +- 获取敏捷项目下已关闭的执行 @0 +- 获取敏捷项目下我参与的执行 + - 第103条的project属性 @11 + - 第103条的name属性 @迭代7 +- 获取敏捷项目下按照开始日期倒序排列全部的执行 + - 第103条的project属性 @11 + - 第103条的name属性 @迭代7 +- 获取按照开始日期倒序排列执行 + - 第126条的project属性 @100 + - 第126条的name属性 @看板30 + */ $projectIdList = array(0, 11); diff --git a/module/execution/test/model/getbyidlist.php b/module/execution/test/model/getbyidlist.php index 56d145438c..8bca2d8490 100755 --- a/module/execution/test/model/getbyidlist.php +++ b/module/execution/test/model/getbyidlist.php @@ -22,6 +22,12 @@ title=测试executionModel->getByIdListTest(); timeout=0 cid=1 +- 敏捷项目查询第3条的name属性 @迭代1 +- 瀑布项目查询第4条的type属性 @stage +- 看板项目查询第5条的status属性 @doing +- 看板项目查询第5条的type属性 @kanban +- 看板项目查询第5条的name属性 @迭代3 + */ $executionIdList = array(3, 4, 5); @@ -31,6 +37,8 @@ $tester->loadModel('execution'); $executionList = $tester->execution->getByIdList($executionIdList); -r($executionList) && p('3:name') && e('迭代1'); // 敏捷项目查询 -r($executionList) && p('4:type') && e('stage'); // 瀑布项目查询 -r($executionList) && p('5:status') && e('doing'); // 看板项目查询 +r($executionList) && p('3:name') && e('迭代1'); // 敏捷项目查询 +r($executionList) && p('4:type') && e('stage'); // 瀑布项目查询 +r($executionList) && p('5:status') && e('doing'); // 看板项目查询 +r($executionList) && p('5:type') && e('kanban'); // 看板项目查询 +r($executionList) && p('5:name') && e('迭代3'); // 看板项目查询 From e2261a04f93dd93f65c3c65a3a61cfa23fd2eb4c Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:14:33 +0000 Subject: [PATCH 15/21] * Add unittest extract. --- .../execution/test/model/fetchexecutionlist.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/module/execution/test/model/fetchexecutionlist.php b/module/execution/test/model/fetchexecutionlist.php index 00b15e1b62..9b09bfd9a5 100755 --- a/module/execution/test/model/fetchexecutionlist.php +++ b/module/execution/test/model/fetchexecutionlist.php @@ -23,7 +23,20 @@ title=测试 executionModel->fetchExecutionList(); timeout=0 cid=1 - +- 获取没有限制条件时执行的个数 @20 +- 获取进行中执行的个数 @11 +- 获取敏捷项目1下的执行的个数 @3 +- 获取全部状态执行的个数 @24 +- 获取未关闭的执行的个数 @20 +- 获取未开始的执行的个数 @6 +- 获取进行中的执行的个数 @11 +- 获取已暂停的执行的个数 @3 +- 获取已关闭的执行的个数 @4 +- 获取我参与的执行的个数 @24 +- 获取关联产品5的执行的个数 @1 +- 获取敏捷项目下全部的执行 + - 第101条的project属性 @11 + - 第101条的name属性 @迭代5 - 获取敏捷项目下未关闭的执行 - 第101条的project属性 @11 - 第101条的name属性 @迭代5 From e07b7d45273cbb7b0fcd3c055366c7b0c4bb811b Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:17:45 +0000 Subject: [PATCH 16/21] * Fix unit test error. --- module/execution/model.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 58e17f0edb..ee01350216 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1442,7 +1442,7 @@ class executionModel extends model { /* Construct the query SQL at search executions. */ $executionQuery = $browseType == 'bySearch' ? $this->getExecutionQuery($param) : ''; - $project = $this->dao->select('model,isTpl')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch(); + if($projectID) $project = $this->dao->select('model,isTpl')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch(); return $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') @@ -1451,8 +1451,8 @@ class executionModel extends model ->andWhere('t1.deleted')->eq('0') ->andWhere('t1.vision')->eq($this->config->vision) ->andWhere('t1.multiple')->eq('1') - ->andWhere('t1.isTpl')->eq($project->isTpl) - ->beginIF($project->model == 'ipd')->andWhere('t1.enabled')->eq('on')->fi() + ->beginIF(!empty($project->isTpl))->andWhere('t1.isTpl')->eq('1')->fi() + ->beginIF(!empty($project->model) && $project->model == 'ipd')->andWhere('t1.enabled')->eq('on')->fi() ->beginIF(!$this->app->user->admin && !$project->isTpl)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() ->beginIF(!empty($executionQuery))->andWhere($executionQuery)->fi() ->beginIF($productID)->andWhere('t3.product')->eq($productID)->fi() From 81c43c1c9355fc441c8d7b7f0c0ee3cb694605d7 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:21:23 +0000 Subject: [PATCH 17/21] * Fix unit test error. --- module/execution/test/model/gettaskgroupbyexecution.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/execution/test/model/gettaskgroupbyexecution.php b/module/execution/test/model/gettaskgroupbyexecution.php index 32ae4004a8..8e2f8d14b2 100755 --- a/module/execution/test/model/gettaskgroupbyexecution.php +++ b/module/execution/test/model/gettaskgroupbyexecution.php @@ -31,7 +31,7 @@ $task->gen(10); $story = zenData('story'); $story->id->range('1-10'); -$story->status->range('active,changed'); +$story->status->range('active,changing'); $story->version->range('1{6},2{2},3{2}'); $story->gen(10); @@ -68,6 +68,6 @@ r($execution->getTaskGroupByExecutionTest()) && p() && e('0'); r($execution->getTaskGroupByExecutionTest($executionIdList)) && p() && e('3'); // 测试获取执行的任务 $taskGroup = $execution->getTaskGroupByExecutionTest($executionIdList, false); -r($taskGroup[3]) && p('1:storyVersion,storyStatus,needConfirm') && e('1,active,~~'); // 测试获取执行ID=3的任务关联需求版本跟需求状态 -r($taskGroup[4]) && p('2:storyVersion,storyStatus,needConfirm') && e('1,~~,~~'); // 测试获取执行ID=4的任务关联需求版本跟需求状态 -r($taskGroup[5]) && p('9:storyVersion,storyStatus,needConfirm') && e('2,active,1'); // 测试获取执行ID=5的任务关联需求版本跟需求状态 +r($taskGroup[3]) && p('1:storyVersion,storyStatus,needConfirm') && e('1,active,~~'); // 测试获取执行ID=3的任务关联需求版本跟需求状态 +r($taskGroup[4]) && p('2:storyVersion,storyStatus,needConfirm') && e('1,changing,~~'); // 测试获取执行ID=4的任务关联需求版本跟需求状态 +r($taskGroup[5]) && p('9:storyVersion,storyStatus,needConfirm') && e('2,active,1'); // 测试获取执行ID=5的任务关联需求版本跟需求状态 From f1a6763e578d1bc43bdec4581da791740f2558a9 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 06:24:47 +0000 Subject: [PATCH 18/21] * Fix unit test error. --- module/execution/test/model/getsearchtasks.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/execution/test/model/getsearchtasks.php b/module/execution/test/model/getsearchtasks.php index ba9b47087d..6a1de13b6d 100755 --- a/module/execution/test/model/getsearchtasks.php +++ b/module/execution/test/model/getsearchtasks.php @@ -58,6 +58,10 @@ cid=1 */ +global $app; +$app->rawModule = 'execution'; +$app->rawMethod = 'task'; + $condition = array(); $condition[] = "t1.execution = '3' AND t1.deleted = '0' AND t1.parent >= 0"; $condition[] = "t1.type = 'devel' AND t1.fromBug != '0' AND t1.parent >= 0"; From 682642c46cbaaa3d6ca147c3c42c3984c9b17d84 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 07:43:38 +0000 Subject: [PATCH 19/21] * Optimize code. --- lib/base/dao/dao.class.php | 26 +++++++++++++++++++++++++- module/execution/model.php | 16 ++++------------ module/product/model.php | 7 +------ module/programplan/model.php | 4 +--- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index 5ef6316aec..cd2bf2facf 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -163,6 +163,15 @@ class baseDAO */ public $autoLang; + /** + * 是否自动增加isTpl条件。 + * If auto add isTpl statement. + * + * @var bool + * @access public + */ + public $autoTpl; + /** * 上一次插入的数据id。 * Last insert id. @@ -301,6 +310,20 @@ class baseDAO return $this; } + /** + * 设置autoTpl项。 + * Set autoTpl item. + * + * @param bool $autoTpl + * @access public + * @return void + */ + public function setAutoTpl($autoTpl) + { + $this->autoTpl = $autoTpl; + return $this; + } + /** * 重置属性。 * Reset the vars. @@ -316,6 +339,7 @@ class baseDAO $this->setMode(''); $this->setMethod(''); $this->setAutoLang(isset($this->config->framework->autoLang) and $this->config->framework->autoLang); + $this->setAutoTpl(true); } //-----根据请求的方式,调用sql类相应的方法(Call according method of sql class by query method. -----// @@ -859,7 +883,7 @@ class baseDAO $sql .= '(`' . implode('`,`', array_keys($values)) . '`)' . ' VALUES(' . implode(',', $values) . ')'; } - elseif($this->method == 'select' && $filterTpl) + elseif($this->method == 'select' && $filterTpl && $this->autoTpl) { /* 过滤模板类型的数据 */ foreach(array('project', 'task') as $table) diff --git a/module/execution/model.php b/module/execution/model.php index ee01350216..4cc3bcc3e8 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1145,10 +1145,8 @@ class executionModel extends model { return $this->dao->select('*,whitelist')->from(TABLE_EXECUTION) ->where('id')->in($executionIdList) - ->andWhere('(isTpl')->eq('0') - ->orWhere('isTpl')->eq('1') - ->markRight(1) ->beginIF($mode != 'all')->andWhere('deleted')->eq(0)->fi() + ->setAutoTpl(false) ->fetchAll('id'); } @@ -1989,12 +1987,10 @@ class executionModel extends model ->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where('t1.deleted')->eq(0) - ->andWhere('(t1.isTpl')->eq('0') - ->orWhere('t1.isTpl')->eq('1') - ->markRight(1) ->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(); @@ -3762,10 +3758,8 @@ class executionModel extends model ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account') ->where('t1.deleted')->eq(0) - ->andWhere('(t1.isTpl')->eq('0') - ->orWhere('t1.isTpl')->eq('1') - ->markRight(1) ->andWhere($condition) + ->setAutoTpl(false) ->orderBy($orderBy) ->page($pager, 't1.id') ->fetchAll('id'); @@ -5253,10 +5247,8 @@ class executionModel extends model return $this->dao->select('id,name')->from(TABLE_EXECUTION) ->where('id')->in($executionIdList) - ->andWhere('(isTpl')->eq('1') - ->orWhere('isTpl')->eq('0') - ->markRight(1) ->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 9f02124a1d..feb53a801b 100755 --- a/module/product/model.php +++ b/module/product/model.php @@ -1633,12 +1633,6 @@ class productModel extends model ->beginIF($status == 'involved')->leftJoin(TABLE_PROJECTPRODUCT)->alias('t3')->on('t3.product = t1.id')->fi() ->beginIF($status == 'involved')->leftJoin(TABLE_TEAM)->alias('t4')->on("t4.root = t3.project and t4.type='project'")->fi() ->where('t1.deleted')->eq(0) - ->beginIF(!$programID) - ->andWhere('(t2.`isTpl`')->eq('0') - ->orWhere('t2.`isTpl`')->eq('1') - ->orWhere('t2.`isTpl`')->isNULL() - ->markRight(1) - ->fi() ->beginIF($shadow !== 'all')->andWhere('t1.shadow')->eq((int)$shadow)->fi() ->beginIF($programID)->andWhere('t1.program')->eq($programID)->fi() ->beginIF($line > 0)->andWhere('t1.line')->eq($line)->fi() @@ -1659,6 +1653,7 @@ class productModel extends model ->andWhere("FIND_IN_SET('{$this->app->user->account}', t1.reviewers)") ->andWhere('t1.reviewStatus')->eq('doing') ->fi() + ->setAutoTpl(false) ->orderBy("{$programOrder}t1.line_desc, t1.order_asc") ->beginIF($limit > 0)->limit($limit)->fi() ->fetchAll('id'); diff --git a/module/programplan/model.php b/module/programplan/model.php index f1d62fafea..e67c87851b 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -867,11 +867,9 @@ class programplanModel extends model $tasks = $this->dao->select('t1.*,t2.version AS latestStoryVersion, t2.status AS storyStatus')->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where('t1.deleted')->eq(0) - ->andWhere('(t1.isTpl')->eq('0') - ->orWhere('t1.isTpl')->eq('1') - ->markRight(1) ->andWhere('t1.project')->eq($projectID) ->andWhere('t1.execution')->in($planIdList) + ->setAutoTpl(false) ->orderBy('execution_asc, order_asc, id_asc') ->fetchAll('id'); } From f1d6d4db45110b50c5256f8f72995066df9d64a9 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 07:44:35 +0000 Subject: [PATCH 20/21] * Optimize code. --- lib/base/dao/dao.class.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index cd2bf2facf..9949481f50 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -163,13 +163,6 @@ class baseDAO */ public $autoLang; - /** - * 是否自动增加isTpl条件。 - * If auto add isTpl statement. - * - * @var bool - * @access public - */ public $autoTpl; /** From 7f9b354c7d22cf0d4f40d9bdfcaa3d74cc534d13 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Tue, 27 May 2025 07:52:06 +0000 Subject: [PATCH 21/21] * Add comment. --- lib/base/dao/dao.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/base/dao/dao.class.php b/lib/base/dao/dao.class.php index 9949481f50..cd2bf2facf 100644 --- a/lib/base/dao/dao.class.php +++ b/lib/base/dao/dao.class.php @@ -163,6 +163,13 @@ class baseDAO */ public $autoLang; + /** + * 是否自动增加isTpl条件。 + * If auto add isTpl statement. + * + * @var bool + * @access public + */ public $autoTpl; /**