diff --git a/module/execution/control.php b/module/execution/control.php index 3b27f3d616..b620b81181 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -506,9 +506,10 @@ class execution extends control $execution = $this->commonAction($toExecution); $toExecution = $execution->id; + $project = $this->loadModel('project')->getByID($execution->project); $branches = $this->execution->getBranches($toExecution); $tasks = $this->execution->getTasks2Imported($toExecution, $branches); - $executions = $this->execution->getToImport(array_keys($tasks), $execution->type); + $executions = $this->execution->getToImport(array_keys($tasks), $execution->type, $project->model); unset($executions[$toExecution]); unset($tasks[$toExecution]); diff --git a/module/execution/model.php b/module/execution/model.php index dab018c741..928965ab8d 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2799,17 +2799,19 @@ class executionModel extends model * Get executions to import * * @param array $executionIds - * @param string $type sprint|stage + * @param string $type sprint|stage|kanban + * @param string $model * @access public * @return array */ - public function getToImport($executionIds, $type) + public function getToImport($executionIds, $type, $model = '') { return $this->dao->select('t1.id,concat_ws(" / ", t2.name, t1.name) as name')->from(TABLE_EXECUTION)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t2.id=t1.project') ->where('t1.id')->in($executionIds) ->beginIF(!$this->app->user->admin)->andWhere('t1.id')->in($this->app->user->view->sprints)->fi() - ->andWhere('t1.type')->eq($type) + ->beginIF(empty($model) or strpos(',waterfallplus,agileplus,', ",$model,") === false)->andWhere('t1.type')->eq($type)->fi() + ->beginIF(!empty($model) and $model == 'agileplus')->andWhere('t1.type')->in(array('sprint', 'kanban'))->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy('t1.id desc') ->fetchPairs('id', 'name'); @@ -2894,6 +2896,7 @@ class executionModel extends model ->where('project')->in($brotherProjects) ->andWhere('multiple')->eq('1') ->andWhere('status')->ne('closed') + ->andWhere('deleted')->eq(0) ->fetchPairs('id'); $branches = str_replace(',', "','", $branches); diff --git a/test/model/programplan/getparentchildrentypes.php b/test/model/programplan/getparentchildrentypes.php index cb922b36c0..3ec31b3244 100755 --- a/test/model/programplan/getparentchildrentypes.php +++ b/test/model/programplan/getparentchildrentypes.php @@ -37,16 +37,12 @@ $parentIDList = array(1, 2, 3, 4); $programplan = new programplanTest(); r($programplan->getParentChildrenTypesTest($parentIDList[0])) && p('stage') && e('stage'); // 查找父ID为 1 未删除的阶段类型 stage -r($programplan->getParentChildrenTypesTest($parentIDList[0])) && p('sprint') && e(''); // 查找父ID为 1 未删除的阶段类型 sprint r($programplan->getParentChildrenTypesTest($parentIDList[0])) && p('kanban') && e('kanban'); // 查找父ID为 1 未删除的阶段类型 kanban r(count($programplan->getParentChildrenTypesTest($parentIDList[0]))) && p() && e('2'); // 查找父ID为 1 未删除的阶段类型数量 -r($programplan->getParentChildrenTypesTest($parentIDList[1])) && p('stage') && e(''); // 查找父ID为 2 未删除的阶段类型 stage r($programplan->getParentChildrenTypesTest($parentIDList[1])) && p('sprint') && e('sprint'); // 查找父ID为 2 未删除的阶段类型 sprint -r($programplan->getParentChildrenTypesTest($parentIDList[1])) && p('kanban') && e(''); // 查找父ID为 2 未删除的阶段类型 kanban r(count($programplan->getParentChildrenTypesTest($parentIDList[1]))) && p() && e('1'); // 查找父ID为 2 未删除的阶段类型数量 r($programplan->getParentChildrenTypesTest($parentIDList[2])) && p('stage') && e('stage'); // 查找父ID为 3 未删除的阶段类型 stage r($programplan->getParentChildrenTypesTest($parentIDList[2])) && p('sprint') && e('sprint'); // 查找父ID为 3 未删除的阶段类型 sprint -r($programplan->getParentChildrenTypesTest($parentIDList[2])) && p('kanban') && e(''); // 查找父ID为 3 未删除的阶段类型 kanban r(count($programplan->getParentChildrenTypesTest($parentIDList[2]))) && p() && e('2'); // 查找父ID为 3 未删除的阶段类型数量 r($programplan->getParentChildrenTypesTest($parentIDList[3])) && p('stage') && e('0'); // 查找父ID为 1 未删除的阶段类型 stage r($programplan->getParentChildrenTypesTest($parentIDList[3])) && p('sprint') && e('0'); // 查找父ID为 1 未删除的阶段类型 sprint diff --git a/test/model/stage/batchcreate.php b/test/model/stage/batchcreate.php index e2a2deaf0a..2b5e7cbf09 100755 --- a/test/model/stage/batchcreate.php +++ b/test/model/stage/batchcreate.php @@ -18,7 +18,7 @@ pid=1 测试批量创建瀑布项目的阶段 4 >> 7 测试批量创建瀑布项目的百分比为空的阶段 >> 『工作量占比』不能为空。 测试批量创建瀑布项目的类型为空的阶段 >> 『阶段类型』不能为空。 -测试批量创建瀑布项目的百分比非法的阶段 >> 工作量占比应当是数字,可以是小数。 +测试批量创建瀑布项目的百分比非法的阶段 >> 『工作量占比』应当是数字,可以是小数。 测试批量创建瀑布项目的百分比超出100的阶段 >> 工作量占比累计不应当超过100% 测试批量创建融合瀑布项目的阶段 1 >> 2 测试批量创建融合瀑布项目的阶段 2 >> 4 @@ -26,7 +26,7 @@ pid=1 测试批量创建融合瀑布项目的阶段 4 >> 7 测试批量创建融合瀑布项目的百分比为空的阶段 >> 『工作量占比』不能为空。 测试批量创建融合瀑布项目的类型为空的阶段 >> 『阶段类型』不能为空。 -测试批量创建融合瀑布项目的百分比非法的阶段 >> 工作量占比应当是数字,可以是小数。 +测试批量创建融合瀑布项目的百分比非法的阶段 >> 『工作量占比』应当是数字,可以是小数。 测试批量创建融合瀑布项目的百分比超出100的阶段 >> 工作量占比累计不应当超过100% */ @@ -64,19 +64,19 @@ $param8 = array('name' => $name1, 'percent' => $percentOver, 'type' => $ty $stage = new stageTest(); -r($stage->batchCreateTest($param1)) && p() && e('2'); // 测试批量创建瀑布项目的阶段 1 -r($stage->batchCreateTest($param2)) && p() && e('4'); // 测试批量创建瀑布项目的阶段 2 -r($stage->batchCreateTest($param3)) && p() && e('6'); // 测试批量创建瀑布项目的阶段 3 -r($stage->batchCreateTest($param4)) && p() && e('7'); // 测试批量创建瀑布项目的阶段 4 -r($stage->batchCreateTest($param5)) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试批量创建瀑布项目的百分比为空的阶段 -r($stage->batchCreateTest($param6)) && p('type:0') && e('『阶段类型』不能为空。'); // 测试批量创建瀑布项目的类型为空的阶段 -r($stage->batchCreateTest($param7)) && p('percent:0') && e('工作量占比应当是数字,可以是小数。'); // 测试批量创建瀑布项目的百分比非法的阶段 -r($stage->batchCreateTest($param8)) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试批量创建瀑布项目的百分比超出100的阶段 -r($stage->batchCreateTest($param1, 'waterfallplus')) && p() && e('2'); // 测试批量创建融合瀑布项目的阶段 1 -r($stage->batchCreateTest($param2, 'waterfallplus')) && p() && e('4'); // 测试批量创建融合瀑布项目的阶段 2 -r($stage->batchCreateTest($param3, 'waterfallplus')) && p() && e('6'); // 测试批量创建融合瀑布项目的阶段 3 -r($stage->batchCreateTest($param4, 'waterfallplus')) && p() && e('7'); // 测试批量创建融合瀑布项目的阶段 4 -r($stage->batchCreateTest($param5, 'waterfallplus')) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试批量创建融合瀑布项目的百分比为空的阶段 -r($stage->batchCreateTest($param6, 'waterfallplus')) && p('type:0') && e('『阶段类型』不能为空。'); // 测试批量创建融合瀑布项目的类型为空的阶段 -r($stage->batchCreateTest($param7, 'waterfallplus')) && p('percent:0') && e('工作量占比应当是数字,可以是小数。'); // 测试批量创建融合瀑布项目的百分比非法的阶段 -r($stage->batchCreateTest($param8, 'waterfallplus')) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试批量创建融合瀑布项目的百分比超出100的阶段 +r($stage->batchCreateTest($param1)) && p() && e('2'); // 测试批量创建瀑布项目的阶段 1 +r($stage->batchCreateTest($param2)) && p() && e('4'); // 测试批量创建瀑布项目的阶段 2 +r($stage->batchCreateTest($param3)) && p() && e('6'); // 测试批量创建瀑布项目的阶段 3 +r($stage->batchCreateTest($param4)) && p() && e('7'); // 测试批量创建瀑布项目的阶段 4 +r($stage->batchCreateTest($param5)) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试批量创建瀑布项目的百分比为空的阶段 +r($stage->batchCreateTest($param6)) && p('type:0') && e('『阶段类型』不能为空。'); // 测试批量创建瀑布项目的类型为空的阶段 +r($stage->batchCreateTest($param7)) && p('percent:0') && e('『工作量占比』应当是数字,可以是小数。'); // 测试批量创建瀑布项目的百分比非法的阶段 +r($stage->batchCreateTest($param8)) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试批量创建瀑布项目的百分比超出100的阶段 +r($stage->batchCreateTest($param1, 'waterfallplus')) && p() && e('2'); // 测试批量创建融合瀑布项目的阶段 1 +r($stage->batchCreateTest($param2, 'waterfallplus')) && p() && e('4'); // 测试批量创建融合瀑布项目的阶段 2 +r($stage->batchCreateTest($param3, 'waterfallplus')) && p() && e('6'); // 测试批量创建融合瀑布项目的阶段 3 +r($stage->batchCreateTest($param4, 'waterfallplus')) && p() && e('7'); // 测试批量创建融合瀑布项目的阶段 4 +r($stage->batchCreateTest($param5, 'waterfallplus')) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试批量创建融合瀑布项目的百分比为空的阶段 +r($stage->batchCreateTest($param6, 'waterfallplus')) && p('type:0') && e('『阶段类型』不能为空。'); // 测试批量创建融合瀑布项目的类型为空的阶段 +r($stage->batchCreateTest($param7, 'waterfallplus')) && p('percent:0') && e('『工作量占比』应当是数字,可以是小数。'); // 测试批量创建融合瀑布项目的百分比非法的阶段 +r($stage->batchCreateTest($param8, 'waterfallplus')) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试批量创建融合瀑布项目的百分比超出100的阶段 diff --git a/test/model/stage/getstages.php b/test/model/stage/getstages.php index a9d94c9d34..e458108db7 100755 --- a/test/model/stage/getstages.php +++ b/test/model/stage/getstages.php @@ -19,6 +19,8 @@ pid=1 */ +zdTable('stage')->gen(10); + $stage = new stageTest(); r($stage->getStagesTest()) && p('1:name,percent,type') && e('需求,10,request'); // 测试获取阶段 1 @@ -26,4 +28,4 @@ r($stage->getStagesTest()) && p('2:name,percent,type') && e('设计,10,design'); r($stage->getStagesTest()) && p('3:name,percent,type') && e('开发,50,dev'); // 测试获取阶段 3 r($stage->getStagesTest()) && p('4:name,percent,type') && e('测试,15,qa'); // 测试获取阶段 4 r($stage->getStagesTest()) && p('5:name,percent,type') && e('发布,10,release'); // 测试获取阶段 5 -r($stage->getStagesTest()) && p('6:name,percent,type') && e('总结评审,5,review'); // 测试获取阶段 6 \ No newline at end of file +r($stage->getStagesTest()) && p('6:name,percent,type') && e('总结评审,5,review'); // 测试获取阶段 6