From 12fb7839b79a6e0d55118624f7c7ee5514555b4e Mon Sep 17 00:00:00 2001 From: zenggang Date: Mon, 26 Jul 2021 16:47:26 +0800 Subject: [PATCH] * Finish task #40461 --- module/execution/model.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index f58abd70bd..9117c74865 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -442,7 +442,7 @@ class executionModel extends model $oldExecution = $this->dao->findById($executionID)->from(TABLE_EXECUTION)->fetch(); /* Judgment of required items. */ - if($this->post->code == '') + if($oldExecution->type != 'stage' and $this->post->code == '') { dao::$errors['code'] = sprintf($this->lang->error->notempty, $this->lang->execution->code); return false; @@ -502,7 +502,7 @@ class executionModel extends model ->checkIF($execution->begin != '', 'begin', 'date') ->checkIF($execution->end != '', 'end', 'date') ->checkIF($execution->end != '', 'end', 'gt', $execution->begin) - ->check('code', 'unique', "id!=$executionID and deleted='0'") + ->check('code', 'unique', "id!=$executionID and code!='' and deleted='0'") ->where('id')->eq($executionID) ->limit(1) ->exec(); @@ -609,11 +609,11 @@ class executionModel extends model $nameList[$executionName] = $executionName; /* Check unique code for edited executions. */ - if(empty($executionCode)) + if($projectModel == 'scrum' and empty($executionCode)) { dao::$errors['code'][] = 'execution#' . $executionID . sprintf($this->lang->error->notempty, $this->lang->project->code); } - else + elseif(!empty($executionCode)) { /* Check unique code for edited executions. */ if(isset($codeList[$executionCode])) dao::$errors['code'][] = 'execution#' . $executionID . sprintf($this->lang->error->unique, $this->lang->project->code, $executionCode);