From 7501362a5857486e1a92ee23ec1307f3b549f662 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 16 Feb 2023 06:34:10 +0000 Subject: [PATCH] * Finish task #84591. --- module/execution/control.php | 6 ++++++ module/execution/model.php | 1 + module/execution/view/edit.html.php | 8 ++++++++ module/programplan/model.php | 19 +++++++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/module/execution/control.php b/module/execution/control.php index 0ff56fef28..54cefa6d8d 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2099,6 +2099,11 @@ class execution extends control $this->view->enableOptionalAttr = (empty($parentStage) or (!empty($parentStage) and $parentStage->attribute == 'mix')); } + if($this->app->tab == 'project' and $project->model == 'waterfallplus') + { + $productID = $this->product->getProductIDByProject($executionID); + $parentStageList = $this->loadModel('programplan')->getParentStageList($execution->project, $executionID, $productID); + } $this->view->title = $title; $this->view->position = $position; @@ -2123,6 +2128,7 @@ class execution extends control $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($linkedProducts), $execution->project, 'noclosed', $linkedBranchList); $this->view->teamMembers = $this->execution->getTeamMembers($executionID); $this->view->allProjects = $this->project->getPairsByModel($project->model, 0, 'noclosed', $project->id); + $this->view->parentStageList = isset($parentStageList) ? $parentStageList : array(); $this->display(); } diff --git a/module/execution/model.php b/module/execution/model.php index c27982f39b..b3cfde466c 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -536,6 +536,7 @@ class executionModel extends model { $this->app->loadLang('project'); $multipleProducts = $this->loadModel('product')->getMultiBranchPairs(); + if(is_string($_POST['branch']) !== false) $_POST['branch'] = json_decode($_POST['branch'], true); foreach($_POST['products'] as $index => $productID) { if(isset($multipleProducts[$productID]) and !isset($_POST['branch'][$index])) diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index 96b583a582..826cad20aa 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -39,6 +39,11 @@ execution->method;?> execution->typeList, $execution->type);?> + tab == 'project' and $project->model == 'waterfallplus'):?> + + programplan->parent;?> + parent, "class='form-control chosen '");?> + @@ -226,6 +231,8 @@ type == 'stage' and !in_array($execution->attribute, array('request', 'design', 'review'))) or $execution->type != 'stage'): ?> + + execution->manageProducts;?> @@ -245,6 +252,7 @@ + execution->team;?> diff --git a/module/programplan/model.php b/module/programplan/model.php index 129bbf63aa..a2c65be320 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -1279,6 +1279,20 @@ class programplanModel extends model return empty($task) ? true : false; } + /** + * Get parent stage's children types. + * + * @param int $parentID + * @access public + * @return array + */ + public function getParentChildrenTypes($parentID) + { + if(empty($parentID)) return true; + + return $this->dao->select('DISTINCT type')->from(TABLE_EXECUTION)->where('parent')->eq($parentID)->andWhere('deleted')->eq('0')->fetchPairs('type'); + } + /** * Is clickable. * @@ -1422,6 +1436,7 @@ class programplanModel extends model ->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') ->where('t1.product')->eq($productID) ->andWhere('t2.project')->eq($executionID) + ->andWhere('t2.type')->eq('stage') ->andWhere('t2.deleted')->eq(0) ->andWhere('t2.path')->notlike("%,$planID,%") ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi() @@ -1433,6 +1448,10 @@ class programplanModel extends model { $isCreate = $this->isCreateTask($key); if($isCreate === false and $key != $plan->parent) unset($parentStage[$key]); + + $parentTypes = $this->getParentChildrenTypes($key); + if($plan->type == 'stage' and (isset($parentTypes['sprint']) or isset($parentTypes['kanban']))) unset($parentStage[$key]); + if(($plan->type == 'sprint' or $plan->type == 'kanban') and isset($parentTypes['stage'])) unset($parentStage[$key]); } $parentStage[0] = $this->lang->programplan->emptyParent; ksort($parentStage);