From 64406fe023846c873e7d043fd094eadc8bde3b76 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 22 Apr 2021 11:38:54 +0800 Subject: [PATCH] * Fix bug #12272. --- module/execution/control.php | 29 +++++---------------------- module/execution/js/create.js | 2 +- module/execution/model.php | 16 +++++++-------- module/execution/view/create.html.php | 4 ++++ module/execution/view/edit.html.php | 22 +------------------- module/project/model.php | 10 +-------- 6 files changed, 20 insertions(+), 63 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 2f811cddfb..a66633ab55 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1231,12 +1231,6 @@ class execution extends control } } - $project = $this->project->getByID($projectID); - if(!empty($project->model) and $project->model == 'waterfall') - { - $this->lang->execution->afterInfo = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->execution->afterInfo); - } - $this->view->title = $this->lang->execution->tips; $this->view->tips = $this->fetch('execution', 'tips', "executionID=$executionID"); $this->view->executionID = $executionID; @@ -1317,6 +1311,11 @@ class execution extends control } } + if(!empty($project->model) and $project->model == 'waterfall') + { + $this->lang->execution->type = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->execution->type); + } + $this->view->title = (($this->app->openApp == 'execution') and ($this->config->systemMode == 'new')) ? $this->lang->execution->createExec : $this->lang->execution->create; $this->view->position[] = $this->view->title; $this->view->executions = array('' => '') + $this->execution->getList($projectID); @@ -1433,23 +1432,6 @@ class execution extends control $productPlans[$product->id] = $this->productplan->getPairs($product->id); } - $isSprint = true; - if($this->config->systemMode == 'new') - { - $project = $this->project->getById($execution->project); - if($project->model == 'scrum') - { - unset($this->lang->execution->endList[62]); - unset($this->lang->execution->endList[93]); - unset($this->lang->execution->endList[186]); - unset($this->lang->execution->endList[365]); - } - else - { - $isSprint = false; - } - } - $this->loadModel('user'); $poUsers = $this->user->getPairs('noclosed|nodeleted|pofirst', $execution->PO, $this->config->maxCount); if(!empty($this->config->user->moreLink)) $this->config->moreLinks["PM"] = $this->config->user->moreLink; @@ -1478,7 +1460,6 @@ class execution extends control $this->view->unmodifiableProducts = $unmodifiableProducts; $this->view->productPlans = $productPlans; $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($linkedProducts), '', $linkedBranches); - $this->view->isSprint = $isSprint; $this->display(); } diff --git a/module/execution/js/create.js b/module/execution/js/create.js index e8eb321238..e3290b67ff 100644 --- a/module/execution/js/create.js +++ b/module/execution/js/create.js @@ -38,7 +38,7 @@ $(function() var adjustMainCol = function() { - $('.main-form .col-main').css('width', Math.max(250, Math.floor(($('#productsBox').outerWidth() - 50)/3) + 10)); + if(!isStage) $('.main-form .col-main').css('width', Math.max(250, Math.floor(($('#productsBox').outerWidth() - 50)/3) + 10)); }; adjustMainCol(); $(window).on('resize', adjustMainCol); diff --git a/module/execution/model.php b/module/execution/model.php index 0947eb1b95..e3f33659d8 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -274,7 +274,7 @@ class executionModel extends model */ public function create($copyExecutionID = '') { - $sprintType = 'sprint'; + $type = 'sprint'; $this->lang->execution->team = $this->lang->execution->teamname; if($this->config->systemMode == 'new') @@ -286,14 +286,14 @@ class executionModel extends model } /* Determine whether to add a sprint or a stage according to the model of the execution. */ - $project = $this->getByID($_POST['project']); - $sprintType = zget($this->config->execution->modelList, $project->model, 'sprint'); + $project = $this->loadModel('project')->getByID($_POST['project']); + $type = zget($this->config->execution->modelList, $project->model, 'sprint'); $this->config->execution->create->requiredFields .= ',project'; } /* If the execution model is a stage, determine whether the product is linked. */ - if($sprintType == 'stage' and empty($this->post->products[0])) + if($type == 'stage' and empty($this->post->products[0])) { dao::$errors['message'][] = $this->lang->execution->noLinkProduct; return false; @@ -311,7 +311,7 @@ class executionModel extends model ->setIF($this->config->systemMode == 'new', 'parent', $this->post->project) ->setIF($this->post->acl == 'open', 'whitelist', '') ->join('whitelist', ',') - ->add('type', $sprintType) + ->add('type', $type) ->stripTags($this->config->execution->editor->create['id'], $this->config->allowedTags) ->remove('products, workDays, delta, branch, uid, plans') ->get(); @@ -360,7 +360,7 @@ class executionModel extends model $member->root = $executionID; $member->join = $today; $member->days = $sprint->days; - $member->type = $sprintType; + $member->type = $type; $this->dao->insert(TABLE_TEAM)->data($member)->exec(); if($member->account == $this->app->user->account) $creatorExists = true; } @@ -375,7 +375,7 @@ class executionModel extends model $member->account = $this->app->user->account; $member->role = zget($this->lang->user->roleList, $this->app->user->role, ''); $member->join = $today; - $member->type = $sprintType; + $member->type = $type; $member->days = $sprint->days; $member->hours = $this->config->execution->defaultWorkhours; $this->dao->insert(TABLE_TEAM)->data($member)->exec(); @@ -840,7 +840,7 @@ class executionModel extends model */ public function getSwitcher($executionID, $currentModule, $currentMethod) { - if(in_array($currentMethod, array('index', 'all', 'batchedit'))) return; + if(in_array($currentMethod, array('index', 'all', 'batchedit', 'create'))) return; $currentExecutionName = $this->lang->execution->common; if($executionID) diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index e58434cc9d..ac2d15b0ce 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -10,9 +10,13 @@ * @link http://www.zentao.net */ ?> +openApp == 'execution'): ?> + + systemMode == 'new' ? $this->createLink('project', 'execution', "status=all&projectID=$projectID") : $this->createLink('execution', 'task', 'executionID=' . $executionID);?> +