From 9283507b207c5ff3eab4f7fe693f575fccd0d8bf Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 23 Feb 2023 02:11:30 +0000 Subject: [PATCH 01/20] * Finish task #85434. --- module/execution/model.php | 9 +++++++-- module/project/model.php | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 175741a1cc..b594e4bd77 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -450,7 +450,7 @@ class executionModel extends model ->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin) ->checkFlow() ->exec(); - + /* Add the creater to the team. */ if(!dao::isError()) { @@ -1993,10 +1993,15 @@ class executionModel extends model if($execution->parent) $parentList[$execution->parent] = $execution->parent; if($execution->projectName) $execution->name = $execution->projectName . ' / ' . $execution->name; } - elseif($param === 'hasParentName') + elseif(strpos($param, 'hasParentName') !== false) { $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); $executions[$execution->id]->title = implode('/', $parentExecutions); + if(strpos($param, 'skipParent') !== false) + { + $children = $this->getChildExecutions($execution->id); + if(count($children) > 0) $parentList[$execution->id] = $execution->id; + } } elseif(isset($executions[$execution->parent])) { diff --git a/module/project/model.php b/module/project/model.php index 78a943fbe9..fcc2dd8ccf 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2624,7 +2624,7 @@ class projectModel extends model $this->loadModel('program'); $projects = $this->program->getProjectStats(0, 'all', 0, 'order_asc'); - $executions = $this->loadModel('execution')->getStatData(0, 'doing'); + $executions = $this->loadModel('execution')->getStatData(0, 'doing', 0, 0, false, 'hasParentName|skipParent'); $doingExecutions = array(); $latestExecutions = array(); From 1bb6626bb1b09c70a1f090d555823599d17e64e1 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 23 Feb 2023 05:13:56 +0000 Subject: [PATCH 02/20] * Fix bug #32202. --- module/story/control.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/story/control.php b/module/story/control.php index c9e303957f..9f22ffca2d 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -952,6 +952,8 @@ class story extends control $branch = $product->type == 'branch' ? ($story->branch > 0 ? $story->branch : '0') : 'all'; $productStories = $this->story->getProductStoryPairs($story->product, $branch, 0, 'all', 'id_desc', 0, '', $story->type); + if(!empty($product->shadow)) unset($this->lang->story->stageList[''], $this->lang->story->stageList['wait'], $this->lang->story->stageList['planned']); + $this->view->title = $this->lang->story->edit . "STORY" . $this->lang->colon . $this->view->story->title; $this->view->position[] = $this->lang->story->edit; $this->view->story = $story; From 389f7a98013ce4758fc3cdaeab400fd505973abd Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 23 Feb 2023 05:24:32 +0000 Subject: [PATCH 03/20] * Fix bug #32202. --- module/story/control.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 9f22ffca2d..d380938315 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -922,7 +922,11 @@ class story extends control $this->view->hiddenParent = true; if($project->model !== 'scrum') $this->view->hiddenPlan = true; - if(!$project->multiple) $this->view->hiddenPlan = true; + if(!$project->multiple) + { + $this->view->hiddenPlan = true; + unset($this->lang->story->stageList[''], $this->lang->story->stageList['wait'], $this->lang->story->stageList['planned']); + } if($project->model === 'kanban') $this->view->hiddenURS = true; } @@ -952,8 +956,6 @@ class story extends control $branch = $product->type == 'branch' ? ($story->branch > 0 ? $story->branch : '0') : 'all'; $productStories = $this->story->getProductStoryPairs($story->product, $branch, 0, 'all', 'id_desc', 0, '', $story->type); - if(!empty($product->shadow)) unset($this->lang->story->stageList[''], $this->lang->story->stageList['wait'], $this->lang->story->stageList['planned']); - $this->view->title = $this->lang->story->edit . "STORY" . $this->lang->colon . $this->view->story->title; $this->view->position[] = $this->lang->story->edit; $this->view->story = $story; From a876a53bf2037225cc8c907e3a3b2b3fcb5f602f Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 23 Feb 2023 06:04:12 +0000 Subject: [PATCH 04/20] * Finish task #42089. --- module/execution/control.php | 3 +++ module/execution/lang/de.php | 1 + module/execution/lang/en.php | 1 + module/execution/lang/fr.php | 1 + module/execution/lang/zh-cn.php | 1 + 5 files changed, 7 insertions(+) diff --git a/module/execution/control.php b/module/execution/control.php index 9881cf4be7..543ce89f45 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -3178,6 +3178,9 @@ class execution extends control $this->loadModel('product'); $execution = $this->execution->getById($executionID); + $project = $this->loadModel('project')->getByID($execution->project); + if(!$project->hasProduct) return print(js::error($this->lang->project->cannotManageProducts) . js::locate('back')); + if($project->model == 'waterfall' or $project->model == 'waterfallplus') return print(js::error(sprintf($this->lang->execution->cannotManageProducts, zget($this->lang->project->modelList, $project->model))) . js::locate('back')); if(!empty($_POST)) { diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php index aacc1a5dba..a80973707d 100644 --- a/module/execution/lang/de.php +++ b/module/execution/lang/de.php @@ -429,6 +429,7 @@ $lang->execution->hasStartedTaskOrSubStage = "Tasks or subphases under %s %s $lang->execution->hasSuspendedOrClosedChildren = "The sub-stages under stage %s are not all suspended or closed, cannot be modified, and have been filtered."; $lang->execution->hasNotClosedChildren = "The sub-stages under stage %s are not all closed, cannot be modified, and have been filtered."; $lang->execution->hasStartedTask = "The task under %s %s has already started, cannot be modified, and has been filtered."; +$lang->execution->cannotManageProducts = 'The ' . strtolower($lang->project->common). ' model of this ' . strtolower($lang->execution->common) . " is %s and this " . strtolower($lang->execution->common) . ' cannot be associated with products.'; /* Statistics. */ $lang->execution->charts = new stdclass(); diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index d8f522124d..a85838dffd 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -429,6 +429,7 @@ $lang->execution->hasStartedTaskOrSubStage = "Tasks or subphases under %s %s $lang->execution->hasSuspendedOrClosedChildren = "The sub-stages under stage %s are not all suspended or closed, cannot be modified, and have been filtered."; $lang->execution->hasNotClosedChildren = "The sub-stages under stage %s are not all closed, cannot be modified, and have been filtered."; $lang->execution->hasStartedTask = "The task under %s %s has already started, cannot be modified, and has been filtered."; +$lang->execution->cannotManageProducts = 'The ' . strtolower($lang->project->common). ' model of this ' . strtolower($lang->execution->common) . " is %s and this " . strtolower($lang->execution->common) . ' cannot be associated with products.'; /* Statistics. */ $lang->execution->charts = new stdclass(); diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php index 46f9661aa7..e5ca0aa203 100644 --- a/module/execution/lang/fr.php +++ b/module/execution/lang/fr.php @@ -429,6 +429,7 @@ $lang->execution->hasStartedTaskOrSubStage = "Tasks or subphases under %s %s $lang->execution->hasSuspendedOrClosedChildren = "The sub-stages under stage %s are not all suspended or closed, cannot be modified, and have been filtered."; $lang->execution->hasNotClosedChildren = "The sub-stages under stage %s are not all closed, cannot be modified, and have been filtered."; $lang->execution->hasStartedTask = "The task under %s %s has already started, cannot be modified, and has been filtered."; +$lang->execution->cannotManageProducts = 'The ' . strtolower($lang->project->common). ' model of this ' . strtolower($lang->execution->common) . " is %s and this " . strtolower($lang->execution->common) . ' cannot be associated with products.'; /* Statistics. */ $lang->execution->charts = new stdclass(); diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index 211e47444a..8fcbcc036f 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -429,6 +429,7 @@ $lang->execution->hasStartedTaskOrSubStage = "%s%s下的任务或子阶段 $lang->execution->hasSuspendedOrClosedChildren = "阶段%s下的子阶段未全部挂起或关闭,无法修改,已过滤。"; $lang->execution->hasNotClosedChildren = "阶段%s下的子阶段未全部关闭,无法修改,已过滤。"; $lang->execution->hasStartedTask = "%s%s下的任务已经开始,无法修改,已过滤。"; +$lang->execution->cannotManageProducts = "当前{$lang->execution->common}的{$lang->project->common}为%s{$lang->project->common},不能关联产品。"; /* 统计。*/ $lang->execution->charts = new stdclass(); From 772ec30c3725c5b2d281bc830fe7de3e2237a228 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 23 Feb 2023 06:46:06 +0000 Subject: [PATCH 05/20] * Resolve feedback #2132. --- module/project/control.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/project/control.php b/module/project/control.php index ba8e5bf44e..260801420f 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -84,7 +84,6 @@ class project extends control $project->PM = zget($users, $project->PM); $project->status = $this->processStatus('project', $project); $project->model = zget($projectLang->modelList, $project->model); - $project->budget = $project->budget . zget($projectLang->unitList, $project->budgetUnit); $project->budget = $project->budget != 0 ? $project->budget . zget($projectLang->unitList, $project->budgetUnit) : $this->lang->project->future; $project->parent = $project->parentName; $project->hasProduct = zget($projectLang->projectTypeList, $project->hasProduct); From d52c3bd4d3ebb8c08be30d53fb119f3929421b05 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 23 Feb 2023 07:30:39 +0000 Subject: [PATCH 06/20] * Fix bug #32281. --- module/execution/model.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/execution/model.php b/module/execution/model.php index 31307505c7..2432b4cd13 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -383,6 +383,7 @@ class executionModel extends model ->setDefault('openedVersion', $this->config->version) ->setDefault('lastEditedBy', $this->app->user->account) ->setDefault('lastEditedDate', helper::now()) + ->setDefault('days', '0') ->setDefault('team', $this->post->name) ->setDefault('parent', $this->post->project) ->setIF($this->post->parent, 'parent', $this->post->parent) @@ -448,7 +449,7 @@ class executionModel extends model ->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin) ->checkFlow() ->exec(); - + /* Add the creater to the team. */ if(!dao::isError()) { @@ -573,6 +574,7 @@ class executionModel extends model ->setIF($this->post->status == 'closed' and $oldExecution->status != 'closed', 'closedDate', helper::now()) ->setIF($this->post->status == 'suspended' and $oldExecution->status != 'suspended', 'suspendedDate', helper::today()) ->setIF($oldExecution->type == 'stage', 'project', $oldExecution->project) + ->setDefault('days', '0') ->setDefault('team', $this->post->name) ->join('whitelist', ',') ->stripTags($this->config->execution->editor->edit['id'], $this->config->allowedTags) From 40770178ffe8d0a802249b87f5a734effee7601d Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 23 Feb 2023 09:11:13 +0000 Subject: [PATCH 07/20] * Add uni test. --- test/class/programplan.class.php | 49 ++++++++ test/class/stage.class.php | 14 ++- test/model/programplan/checkcodeunique.php | 41 +++++++ test/model/programplan/checknameunique.php | 34 ++++++ .../programplan/getparentchildrentypes.php | 54 +++++++++ test/model/stage/batchcreate.php | 63 ++++++++--- test/model/stage/create.php | 105 ++++++++++++++---- 7 files changed, 317 insertions(+), 43 deletions(-) create mode 100644 test/model/programplan/checkcodeunique.php create mode 100644 test/model/programplan/checknameunique.php create mode 100755 test/model/programplan/getparentchildrentypes.php diff --git a/test/class/programplan.class.php b/test/class/programplan.class.php index 71cf840caa..ef4cb9c0f3 100644 --- a/test/class/programplan.class.php +++ b/test/class/programplan.class.php @@ -336,4 +336,53 @@ class programplanTest return implode(',', $objects); } + + /** + * Test get parent stage's children types. + * + * @param int $parentID + * @access public + * @return string + */ + public function getParentChildrenTypesTest($parentID) + { + $objects = $this->objectModel->getParentChildrenTypes($parentID); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test check code unique. + * + * @param array $codes + * @param array $planIDList + * @access public + * @return string + */ + public function checkCodeUniqueTest($codes, $planIDList = array()) + { + $objects = $this->objectModel->checkCodeUnique($codes, $planIDList); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test check name unique. + * + * @param array $names + * @access public + * @return string + */ + public function checkNameUniqueTest($names) + { + $objects = $this->objectModel->checkNameUnique($names); + + if(dao::isError()) return dao::getError(); + + return $objects; + } } diff --git a/test/class/stage.class.php b/test/class/stage.class.php index 55d04a9e87..3654754195 100644 --- a/test/class/stage.class.php +++ b/test/class/stage.class.php @@ -11,20 +11,21 @@ class stageTest * Test create a stage. * * @param object $stage + * @param string $type * @access public * @return object */ - public function createTest($stage) + public function createTest($stage, $type = 'waterfall') { foreach($stage as $key => $value) $_POST[$key] = $value; - $objectID = $this->objectModel->create(); + $objectID = $this->objectModel->create($type); unset($_POST); if(dao::isError()) return dao::getError(); - $object = $this->objectModel->getByID($objectID); + $object = $this->objectModel->getByID($objectID, $type); return $object; } @@ -32,20 +33,21 @@ class stageTest * Test batch create stages. * * @param array $param + * @param string $type * @access public * @return int */ - public function batchCreateTest($param) + public function batchCreateTest($param ,$type = 'waterfall') { foreach($param as $key => $value) $_POST[$key] = $value; - $this->objectModel->batchCreate(); + $this->objectModel->batchCreate($type); unset($_POST); if(dao::isError()) return dao::getError(); - $objects = $this->objectModel->getStages(); + $objects = $this->objectModel->getStages('id_desc', 0, $type); return count($objects); } diff --git a/test/model/programplan/checkcodeunique.php b/test/model/programplan/checkcodeunique.php new file mode 100644 index 0000000000..a8f5a878bc --- /dev/null +++ b/test/model/programplan/checkcodeunique.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +id->range('10-15'); +$programplan->code->range('1-5')->prefix('code'); +$programplan->deleted->range('0-1'); +$programplan->gen(5); + +/** + +title=测试 programplanModel->checkCodeUnique(); +cid=1 +pid=1 + +检查'code1', 'code2', 'code3', 'code4', 'code5' 在未删除的数据内编号是否唯一 code1 >> code1 +检查'code1', 'code2', 'code3', 'code4', 'code5' 在未删除的数据内编号是否唯一 code3 >> code3 +检查'code1', 'code2', 'code3', 'code4', 'code5' 在未删除的数据内编号是否唯一 code5 >> code5 +检查'code1', 'code2', 'code3', 'code4', 'code5' 在除了id为'10', '11', '12', '13', '14'外的未删除数据编号是否唯一 >> 1 +检查'code6', 'code7' 在未删除的数据内编号是否唯一 >> 1 +检查'code2', 'code4' 在未删除的数据内编号是否唯一 >> 1 + +*/ + +$codes = array(); +$codes[] = array('code1', 'code2', 'code3', 'code4', 'code5'); +$codes[] = array('code6', 'code7'); +$codes[] = array('code2', 'code4'); +$exclude = array('10', '11', '12', '13', '14'); + +$programplan = new programplanTest(); + +r($programplan->checkCodeUniqueTest($codes[0])) && p('code1') && e('code1'); // 检查'code1', 'code2', 'code3', 'code4', 'code5' 在未删除的数据内编号是否唯一 code1 +r($programplan->checkCodeUniqueTest($codes[0])) && p('code3') && e('code3'); // 检查'code1', 'code2', 'code3', 'code4', 'code5' 在未删除的数据内编号是否唯一 code3 +r($programplan->checkCodeUniqueTest($codes[0])) && p('code5') && e('code5'); // 检查'code1', 'code2', 'code3', 'code4', 'code5' 在未删除的数据内编号是否唯一 code5 +r($programplan->checkCodeUniqueTest($codes[0], $exclude)) && p() && e('1'); // 检查'code1', 'code2', 'code3', 'code4', 'code5' 在除了id为'10', '11', '12', '13', '14'外的未删除数据编号是否唯一 +r($programplan->checkCodeUniqueTest($codes[1])) && p() && e('1'); // 检查'code6', 'code7' 在未删除的数据内编号是否唯一 +r($programplan->checkCodeUniqueTest($codes[2])) && p() && e('1'); // 检查'code2', 'code4' 在未删除的数据内编号是否唯一 diff --git a/test/model/programplan/checknameunique.php b/test/model/programplan/checknameunique.php new file mode 100644 index 0000000000..e67402b25b --- /dev/null +++ b/test/model/programplan/checknameunique.php @@ -0,0 +1,34 @@ +#!/usr/bin/env php +id->range('10-15'); +$programplan->name->range('1-5')->prefix('name'); +$programplan->deleted->range('0-1'); +$programplan->gen(5); + +/** + +title=测试 programplanModel->checkNameUnique(); +cid=1 +pid=1 + +检查'name1', 'name2', 'name1', 'name3', 'name5' 数组的值是否唯一 >> 0 +检查'name6', 'name7' 数组的值是否唯一 >> 1 +检查'name2', 'name2' 数组的值是否唯一 >> 0 + +*/ + +$names = array(); +$names[] = array('name1', 'name2', 'name1', 'name3', 'name5'); +$names[] = array('name6', 'name7'); +$names[] = array('name2', 'name2'); + +$programplan = new programplanTest(); + +r($programplan->checkNameUniqueTest($names[0])) && p() && e('0'); // 检查'name1', 'name2', 'name1', 'name3', 'name5' 数组的值是否唯一 +r($programplan->checkNameUniqueTest($names[1])) && p() && e('1'); // 检查'name6', 'name7' 数组的值是否唯一 +r($programplan->checkNameUniqueTest($names[2])) && p() && e('0'); // 检查'name2', 'name2' 数组的值是否唯一 diff --git a/test/model/programplan/getparentchildrentypes.php b/test/model/programplan/getparentchildrentypes.php new file mode 100755 index 0000000000..cb922b36c0 --- /dev/null +++ b/test/model/programplan/getparentchildrentypes.php @@ -0,0 +1,54 @@ +#!/usr/bin/env php +id->range('10-20'); +$programplan->parent->range('1-3'); +$programplan->type->range('stage{3},sprint{2},kanban{2},stage{1},sprint{2}'); +$programplan->deleted->range('0-1'); +$programplan->gen(10); + +/** + +title=测试 programplanModel->getParentChildrenTypes(); +cid=1 +pid=1 + +查找父ID为 1 未删除的阶段类型 stage >> stage +查找父ID为 1 未删除的阶段类型 kanban >> kanban +查找父ID为 1 未删除的阶段类型数量 >> 2 +查找父ID为 2 未删除的阶段类型 sprint >> sprint +查找父ID为 2 未删除的阶段类型数量 >> 1 +查找父ID为 3 未删除的阶段类型 stage >> stage +查找父ID为 3 未删除的阶段类型 sprint >> sprint +查找父ID为 3 未删除的阶段类型数量 >> 2 +查找父ID为 1 未删除的阶段类型 stage >> 0 +查找父ID为 1 未删除的阶段类型 sprint >> 0 +查找父ID为 1 未删除的阶段类型 kanban >> 0 +查找父ID为 1 未删除的阶段类型数量 >> 0 + +*/ + +$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 +r($programplan->getParentChildrenTypesTest($parentIDList[3])) && p('kanban') && e('0'); // 查找父ID为 1 未删除的阶段类型 kanban +r(count($programplan->getParentChildrenTypesTest($parentIDList[3]))) && p() && e('0'); // 查找父ID为 1 未删除的阶段类型数量 diff --git a/test/model/stage/batchcreate.php b/test/model/stage/batchcreate.php index e235895fcd..f73307da4f 100755 --- a/test/model/stage/batchcreate.php +++ b/test/model/stage/batchcreate.php @@ -2,7 +2,6 @@ switchDB(); su('admin'); /** @@ -11,12 +10,26 @@ title=测试 stageModel->batchCreate(); cid=1 pid=1 -测试批量创建阶段 1 >> 8 -测试批量创建阶段 2 >> 10 -测试批量创建阶段 3 >> 12 -测试批量创建阶段 4 >> 13 +测试批量创建瀑布项目的阶段 1 >> 2 +测试批量创建瀑布项目的阶段 2 >> 4 +测试批量创建瀑布项目的阶段 3 >> 6 +测试批量创建瀑布项目的阶段 4 >> 7 +测试批量创建瀑布项目的百分比为空的阶段 >> 『工作量占比』不能为空。 +测试批量创建瀑布项目的类型为空的阶段 >> 『阶段类型』不能为空。 +测试批量创建瀑布项目的百分比非法的阶段 >> 工作量占比应当是数字,可以是小数。 +测试批量创建瀑布项目的百分比超出100的阶段 >> 工作量占比累计不应当超过100% +测试批量创建融合瀑布项目的阶段 1 >> 2 +测试批量创建融合瀑布项目的阶段 2 >> 4 +测试批量创建融合瀑布项目的阶段 3 >> 6 +测试批量创建融合瀑布项目的阶段 4 >> 7 +测试批量创建融合瀑布项目的百分比为空的阶段 >> 『工作量占比』不能为空。 +测试批量创建融合瀑布项目的类型为空的阶段 >> 『阶段类型』不能为空。 +测试批量创建融合瀑布项目的百分比非法的阶段 >> 工作量占比应当是数字,可以是小数。 +测试批量创建融合瀑布项目的百分比超出100的阶段 >> 工作量占比累计不应当超过100% */ +zdTable('stage')->gen(0); + $name1 = array('1' => '批量创建的需求', '2' => '批量创建的设计', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); $percent1 = array('1' => '1', '2' => '2', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); $type1 = array('1' => 'request', '2' => 'design', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); @@ -33,15 +46,37 @@ $name4 = array('1' => '', '2' => '批量创建的其他', '3' => '', '4' => ' $percent4 = array('1' => '1', '2' => '7', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); $type4 = array('1' => 'request', '2' => 'other', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); -$param1 = array('name' => $name1, 'percent' => $percent1, 'type' => $type1); -$param2 = array('name' => $name2, 'percent' => $percent2, 'type' => $type2); -$param3 = array('name' => $name3, 'percent' => $percent3, 'type' => $type3); -$param4 = array('name' => $name4, 'percent' => $percent4, 'type' => $type4); +$emptyPercent = array('1' => '', '2' => '','3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$emptyType = array('1' => '', '2' => '','3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$IllegalPercent = array('1' => 'a', '2' => 'b','3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$percentOver = array('1' => '111', '2' => '2','3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); + + +$param1 = array('name' => $name1, 'percent' => $percent1, 'type' => $type1); +$param2 = array('name' => $name2, 'percent' => $percent2, 'type' => $type2); +$param3 = array('name' => $name3, 'percent' => $percent3, 'type' => $type3); +$param4 = array('name' => $name4, 'percent' => $percent4, 'type' => $type4); +$param5 = array('name' => $name1, 'percent' => $emptyPercent, 'type' => $type1); +$param6 = array('name' => $name1, 'percent' => $percent1, 'type' => $emptyType); +$param7 = array('name' => $name1, 'percent' => $IllegalPercent, 'type' => $type1); +$param8 = array('name' => $name1, 'percent' => $percentOver, 'type' => $type1); + $stage = new stageTest(); -r($stage->batchCreateTest($param1)) && p() && e('8'); // 测试批量创建阶段 1 -r($stage->batchCreateTest($param2)) && p() && e('10'); // 测试批量创建阶段 2 -r($stage->batchCreateTest($param3)) && p() && e('12'); // 测试批量创建阶段 3 -r($stage->batchCreateTest($param4)) && p() && e('13'); // 测试批量创建阶段 4 -$db->restoreDB(); \ No newline at end of file +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/create.php b/test/model/stage/create.php index 507cdea273..5ec9c59127 100755 --- a/test/model/stage/create.php +++ b/test/model/stage/create.php @@ -2,7 +2,6 @@ switchDB(); su('admin'); /** @@ -11,58 +10,118 @@ title=测试 stageModel->create(); cid=1 pid=1 -测试新建一个需求阶段 >> 新建的需求,1,request -测试新建一个设计阶段 >> 新建的设计,2,design -测试新建一个开发阶段 >> 新建的开发,3,dev -测试新建一个测试阶段 >> 新建的测试,4,qa -测试新建一个发布阶段 >> 新建的发布,5,release -测试新建一个总结评审阶段 >> 新建的总结评审,6,review -测试新建一个其他阶段 >> 新建的其他,7,other +测试新建瀑布项目一个需求阶段 >> 新建的需求,1,request +测试新建瀑布项目一个设计阶段 >> 新建的设计,2,design +测试新建瀑布项目一个开发阶段 >> 新建的开发,3,dev +测试新建瀑布项目一个测试阶段 >> 新建的测试,4,qa +测试新建瀑布项目一个发布阶段 >> 新建的发布,5,release +测试新建瀑布项目一个总结评审阶段 >> 新建的总结评审,6,review +测试新建瀑布项目一个其他阶段 >> 新建的其他,7,other +测试新建瀑布项目名称为空 >> 『阶段名称』不能为空。 +测试新建瀑布项目类型为空 >> 『工作量占比』不能为空。 +测试新建瀑布项目百分比为空 >> 『阶段类型』不能为空。 +测试新建瀑布项目非数字的百分比 >> 工作量占比应当是数字 +测试新建瀑布项目总百分比超过100 >> 工作量占比累计不应当超过100% +测试新建融合瀑布项目一个需求阶段 >> 新建的需求,1,request +测试新建融合瀑布项目一个设计阶段 >> 新建的设计,2,design +测试新建融合瀑布项目一个开发阶段 >> 新建的开发,3,dev +测试新建融合瀑布项目一个测试阶段 >> 新建的测试,4,qa +测试新建融合瀑布项目一个发布阶段 >> 新建的发布,5,release +测试新建融合瀑布项目一个总结评审阶段 >> 新建的总结评审,6,review +测试新建融合瀑布项目一个其他阶段 >> 新建的其他,7,other +测试新建融合瀑布项目名称为空 >> 『阶段名称』不能为空。 +测试新建融合瀑布项目类型为空 >> 『工作量占比』不能为空。 +测试新建融合瀑布项目百分比为空 >> 『阶段类型』不能为空。 +测试新建融合瀑布项目非数字的百分比 >> 工作量占比应当是数字 +测试新建融合瀑布项目总百分比超过100 >> 工作量占比累计不应当超过100% */ +zdTable('stage')->gen(0); + $stage1 = new stdclass(); -$stage1->name = '新建的需求'; +$stage1->name = '新建的需求'; $stage1->percent = 1; $stage1->type = 'request'; $stage2 = new stdclass(); -$stage2->name = '新建的设计'; +$stage2->name = '新建的设计'; $stage2->percent = 2; $stage2->type = 'design'; $stage3 = new stdclass(); -$stage3->name = '新建的开发'; +$stage3->name = '新建的开发'; $stage3->percent = 3; $stage3->type = 'dev'; $stage4 = new stdclass(); -$stage4->name = '新建的测试'; +$stage4->name = '新建的测试'; $stage4->percent = 4; $stage4->type = 'qa'; $stage5 = new stdclass(); -$stage5->name = '新建的发布'; +$stage5->name = '新建的发布'; $stage5->percent = 5; $stage5->type = 'release'; $stage6 = new stdclass(); -$stage6->name = '新建的总结评审'; +$stage6->name = '新建的总结评审'; $stage6->percent = 6; $stage6->type = 'review'; $stage7 = new stdclass(); -$stage7->name = '新建的其他'; +$stage7->name = '新建的其他'; $stage7->percent = 7; $stage7->type = 'other'; +$emptyName = new stdclass(); +$emptyName->name = ''; +$emptyName->percent = 7; +$emptyName->type = 'other'; + +$emptyPercent = new stdclass(); +$emptyPercent->name = '1'; +$emptyPercent->percent = 0; +$emptyPercent->type = 'other'; + +$emptyType = new stdclass(); +$emptyType->name = '1'; +$emptyType->percent = 7; +$emptyType->type = ''; + +$IllegalPercent = new stdclass(); +$IllegalPercent->name = '一个名称'; +$IllegalPercent->percent = 'a'; +$IllegalPercent->type = 'other'; + +$percentOver = new stdclass(); +$percentOver->name = '一个名称'; +$percentOver->percent = 101; +$percentOver->type = 'other'; + $stage = new stageTest(); -r($stage->createTest($stage1)) && p('name,percent,type') && e('新建的需求,1,request'); // 测试新建一个需求阶段 -r($stage->createTest($stage2)) && p('name,percent,type') && e('新建的设计,2,design'); // 测试新建一个设计阶段 -r($stage->createTest($stage3)) && p('name,percent,type') && e('新建的开发,3,dev'); // 测试新建一个开发阶段 -r($stage->createTest($stage4)) && p('name,percent,type') && e('新建的测试,4,qa'); // 测试新建一个测试阶段 -r($stage->createTest($stage5)) && p('name,percent,type') && e('新建的发布,5,release'); // 测试新建一个发布阶段 -r($stage->createTest($stage6)) && p('name,percent,type') && e('新建的总结评审,6,review'); // 测试新建一个总结评审阶段 -r($stage->createTest($stage7)) && p('name,percent,type') && e('新建的其他,7,other'); // 测试新建一个其他阶段 -$db->restoreDB(); \ No newline at end of file +r($stage->createTest($stage1)) && p('name,percent,type') && e('新建的需求,1,request'); // 测试新建瀑布项目一个需求阶段 +r($stage->createTest($stage2)) && p('name,percent,type') && e('新建的设计,2,design'); // 测试新建瀑布项目一个设计阶段 +r($stage->createTest($stage3)) && p('name,percent,type') && e('新建的开发,3,dev'); // 测试新建瀑布项目一个开发阶段 +r($stage->createTest($stage4)) && p('name,percent,type') && e('新建的测试,4,qa'); // 测试新建瀑布项目一个测试阶段 +r($stage->createTest($stage5)) && p('name,percent,type') && e('新建的发布,5,release'); // 测试新建瀑布项目一个发布阶段 +r($stage->createTest($stage6)) && p('name,percent,type') && e('新建的总结评审,6,review'); // 测试新建瀑布项目一个总结评审阶段 +r($stage->createTest($stage7)) && p('name,percent,type') && e('新建的其他,7,other'); // 测试新建瀑布项目一个其他阶段 +r($stage->createTest($emptyName)) && p('name:0') && e('『阶段名称』不能为空。'); // 测试新建瀑布项目名称为空 +r($stage->createTest($emptyPercent)) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试新建瀑布项目类型为空 +r($stage->createTest($emptyType)) && p('type:0') && e('『阶段类型』不能为空。'); // 测试新建瀑布项目百分比为空 +r($stage->createTest($IllegalPercent)) && p('message:0') && e('工作量占比应当是数字'); // 测试新建瀑布项目非数字的百分比 +r($stage->createTest($percentOver)) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试新建瀑布项目总百分比超过100 +r($stage->createTest($stage1, 'waterfallplus')) && p('name,percent,type') && e('新建的需求,1,request'); // 测试新建融合瀑布项目一个需求阶段 +r($stage->createTest($stage2, 'waterfallplus')) && p('name,percent,type') && e('新建的设计,2,design'); // 测试新建融合瀑布项目一个设计阶段 +r($stage->createTest($stage3, 'waterfallplus')) && p('name,percent,type') && e('新建的开发,3,dev'); // 测试新建融合瀑布项目一个开发阶段 +r($stage->createTest($stage4, 'waterfallplus')) && p('name,percent,type') && e('新建的测试,4,qa'); // 测试新建融合瀑布项目一个测试阶段 +r($stage->createTest($stage5, 'waterfallplus')) && p('name,percent,type') && e('新建的发布,5,release'); // 测试新建融合瀑布项目一个发布阶段 +r($stage->createTest($stage6, 'waterfallplus')) && p('name,percent,type') && e('新建的总结评审,6,review'); // 测试新建融合瀑布项目一个总结评审阶段 +r($stage->createTest($stage7, 'waterfallplus')) && p('name,percent,type') && e('新建的其他,7,other'); // 测试新建融合瀑布项目一个其他阶段 +r($stage->createTest($emptyName, 'waterfallplus')) && p('name:0') && e('『阶段名称』不能为空。'); // 测试新建融合瀑布项目名称为空 +r($stage->createTest($emptyPercent, 'waterfallplus')) && p('percent:0') && e('『工作量占比』不能为空。'); // 测试新建融合瀑布项目类型为空 +r($stage->createTest($emptyType, 'waterfallplus')) && p('type:0') && e('『阶段类型』不能为空。'); // 测试新建融合瀑布项目百分比为空 +r($stage->createTest($IllegalPercent, 'waterfallplus')) && p('message:0') && e('工作量占比应当是数字'); // 测试新建融合瀑布项目非数字的百分比 +r($stage->createTest($percentOver, 'waterfallplus')) && p('message:0') && e('工作量占比累计不应当超过100%'); // 测试新建融合瀑布项目总百分比超过100 From fcd23c20c7897dd4a107c950402498049704ca39 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 23 Feb 2023 09:22:24 +0000 Subject: [PATCH 08/20] * Add unit test. --- test/class/stage.class.php | 16 ++++++++++++++++ test/model/stage/batchcreate.php | 4 ++-- test/model/stage/create.php | 4 ++-- test/model/stage/gettotalpercent.php | 28 ++++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 test/model/stage/gettotalpercent.php diff --git a/test/class/stage.class.php b/test/class/stage.class.php index 3654754195..13901a41a6 100644 --- a/test/class/stage.class.php +++ b/test/class/stage.class.php @@ -118,4 +118,20 @@ class stageTest return $object; } + + /** + * Test get a stage by id. + * + * @param string $projectType + * @access public + * @return object + */ + public function getTotalPercentTest($projectType) + { + $object = $this->objectModel->getTotalPercent($projectType); + + if(dao::isError()) return dao::getError(); + + return $object; + } } diff --git a/test/model/stage/batchcreate.php b/test/model/stage/batchcreate.php index f73307da4f..e2a2deaf0a 100755 --- a/test/model/stage/batchcreate.php +++ b/test/model/stage/batchcreate.php @@ -4,6 +4,8 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php'; include dirname(dirname(dirname(__FILE__))) . '/class/stage.class.php'; su('admin'); +zdTable('stage')->gen(0); + /** title=测试 stageModel->batchCreate(); @@ -28,8 +30,6 @@ pid=1 测试批量创建融合瀑布项目的百分比超出100的阶段 >> 工作量占比累计不应当超过100% */ -zdTable('stage')->gen(0); - $name1 = array('1' => '批量创建的需求', '2' => '批量创建的设计', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); $percent1 = array('1' => '1', '2' => '2', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); $type1 = array('1' => 'request', '2' => 'design', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); diff --git a/test/model/stage/create.php b/test/model/stage/create.php index 5ec9c59127..9272bed8c9 100755 --- a/test/model/stage/create.php +++ b/test/model/stage/create.php @@ -4,6 +4,8 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php'; include dirname(dirname(dirname(__FILE__))) . '/class/stage.class.php'; su('admin'); +zdTable('stage')->gen(0); + /** title=测试 stageModel->create(); @@ -37,8 +39,6 @@ pid=1 */ -zdTable('stage')->gen(0); - $stage1 = new stdclass(); $stage1->name = '新建的需求'; $stage1->percent = 1; diff --git a/test/model/stage/gettotalpercent.php b/test/model/stage/gettotalpercent.php new file mode 100644 index 0000000000..2fac62adf4 --- /dev/null +++ b/test/model/stage/gettotalpercent.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +id->range('1-10'); +$stage->percent->range('10-20'); +$stage->projectType->range('waterfall{5}, waterfallplus{5}'); +$stage->deleted->range('0-1'); +$stage->gen(10); + +/** + +title=测试 stageModel->getTotalPercent(); +cid=1 +pid=1 + +测试获取瀑布项目的总百分比 >> 36 +测试获取融合瀑布项目的总百分比 >> 34 + +*/ + +$stage = new stageTest(); + +r($stage->getTotalPercentTest('waterfall')) && p() && e('36'); // 测试获取瀑布项目的总百分比 +r($stage->getTotalPercentTest('waterfallplus')) && p() && e('34'); // 测试获取融合瀑布项目的总百分比 From f784951e184733a145aa3afea37825fc4196eb52 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 24 Feb 2023 02:05:50 +0000 Subject: [PATCH 09/20] * Add sql for process. --- db/update18.1.sql | 34 ++++++++++++++++++++++++++++++++++ db/zentao.sql | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/db/update18.1.sql b/db/update18.1.sql index 0f4b3dd000..aee37886fb 100644 --- a/db/update18.1.sql +++ b/db/update18.1.sql @@ -28,3 +28,37 @@ UPDATE `zt_activity` SET `order` = `id` * 5 WHERE `order` = '0'; ALTER table `zt_cmcl` ADD `projectType` varchar(255) NOT NULL DEFAULT '' AFTER `type`; UPDATE `zt_cmcl` SET `projectType` = 'waterfall' WHERE `projectType` = ''; + +REPLACE INTO `zt_process` (`model`, `name`, `type`, `abbr`, `desc`, `assignedTo`, `status`, `order`, `createdBy`, `createdDate`, `editedBy`, `editedDate`, `assignedBy`, `assignedDate`, `deleted`) VALUES +('waterfallplus', '立项管理', 'project', 'PIM', '', '', '', 55, 'admin', '2020-01-09 10:29:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '项目规划', 'project', 'PP', '', '', '', 60, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '项目监控', 'project', 'PMC', '', '', '', 65, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '风险管理', 'project', 'RSKM', '', '', '', 70, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '结项管理', 'project', 'PCM', '', '', '', 75, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '量化项目管理', 'project', 'QPM', '', '', '', 80, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '需求开发', 'engineering', 'RDM', '', '', '', 85, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '设计开发', 'engineering', '', '', '', '', 90, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '实现与测试', 'engineering', 'EMBEDDED', '', '', '', 95, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '系统测试', 'engineering', 'ST', '', '', '', 100, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '客户验收', 'engineering', 'CA', '', '', '', 105, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '质量保证', 'support', 'QA', '', '', '', 110, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '配置管理', 'support', 'CM', '', '', '', 115, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '度量分析', 'support', 'MA', '', '', '', 120, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '原因分析与解决', 'support', 'CAR', '', '', '', 125, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('waterfallplus', '决策分析', 'support', 'DAR', '', '', '', 130, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '立项管理', 'project', 'PIM', '', '', '', 55, 'admin', '2020-01-09 10:29:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '项目规划', 'project', 'PP', '', '', '', 60, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '项目监控', 'project', 'PMC', '', '', '', 65, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '风险管理', 'project', 'RSKM', '', '', '', 70, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '结项管理', 'project', 'PCM', '', '', '', 75, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '量化项目管理', 'project', 'QPM', '', '', '', 80, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '需求开发', 'engineering', 'RDM', '', '', '', 85, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '设计开发', 'engineering', '', '', '', '', 90, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '实现与测试', 'engineering', 'EMBEDDED', '', '', '', 95, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '系统测试', 'engineering', 'ST', '', '', '', 100, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '客户验收', 'engineering', 'CA', '', '', '', 105, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '质量保证', 'support', 'QA', '', '', '', 110, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '配置管理', 'support', 'CM', '', '', '', 115, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '度量分析', 'support', 'MA', '', '', '', 120, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '原因分析与解决', 'support', 'CAR', '', '', '', 125, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +('agileplus', '决策分析', 'support', 'DAR', '', '', '', 130, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'); diff --git a/db/zentao.sql b/db/zentao.sql index 9abe206715..2eebc0eebf 100755 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -13305,7 +13305,39 @@ REPLACE INTO `zt_process` (`id`, `model`, `name`, `type`, `abbr`, `desc`, `assig (29, 'scrum', '项目监控', 'project', 'PMC', '', '', '', 65, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), (28, 'scrum', '项目规划', 'project', 'PP', '', '', '', 60, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), (27, 'scrum', '立项管理', 'project', 'PIM', '', '', '', 55, 'admin', '2020-01-09 10:29:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), -(42, 'scrum', '决策分析', 'support', 'DAR', '', '', '', 130, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'); +(42, 'scrum', '决策分析', 'support', 'DAR', '', '', '', 130, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(43, 'waterfallplus', '立项管理', 'project', 'PIM', '', '', '', 55, 'admin', '2020-01-09 10:29:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(44, 'waterfallplus', '项目规划', 'project', 'PP', '', '', '', 60, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(45, 'waterfallplus', '项目监控', 'project', 'PMC', '', '', '', 65, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(46, 'waterfallplus', '风险管理', 'project', 'RSKM', '', '', '', 70, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(47, 'waterfallplus', '结项管理', 'project', 'PCM', '', '', '', 75, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(48, 'waterfallplus', '量化项目管理', 'project', 'QPM', '', '', '', 80, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(49, 'waterfallplus', '需求开发', 'engineering', 'RDM', '', '', '', 85, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(50, 'waterfallplus', '设计开发', 'engineering', '', '', '', '', 90, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(51, 'waterfallplus', '实现与测试', 'engineering', 'EMBEDDED', '', '', '', 95, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(52, 'waterfallplus', '系统测试', 'engineering', 'ST', '', '', '', 100, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(53, 'waterfallplus', '客户验收', 'engineering', 'CA', '', '', '', 105, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(54, 'waterfallplus', '质量保证', 'support', 'QA', '', '', '', 110, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(55, 'waterfallplus', '配置管理', 'support', 'CM', '', '', '', 115, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(56, 'waterfallplus', '度量分析', 'support', 'MA', '', '', '', 120, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(57, 'waterfallplus', '原因分析与解决', 'support', 'CAR', '', '', '', 125, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(58, 'waterfallplus', '决策分析', 'support', 'DAR', '', '', '', 130, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(59, 'agileplus', '立项管理', 'project', 'PIM', '', '', '', 55, 'admin', '2020-01-09 10:29:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(60, 'agileplus', '项目规划', 'project', 'PP', '', '', '', 60, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(61, 'agileplus', '项目监控', 'project', 'PMC', '', '', '', 65, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(62, 'agileplus', '风险管理', 'project', 'RSKM', '', '', '', 70, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(63, 'agileplus', '结项管理', 'project', 'PCM', '', '', '', 75, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(64, 'agileplus', '量化项目管理', 'project', 'QPM', '', '', '', 80, 'admin', '2020-01-09 10:31:16', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(65, 'agileplus', '需求开发', 'engineering', 'RDM', '', '', '', 85, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(66, 'agileplus', '设计开发', 'engineering', '', '', '', '', 90, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(67, 'agileplus', '实现与测试', 'engineering', 'EMBEDDED', '', '', '', 95, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(68, 'agileplus', '系统测试', 'engineering', 'ST', '', '', '', 100, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(69, 'agileplus', '客户验收', 'engineering', 'CA', '', '', '', 105, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(70, 'agileplus', '质量保证', 'support', 'QA', '', '', '', 110, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(71, 'agileplus', '配置管理', 'support', 'CM', '', '', '', 115, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(72, 'agileplus', '度量分析', 'support', 'MA', '', '', '', 120, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(73, 'agileplus', '原因分析与解决', 'support', 'CAR', '', '', '', 125, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'), +(74, 'agileplus', '决策分析', 'support', 'DAR', '', '', '', 130, 'admin', '2020-01-09 13:14:55', '', '0000-00-00 00:00:00', '', '0000-00-00 00:00:00', '0'); REPLACE INTO `zt_activity` (`id`, `process`, `name`, `optional`, `tailorNorm`, `content`, `assignedTo`, `status`, `createdBy`, `createdDate`, `editedBy`, `editedDate`, `assignedBy`, `assignedDate`, `order`, `deleted`) VALUES From f2d6a76c93aa963bdd991dc1c34071084c6c68b7 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 24 Feb 2023 02:07:22 +0000 Subject: [PATCH 10/20] * Modify method to management method. --- module/execution/css/batchedit.en.css | 2 +- module/execution/css/edit.css | 2 ++ module/execution/css/edit.en.css | 1 + module/execution/lang/de.php | 2 +- module/execution/lang/en.php | 2 +- module/execution/lang/fr.php | 2 +- module/execution/lang/zh-cn.php | 2 +- module/execution/view/create.html.php | 3 ++- module/execution/view/edit.html.php | 6 +++--- 9 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 module/execution/css/edit.en.css diff --git a/module/execution/css/batchedit.en.css b/module/execution/css/batchedit.en.css index d4858d89b7..855a234699 100644 --- a/module/execution/css/batchedit.en.css +++ b/module/execution/css/batchedit.en.css @@ -1,4 +1,4 @@ .c-user {width: 150px !important;} .c-date {width: 125px;} -.c-method {width: 60px;} +.c-method {width: 145px;} .c-type {width: 130px;} diff --git a/module/execution/css/edit.css b/module/execution/css/edit.css index 69e41e254b..b02143f914 100644 --- a/module/execution/css/edit.css +++ b/module/execution/css/edit.css @@ -9,3 +9,5 @@ .form-date {min-width: 90px;} .productsBox div[id^='branch'].chosen-disabled {pointer-events: none;} + +#dataform th.c-name, #dataform th.c-projectName, #dataform th.c-method {width: 120px;} diff --git a/module/execution/css/edit.en.css b/module/execution/css/edit.en.css new file mode 100644 index 0000000000..89aae150fd --- /dev/null +++ b/module/execution/css/edit.en.css @@ -0,0 +1 @@ +#dataform th.c-method {width: 150px;} diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php index 67cca7222d..625c8e53b2 100644 --- a/module/execution/lang/de.php +++ b/module/execution/lang/de.php @@ -139,7 +139,7 @@ $lang->execution->kanbanNoLinkProduct = "Kanban not linked {$lang->productCommon $lang->execution->myTask = "My Task"; $lang->execution->list = "{$lang->executionCommon} List"; $lang->execution->allProject = 'All'; -$lang->execution->method = 'Method'; +$lang->execution->method = 'Management Method'; $lang->execution->sameAsParent = "Same as parent"; /* Fields of zt_team. */ diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index 9ed5ff84bc..1087a5cce5 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -139,7 +139,7 @@ $lang->execution->kanbanNoLinkProduct = "Kanban not linked {$lang->productCommon $lang->execution->myTask = "My Task"; $lang->execution->list = 'List'; $lang->execution->allProject = 'All'; -$lang->execution->method = 'Method'; +$lang->execution->method = 'Management Method'; $lang->execution->sameAsParent = "Same as parent"; /* Fields of zt_team. */ diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php index 487d058bec..b542b3ba67 100644 --- a/module/execution/lang/fr.php +++ b/module/execution/lang/fr.php @@ -139,7 +139,7 @@ $lang->execution->kanbanNoLinkProduct = "Kanban not linked {$lang->productCommon $lang->execution->myTask = "My Task"; $lang->execution->list = "{$lang->executionCommon} List"; $lang->execution->allProject = 'Tous'; -$lang->execution->method = 'Method'; +$lang->execution->method = 'Management Method'; $lang->execution->sameAsParent = "Same as parent"; /* Fields of zt_team. */ diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index ef3be73248..8ab442bf52 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -139,7 +139,7 @@ $lang->execution->kanbanNoLinkProduct = "看板没有关联{$lang->productCommon $lang->execution->myTask = "我的任务"; $lang->execution->list = '列表'; $lang->execution->allProject = '全部项目'; -$lang->execution->method = '方法'; +$lang->execution->method = '管理方法'; $lang->execution->sameAsParent = "同父阶段"; /* Fields of zt_team. */ diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index 429ecf2cb4..dab4ad2d55 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -59,7 +59,8 @@
- + getClientLang(), 'zh-') === false and !empty($project->model) and $project->model == 'agileplus') ? 'w-150px' : 'w-120px';?> + diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index 5c89e3a012..18123bcfed 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -33,14 +33,14 @@ model == 'scrum'):?> - + model == 'kanban'):?> id);?> model == 'agileplus'):?> - + tab == 'project' and $project->model == 'waterfallplus'):?> @@ -51,7 +51,7 @@ - + setCode) and $config->setCode == 1):?> From d0ab2da0d147802bcb5ed247ab9606f80b7493a4 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Fri, 24 Feb 2023 10:25:57 +0800 Subject: [PATCH 11/20] * Fix bug #32403. --- module/execution/control.php | 18 ++++-- module/execution/model.php | 71 +++++++++++++++-------- module/execution/view/kanban.html.php | 60 +++++++++---------- module/execution/view/taskkanban.html.php | 10 ++-- 4 files changed, 91 insertions(+), 68 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 9dcebbcacf..8c9cc4122a 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2615,10 +2615,18 @@ class execution extends control $execution = $this->commonAction($executionID); if($execution->type != 'kanban') return print(js::locate(inlink('view', "executionID=$executionID"))); - if($execution->lifetime == 'ops' or in_array($execution->attribute, array('request', 'review'))) + $features = $this->execution->getExecutionFeatures($execution); + $kanbanData = $this->loadModel('kanban')->getRDKanban($executionID, $browseType, $orderBy, 0, $groupBy); + + /* Remove lanes if no feature. */ + foreach($kanbanData as $regionID => $region) { - $browseType = 'task'; - unset($this->lang->kanban->group->task['story']); + foreach($region->groups as $groupID => $group) + { + if(!$features['story'] and $group->lanes[0]->type == 'story') unset($kanbanData[$regionID]->groups[$groupID]); + if(!$features['qa'] and $group->lanes[0]->type == 'bug') unset($kanbanData[$regionID]->groups[$groupID]); + $kanbanData[$regionID]->groups = array_values($kanbanData[$regionID]->groups); + } } /* Set Session. */ @@ -2688,6 +2696,7 @@ class execution extends control $this->view->projectID = $projectID; $this->view->project = $this->loadModel('project')->getByID($projectID); $this->view->allPlans = $allPlans; + $this->view->features = $features; $this->view->kanbanData = $kanbanData; $this->view->executionActions = $executionActions; $this->view->kanban = $this->lang->execution->kanban; @@ -2744,7 +2753,7 @@ class execution extends control /* Show lanes of the attribute: no story&bug in request, no bug in design. */ if(!isset($this->lang->execution->menu->story)) unset($kanbanGroup['story']); - if(!isset($this->lang->execution->menu->qa)) unset($kanbanGroup['bug']); + if(!isset($this->lang->execution->menu->qa)) unset($kanbanGroup['bug']); /* Determines whether an object is editable. */ $canBeChanged = common::canModify('execution', $execution); @@ -2783,6 +2792,7 @@ class execution extends control $this->view->productNum = count($products); $this->view->allPlans = $allPlans; $this->view->browseType = $browseType; + $this->view->features = $this->execution->getExecutionFeatures($execution); $this->view->kanbanGroup = $kanbanGroup; $this->view->execution = $execution; $this->view->groupBy = $groupBy; diff --git a/module/execution/model.php b/module/execution/model.php index d156eafa60..9f68c3f3ae 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -50,6 +50,41 @@ class executionModel extends model return print(js::locate(helper::createLink('execution', 'all'))); } + /** + * Get features of execution. + * + * @param object $execution + * @access public + * @return array + */ + public function getExecutionFeatures($execution) + { + $features = array('story' => true, 'task' => true, 'qa' => true, 'devops' => true, 'burn' => true, 'build' => true, 'other' => true); + + /* Unset story, bug, build and testtask if type is ops. */ + if($execution->lifetime == 'ops') + { + $features['story'] = false; + $features['qa'] = false; + $features['build'] = false; + $features['burn'] = false; + } + else if(in_array($execution->attribute, array('request', 'design', 'review'))) + { + $features['qa'] = false; + $features['devops'] = false; + $features['build'] = false; + $features['other'] = false; + + if(in_array($execution->attribute, array('request', 'review'))) + { + $features['story'] = false; + } + } + + return $features; + } + /** * Set menu. * @@ -105,30 +140,16 @@ class executionModel extends model if(isset($execution->acl) and $execution->acl != 'private') unset($this->lang->execution->menu->settings['subMenu']->whitelist); - /* Unset story, bug, build and testtask if type is ops. */ - if($execution and $execution->lifetime == 'ops') - { - unset($this->lang->execution->menu->story); - unset($this->lang->execution->menu->qa); - unset($this->lang->execution->menu->build); - unset($this->lang->execution->menu->burn); - } - - $stageFilter = array('request', 'design', 'review'); - if(isset($execution->attribute) and in_array($execution->attribute, $stageFilter)) - { - if(in_array($execution->attribute, array('request', 'review'))) - { - unset($this->lang->execution->menu->story); - unset($this->lang->execution->menu->view['subMenu']->groupTask); - unset($this->lang->execution->menu->view['subMenu']->tree); - unset($this->lang->execution->menu->other); - } - - unset($this->lang->execution->menu->devops); - unset($this->lang->execution->menu->qa); - unset($this->lang->execution->menu->build); - } + /* Redjust menus. */ + $features = $this->getExecutionFeatures($execution); + if(!$features['story']) unset($this->lang->execution->menu->story); + if(!$features['story']) unset($this->lang->execution->menu->view['subMenu']->groupTask); + if(!$features['story']) unset($this->lang->execution->menu->view['subMenu']->tree); + if(!$features['qa']) unset($this->lang->execution->menu->qa); + if(!$features['devops']) unset($this->lang->execution->menu->devops); + if(!$features['build']) unset($this->lang->execution->menu->build); + if(!$features['burn']) unset($this->lang->execution->menu->burn); + if(!$features['other']) unset($this->lang->execution->menu->other); if($executions and (!isset($executions[$executionID]) or !$this->checkPriv($executionID))) $this->accessDenied(); @@ -448,7 +469,7 @@ class executionModel extends model ->checkIF($sprint->end != '', 'end', 'ge', $sprint->begin) ->checkFlow() ->exec(); - + /* Add the creater to the team. */ if(!dao::isError()) { diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index f89f2e2f00..58293d2cde 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -61,40 +61,27 @@ js::set('rdSearchValue', ''); js::set('defaultMinColWidth', $this->config->minColWidth); js::set('defaultMaxColWidth', $this->config->maxColWidth); -$canSortRegion = (commonModel::hasPriv('kanban', 'sortRegion') and count($regions) > 1); -$canCreateRegion = (common::hasPriv('kanban', 'createRegion') and $groupBy == 'default'); +$canSortRegion = commonModel::hasPriv('kanban', 'sortRegion') && count($regions) > 1; +$canCreateRegion = common::hasPriv('kanban', 'createRegion') && $groupBy == 'default'; $canEditRegion = commonModel::hasPriv('kanban', 'editRegion'); $canDeleteRegion = commonModel::hasPriv('kanban', 'deleteRegion'); $canCreateLane = commonModel::hasPriv('kanban', 'createLane'); $canCreateTask = common::hasPriv('task', 'create'); $canBatchCreateTask = common::hasPriv('task', 'batchCreate'); -$canImportTask = (common::hasPriv('execution', 'importTask') and $execution->multiple); +$canImportTask = common::hasPriv('execution', 'importTask') && $execution->multiple; -if($execution->lifetime != 'ops' and !in_array($execution->attribute, array('request', 'review'))) -{ - $canCreateBug = ($productID and common::hasPriv('bug', 'create')); - $canBatchCreateBug = ($productID and common::hasPriv('bug', 'batchCreate') and $execution->multiple); - $canImportBug = ($productID and common::hasPriv('execution', 'importBug')); - $canCreateStory = ($productID and common::hasPriv('story', 'create')); - $canBatchCreateStory = ($productID and common::hasPriv('story', 'batchCreate')); - $canLinkStory = ($productID and common::hasPriv('execution', 'linkStory') and !empty($execution->hasProduct)); - $canLinkStoryByPlan = ($productID and common::hasPriv('execution', 'importplanstories') and !empty($project->hasProduct)); - $hasStoryButton = ($canCreateStory or $canBatchCreateStory or $canLinkStory or $canLinkStoryByPlan); - $hasBugButton = ($canCreateBug or $canBatchCreateBug); -} -else -{ - $canCreateBug = false; - $canBatchCreateBug = false; - $canImportBug = false; - $canCreateStory = false; - $canBatchCreateStory = false; - $canLinkStory = false; - $canLinkStoryByPlan = false; - $hasStoryButton = false; - $hasBugButton = false; -} -$hasTaskButton = ($canCreateTask or $canBatchCreateTask or $canImportBug); +$canCreateBug = $features['qa'] && $productID && common::hasPriv('bug', 'create'); +$canBatchCreateBug = $features['qa'] && $productID && common::hasPriv('bug', 'batchCreate') && $execution->multiple; +$canImportBug = $features['qa'] && $productID && common::hasPriv('execution', 'importBug'); +$hasBugButton = $features['qa'] && ($canCreateBug || $canBatchCreateBug); + +$canCreateStory = $features['story'] && $productID && common::hasPriv('story', 'create'); +$canBatchCreateStory = $features['story'] && $productID && common::hasPriv('story', 'batchCreate'); +$canLinkStory = $features['story'] && $productID && common::hasPriv('execution', 'linkStory') && !empty($execution->hasProduct); +$canLinkStoryByPlan = $features['story'] && $productID && common::hasPriv('execution', 'importplanstories') && !empty($project->hasProduct); +$hasStoryButton = $features['story'] && ($canCreateStory || $canBatchCreateStory || $canLinkStory || $canLinkStoryByPlan); + +$hasTaskButton = $canCreateTask || $canBatchCreateTask || $canImportBug; js::set('priv', array( @@ -134,7 +121,7 @@ js::set('priv', 'canDeleteStory' => common::hasPriv('story', 'delete'), 'canChangeStory' => common::hasPriv('story', 'change'), 'canCloseStory' => common::hasPriv('story', 'close'), - 'canUnlinkStory' => (common::hasPriv('execution', 'unlinkStory') and !empty($execution->hasProduct)), + 'canUnlinkStory' => (common::hasPriv('execution', 'unlinkStory') && !empty($execution->hasProduct)), 'canViewStory' => common::hasPriv('execution', 'storyView'), ) ); @@ -142,13 +129,17 @@ js::set('priv', -lifetime == 'ops' or in_array($execution->attribute, array('request', 'review'))):?> +
execution->projectName;?>execution->projectName;?>
execution->projectName;?>execution->projectName;?> project, "class='form-control chosen' onchange='changeProject(this.value)' required");?>
execution->method;?>execution->method;?> execution->typeList, $execution->type);?>
execution->name;?>execution->name;?> name, "class='form-control' required");?>