From dda0446e570171543b586fb4eba528d34262f397 Mon Sep 17 00:00:00 2001 From: Yagami Date: Fri, 2 Dec 2022 14:34:34 +0800 Subject: [PATCH] * Fix bug #30436. --- module/execution/model.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/module/execution/model.php b/module/execution/model.php index cc2033499b..1ad969db4a 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -332,6 +332,20 @@ class executionModel extends model $this->checkBeginAndEndDate($_POST['project'], $_POST['begin'], $_POST['end']); if(dao::isError()) return false; + if($_POST['products']) + { + $this->app->loadLang('project'); + $multipleProducts = $this->loadModel('product')->getMultiBranchPairs(); + foreach($_POST['products'] as $index => $productID) + { + if(isset($multipleProducts[$productID]) and empty($_POST['branch'][$index])) + { + dao::$errors[] = $this->lang->project->emptyBranch; + return false; + } + } + } + /* Determine whether to add a sprint or a stage according to the model of the execution. */ $project = $this->loadModel('project')->getByID($_POST['project']); $type = 'sprint'; @@ -514,6 +528,20 @@ class executionModel extends model return false; } + if($_POST['products']) + { + $this->app->loadLang('project'); + $multipleProducts = $this->loadModel('product')->getMultiBranchPairs(); + foreach($_POST['products'] as $index => $productID) + { + if(isset($multipleProducts[$productID]) and empty($_POST['branch'][$index])) + { + dao::$errors[] = $this->lang->project->emptyBranch; + return false; + } + } + } + /* Get the data from the post. */ $execution = fixer::input('post') ->add('id', $executionID)