diff --git a/module/execution/control.php b/module/execution/control.php index 0ca91a0843..17adc03935 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1031,7 +1031,7 @@ class execution extends control $executionID = $this->execution->create($execution, isset($_POST['teamMembers']) ? $_POST['teamMembers'] : array()); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - $this->loadModel('action')->create($this->objectType, $executionID, 'opened', '', $execution->hasProduct ? implode(',', $_POST['products']) : ''); + $this->loadModel('action')->create($this->objectType, $executionID, 'opened', '', $project->hasProduct ? implode(',', $_POST['products']) : ''); if(!empty($projectID) and strpos(',kanban,agileplus,waterfallplus,', ",$project->model,") !== false and $execution->type == 'kanban') { $execution = $this->execution->fetchByID($executionID); @@ -1062,7 +1062,7 @@ class execution extends control $this->view->productID = $productID; $this->view->projectID = $projectID; $this->view->from = $this->app->tab; - $this->view->isStage = isset($project->model) && in_array($project->model, array('waterfall', 'waterfallplus')); + $this->view->isStage = isset($output['type']) && $output['type'] == 'stage'; $this->view->isKanban = isset($output['type']) && $output['type'] == 'kanban'; $this->view->project = $project; $this->view->planID = $planID; diff --git a/module/execution/model.php b/module/execution/model.php index 36a79c1718..6ca48b758c 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -264,10 +264,11 @@ class executionModel extends model /* Api create infinites stages. */ if(isset($execution->parent) && ($execution->parent != $execution->project) && ($execution->type == 'stage' || $project->model == 'ipd')) { - $parent = $this->fetchByID($execution->parent); + $parent = $this->fetchByID((int)$execution->parent); $grade = $parent->grade + 1; $path = rtrim($parent->path, ',') . ",{$executionID}"; - $this->dao->update(TABLE_EXECUTION)->set('path')->eq($path)->set('grade')->eq($grade)->where('id')->eq($executionID)->exec(); + $attribute = $parent->attribute; + $this->dao->update(TABLE_EXECUTION)->set('attribute')->eq($attribute)->set('path')->eq($path)->set('grade')->eq($grade)->where('id')->eq($executionID)->exec(); } /* Save order. */ diff --git a/module/execution/ui/create.field.php b/module/execution/ui/create.field.php index 4084309d3e..6d218b3879 100644 --- a/module/execution/ui/create.field.php +++ b/module/execution/ui/create.field.php @@ -1,12 +1,15 @@ loadlang('stage'); $fields = defineFieldList('execution.create'); $project = data('project'); $from = data('from'); -$isStage = isset($project->model) && in_array($project->model, array('waterfall', 'waterfallplus')); +$isStage = data('isStage'); $isKanban = data('isKanban'); +$isIPD = $project->model == 'ipd' && $isStage; + $showExecutionExec = ($from == 'execution' || $from == 'doc'); $requiredFields = ",{$config->execution->create->requiredFields},"; @@ -17,16 +20,17 @@ $fields->field('project') ->items(data('allProjects')) ->value(data('projectID')); -if(!empty($project->model) and $project->model == 'agileplus') +if(!empty($project->model) && in_array($project->model, array('agileplus', 'ipd', 'waterfallplus'))) { - unset($lang->execution->typeList['stage'], $lang->execution->typeList['']); + unset($lang->execution->typeList['']); + if($project->model == 'agileplus') unset($lang->execution->typeList['stage']); + $fields->field('method') ->required() ->name('type') ->label($lang->execution->method) ->labelHint($lang->execution->agileplusMethodTip) - ->items($lang->execution->typeList) - ->value(data('execution.type')); + ->items($lang->execution->typeList); } $fields->field('name') @@ -45,7 +49,7 @@ $fields->field('type') ->control($isStage ? 'picker' : 'checkBtnGroup') ->label($showExecutionExec ? $lang->execution->execType : $lang->execution->type) ->name($isStage ? 'attribute' : 'lifetime') - ->hidden($isKanban) + ->hidden($isKanban || $isIPD) ->value($isStage ? 'dev' : 'short') ->items($isStage ? $lang->stage->typeList : $lang->execution->lifeTimeList);