From 283683350d88a0194587e565a4487bcef6ae630f Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 1 Jun 2021 15:52:10 +0800 Subject: [PATCH] * Fix bug #12674. --- module/execution/lang/de.php | 2 ++ module/execution/lang/en.php | 2 ++ module/execution/lang/fr.php | 2 ++ module/execution/lang/vi.php | 2 ++ module/execution/lang/zh-cn.php | 2 ++ module/execution/model.php | 23 +++++++++++++++++++++++ 6 files changed, 33 insertions(+) diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php index 54e8c5b89c..1cd443fa34 100644 --- a/module/execution/lang/de.php +++ b/module/execution/lang/de.php @@ -312,6 +312,8 @@ $lang->execution->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked $lang->execution->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action."; $lang->execution->errorNoLinkedProducts = "Kein verknüpftes {$lang->productCommon} in {$lang->executionCommon} gefunden. Sie werden auf die {$lang->productCommon} Seite geleitet."; $lang->execution->errorSameProducts = "{$lang->executionCommon} Kann nicht mit mehreren identischen {$lang->productCommon} verknüpft werden"; +$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; +$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; $lang->execution->accessDenied = "Zugriff zu {$lang->executionCommon} verweigert!"; $lang->execution->tips = 'Hinweis'; $lang->execution->afterInfo = "{$lang->executionCommon} wurde erstellt. Als nächstes können Sie "; diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index 9589f58a7f..aed49d6f34 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -312,6 +312,8 @@ $lang->execution->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked $lang->execution->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action."; $lang->execution->errorNoLinkedProducts = "No {$lang->productCommon} is linked to {$lang->executionCommon}. You will be directed to {$lang->productCommon} page to link one."; $lang->execution->errorSameProducts = "{$lang->executionCommon} cannot be linked to the same {$lang->productCommon} twice."; +$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; +$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; $lang->execution->accessDenied = "Your access to {$lang->executionCommon} is denied!"; $lang->execution->tips = 'Note'; $lang->execution->afterInfo = "{$lang->executionCommon} is created. Next you can "; diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php index 304a5852e3..d03d674887 100644 --- a/module/execution/lang/fr.php +++ b/module/execution/lang/fr.php @@ -312,6 +312,8 @@ $lang->execution->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked $lang->execution->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action."; $lang->execution->errorNoLinkedProducts = "Aucun {$lang->productCommon} n'est associé à ce {$lang->executionCommon}. Vous allez être redirigé vers la page {$lang->productCommon} pour en associer un."; $lang->execution->errorSameProducts = "Ce {$lang->executionCommon} ne peut pas être associé deux fois au même {$lang->productCommon}. Imaginez un peu les résultats !"; +$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; +$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; $lang->execution->accessDenied = "Votre accès au {$lang->executionCommon} est refusé ! Désolé."; $lang->execution->tips = 'Note'; $lang->execution->afterInfo = "Le {$lang->executionCommon} a été créé avec succès ! Ensuite vous pouvez "; diff --git a/module/execution/lang/vi.php b/module/execution/lang/vi.php index c65291be2c..5dcb49b1af 100644 --- a/module/execution/lang/vi.php +++ b/module/execution/lang/vi.php @@ -312,6 +312,8 @@ $lang->execution->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked $lang->execution->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action."; $lang->execution->errorNoLinkedProducts = "Không có {$lang->productCommon} liên kết tới {$lang->executionCommon}. Bạn sẽ được chuyển tới trang {$lang->productCommon} để liên kết."; $lang->execution->errorSameProducts = "{$lang->executionCommon} không thể liên kết tới {$lang->productCommon} giống nhau 2 lần."; +$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s."; +$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project."; $lang->execution->accessDenied = "Truy cập của bạn tới {$lang->executionCommon} bị từ chối!"; $lang->execution->tips = 'Ghi chú'; $lang->execution->afterInfo = "{$lang->executionCommon} được tạo. Tiếp theo bạn có thể "; diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index 6b1123d757..2a438df8e6 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -312,6 +312,8 @@ $lang->execution->notAllowedUnlinkStory = "该{$lang->SRCommon}已经与项 $lang->execution->notAllowRemoveProducts = "该{$lang->productCommon}中的{$lang->SRCommon}已与该{$lang->executionCommon}进行了关联,请取消关联后再操作。"; $lang->execution->errorNoLinkedProducts = "该{$lang->executionCommon}没有关联的{$lang->productCommon},系统将转到{$lang->productCommon}关联页面"; $lang->execution->errorSameProducts = "{$lang->executionCommon}不能关联多个相同的{$lang->productCommon}。"; +$lang->execution->errorBegin = "{$lang->executionCommon}的开始时间不能小于所属项目的开始时间%s。"; +$lang->execution->errorEnd = "{$lang->executionCommon}的结束时间不能大于所属项目的结束时间%s。"; $lang->execution->accessDenied = "您无权访问该{$lang->executionCommon}!"; $lang->execution->tips = '提示'; $lang->execution->afterInfo = "{$lang->executionCommon}添加成功,您现在可以进行以下操作:"; diff --git a/module/execution/model.php b/module/execution/model.php index f4b7469717..1aef7c127b 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -295,6 +295,17 @@ class executionModel extends model /* Determine whether to add a sprint or a stage according to the model of the execution. */ $project = $this->loadModel('project')->getByID($_POST['project']); + if($_POST['begin'] < $project->begin and $this->config->systemMode == 'new') + { + dao::$errors['begin'] = sprintf($this->lang->execution->errorBegin, $project->begin); + return false; + } + + if($_POST['end'] > $project->end and $this->config->systemMode == 'new') + { + dao::$errors['end'] = sprintf($this->lang->execution->errorEnd, $project->end); + return false; + } $type = zget($this->config->execution->modelList, $project->model, 'sprint'); $this->config->execution->create->requiredFields .= ',project'; @@ -453,6 +464,18 @@ class executionModel extends model ->remove('products, branch, uid, plans') ->get(); + $project = $this->dao->select('begin, end')->from(TABLE_PROJECT)->where('id')->eq($oldExecution->project)->fetch(); + if($execution->begin < $project->begin and $this->config->systemMode == 'new') + { + dao::$errors['begin'] = sprintf($this->lang->execution->errorBegin, $project->begin); + return false; + } + + if($execution->end > $project->end and $this->config->systemMode == 'new') + { + dao::$errors['end'] = sprintf($this->lang->execution->errorEnd, $project->end); + return false; + } /* Child stage inherits parent stage permissions. */ if(!isset($execution->acl)) $execution->acl = $oldExecution->acl; if($execution->acl == 'open') $execution->whitelist = '';