* [bug#68330,done,0.2h] modify the logic for checking duplicate name.

This commit is contained in:
tianshujie
2025-12-19 09:29:42 +08:00
parent 271c781585
commit 405c590cc5
+1 -4
View File
@@ -429,9 +429,6 @@ class executionModel extends model
if($oldExecution->type == 'stage' and $field == 'name') $this->lang->project->name = str_replace($this->lang->executionCommon, $this->lang->project->stage, $this->lang->project->name);
}
$relatedExecutionsID = $this->getRelatedExecutions($executionID);
$relatedExecutionsID = !empty($relatedExecutionsID) ? implode(',', array_keys($relatedExecutionsID)) : '0';
/* Update data. */
$this->lang->error->unique = $this->lang->error->repeat;
$executionProject = isset($execution->project) ? $execution->project : $oldExecution->project;
@@ -441,7 +438,7 @@ class executionModel extends model
->checkIF($execution->begin != '', 'begin', 'date')
->checkIF($execution->end != '', 'end', 'date')
->checkIF($execution->end != '', 'end', 'ge', $execution->begin)
->checkIF(!empty($execution->name), 'name', 'unique', "id in ($relatedExecutionsID) and type in ('sprint','stage', 'kanban') and `project` = '$executionProject' and `deleted` = '0'")
->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage', 'kanban') and `project` = '$executionProject' and `deleted` = '0'")
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage', 'kanban') and `project` = '$executionProject' and `deleted` = '0'")
->checkFlow()
->where('id')->eq($executionID)