diff --git a/module/programplan/model.php b/module/programplan/model.php index f33a820366..d27f174dd5 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -197,7 +197,7 @@ class programplanModel extends model } $datas = $this->setRelationTask($planIdList, $datas); - + $datas['data'] = isset($datas['data']) ? array_values($datas['data']) : array(); return $returnJson ? json_encode($datas) : $datas; } @@ -1070,6 +1070,8 @@ class programplanModel extends model common::printIcon('execution', 'delete', "planID=$plan->id&confirm=no", $plan, 'list', 'trash', 'hiddenwin' , $disabled, '', '', $this->lang->programplan->delete); } break; + default: + break; } echo ''; } @@ -1363,13 +1365,14 @@ class programplanModel extends model } /** + * 检查是否为顶级。 * Check whether it is the top stage. * * @param int $planID * @access public * @return bool */ - public function checkTopStage($planID) + public function checkTopStage(int $planID): bool { $parentID = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($planID)->fetch('parent'); $parentType = $this->dao->select('type')->from(TABLE_EXECUTION)->where('id')->eq($parentID)->fetch('type'); diff --git a/module/programplan/test/model/checktopstage.php b/module/programplan/test/model/checktopstage.php index 6716884261..8dc815f28b 100755 --- a/module/programplan/test/model/checktopstage.php +++ b/module/programplan/test/model/checktopstage.php @@ -2,22 +2,11 @@ gen(5); su('admin'); -$execution = zdTable('project'); -$execution->id->range('1-5'); -$execution->name->range('瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b'); -$execution->type->range('project,stage{4}'); -$execution->project->range('0,1{4}'); -$execution->parent->range('0,1,2,3,1'); -$execution->path->range("`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`"); -$execution->status->range('doing,doing,doing,closed,suspended'); -$execution->openedBy->range('admin,user1'); -$execution->begin->range('20220112 000000:0')->type('timestamp')->format('YY/MM/DD'); -$execution->end->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD'); -$execution->realBegan->range('20220212 000000:0')->type('timestamp')->format('YY/MM/DD'); -$execution->gen(5); +zdTable('project')->config('checktopstage')->gen(5); /** @@ -25,14 +14,10 @@ title=测试programplanModel->checkTopStage(); cid=1 pid=1 -测试id为2判断是否为顶级阶段 >> 1 -测试id为4判断是否为顶级阶段 >> 0 -测试id为5判断是否为顶级阶段 >> 1 - */ $plan = new programplanTest(); -r($plan->checkTopStageTest(2)) && p('') && e(1); // 测试id为2判断是否为顶级阶段 -r($plan->checkTopStageTest(4)) && p('') && e(0); // 测试id为4判断是否为顶级阶段 -r($plan->checkTopStageTest(5)) && p('') && e(1); // 测试id为5判断是否为顶级阶段 +r($plan->checkTopStageTest(2)) && p('') && e('1'); // 测试id为2判断是否为顶级阶段 +r($plan->checkTopStageTest(4)) && p('') && e('0'); // 测试id为4判断是否为顶级阶段 +r($plan->checkTopStageTest(5)) && p('') && e('1'); // 测试id为5判断是否为顶级阶段 diff --git a/module/programplan/test/model/yaml/checktopstage/checktopstage.yaml b/module/programplan/test/model/yaml/checktopstage/checktopstage.yaml new file mode 100644 index 0000000000..16bf160fa3 --- /dev/null +++ b/module/programplan/test/model/yaml/checktopstage/checktopstage.yaml @@ -0,0 +1,25 @@ +title: checktopstage +author: jukui +version: '1.0' +fields: + - field: id + range: 1-5 + - field: project + range: 1-5 + - field: name + range: '瀑布项目1,阶段a,阶段a子1,阶段a子1子1,阶段b' + - field: parent + range: '0,1,2,3,1' + - field: type + range: 'project,stage{4}' + - field: grade + range: 1 + - field: days + range: 1 + - field: status + range: 'doing,doing,doing,closed,suspended' + - field: desc + range: 1-5 + prefix: '项目描述' + - field: path + range: "`,1,`,`,1,2,`,`,1,2,3,`,`,1,2,3,4,`,`,1,5,`" diff --git a/module/todo/test/model/getbyid.php b/module/todo/test/model/getbyid.php index 8d03e82c61..e7fce26308 100755 --- a/module/todo/test/model/getbyid.php +++ b/module/todo/test/model/getbyid.php @@ -27,4 +27,4 @@ initData(); r($todo->getByIDTest($todoIDList[0])) && p('name,status') && e('自定义的待办1,wait'); // 获取id为1的todo信息 r($todo->getByIDTest($todoIDList[1])) && p('name,status') && e('自定义的待办2,doing'); // 获取id为2的todo信息 r($todo->getByIDTest($todoIDList[3])) && p('name,status') && e('自定义的待办5,closed'); // 获取id为5的todo信息 -r($todo->getByIDTest($todoIDList[4])) && p() && e('0'); // 获取不存在的idtodo信息 +r($todo->getByIDTest($todoIDList[4])) && p() && e('0'); // 获取不存在的id todo信息