From b3078f74113e449267d0c50bd170ed08e576fed0 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Fri, 12 Apr 2024 13:55:59 +0800 Subject: [PATCH] * Fix bug #47705. --- module/execution/control.php | 26 ++++++++++++-------------- module/execution/model.php | 5 +++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 1d3afc9e40..30e51e98fc 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1223,6 +1223,16 @@ class execution extends control $this->app->loadLang('stage'); $this->app->loadLang('programplan'); + if($this->app->tab == 'project') + { + $projectID = $this->session->project; + $project = $this->project->getById($projectID); + $this->project->setMenu($projectID); + $this->view->project = $project; + if(in_array($project->model, array('waterfall', 'waterfallplus', 'ipd'))) $this->lang->execution->common = $this->lang->execution->stage; + if($project->model == 'ipd') $this->config->execution->list->customBatchEditFields = 'days,team,desc,PO,QD,PM,RD'; + } + if($this->post->name) { $postData = fixer::input('post')->get(); @@ -1243,20 +1253,8 @@ class execution extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->session->executionList)); } - if($this->app->tab == 'project') - { - $projectID = $this->session->project; - $project = $this->project->getById($projectID); - $allProjects = $this->project->getPairsByModel($project->model, 'noclosed', isset($projectID) ? $projectID : 0); - $this->project->setMenu($projectID); - $this->view->project = $project; - if($project->model == 'waterfall' or $project->model == 'waterfallplus') $this->lang->execution->common = $this->lang->execution->stage; - if($project->model == 'ipd') $this->config->execution->list->customBatchEditFields = 'days,team,desc,PO,QD,PM,RD'; - } - else - { - $allProjects = $this->project->getPairsByModel('all', 'noclosed', isset($projectID) ? $projectID : 0); - } + $projectModel = $this->app->tab == 'project' ? $project->model : 'all'; + $allProjects = $this->project->getPairsByModel($projectModel, 'noclosed', isset($projectID) ? $projectID : 0); if(!$this->post->executionIDList) { diff --git a/module/execution/model.php b/module/execution/model.php index 12403bceec..c19945417d 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -534,14 +534,15 @@ class executionModel extends model /* Name check. */ $parentID = $parents[$executionID]; - if(isset($nameList[$executionName])) + if(isset($nameList[$executionName]) && !empty($executionName)) { foreach($nameList[$executionName] as $repeatID) { if($parentID == $parents[$repeatID]) { $type = $oldExecution->type == 'stage' ? 'stage' : 'agileplus'; - dao::$errors["name[$executionID]"] = sprintf($this->lang->execution->errorNameRepeat, strtolower(zget($this->lang->programplan->typeList, $type))); + $repeatTip = $parentID == $projectID ? $this->lang->programplan->error->sameName : sprintf($this->lang->execution->errorNameRepeat, strtolower(zget($this->lang->programplan->typeList, $type))); + dao::$errors["name[$executionID]"] = $repeatTip; } } }