From 6d7f3454b35b4f5b29862ae198fa2972ae4a0ade Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 14 Oct 2025 09:55:05 +0800 Subject: [PATCH] * [bug#65334,done,1.5h] add estimate can't negative tip. --- module/story/lang/de.php | 1 + module/story/lang/en.php | 1 + module/story/lang/fr.php | 1 + module/story/lang/zh-cn.php | 1 + module/story/zen.php | 12 ++++++++++++ 5 files changed, 16 insertions(+) diff --git a/module/story/lang/de.php b/module/story/lang/de.php index a8ec16c4b5..209c22e0d8 100644 --- a/module/story/lang/de.php +++ b/module/story/lang/de.php @@ -396,6 +396,7 @@ $lang->story->batchGradeSameRoot = 'The requirements %s has a parent-child r $lang->story->batchGradeGtParent = 'The grade of %s requirements cannot be higher than its parent requirement, and it has been ignored in this modification.'; $lang->story->batchParentError = "The parent requirement of %s requirement cannot be itself or its child requirement, which has been ignored in this modification."; $lang->story->errorNoGradeSplit = "There has no grade to split."; +$lang->story->errorRecordMinus = '『%s』should not be negative number.'; $lang->story->form = new stdclass(); $lang->story->form->area = 'Story Bereich'; diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 28465c92aa..f47d6235cb 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -396,6 +396,7 @@ $lang->story->batchGradeSameRoot = 'The requirements %s has a parent-child r $lang->story->batchGradeGtParent = 'The grade of %s requirements cannot be higher than its parent requirement, and it has been ignored in this modification.'; $lang->story->batchParentError = "The parent requirement of %s requirement cannot be itself or its child requirement, which has been ignored in this modification."; $lang->story->errorNoGradeSplit = "There has no grade to split."; +$lang->story->errorRecordMinus = '『%s』should not be negative number.'; $lang->story->form = new stdclass(); $lang->story->form->area = 'Scope'; diff --git a/module/story/lang/fr.php b/module/story/lang/fr.php index 72f14dcb49..3f3a65d5d4 100644 --- a/module/story/lang/fr.php +++ b/module/story/lang/fr.php @@ -396,6 +396,7 @@ $lang->story->batchGradeSameRoot = 'The requirements %s has a parent-child r $lang->story->batchGradeGtParent = 'The grade of %s requirements cannot be higher than its parent requirement, and it has been ignored in this modification.'; $lang->story->batchParentError = "The parent requirement of %s requirement cannot be itself or its child requirement, which has been ignored in this modification."; $lang->story->errorNoGradeSplit = "There has no grade to split."; +$lang->story->errorRecordMinus = '『%s』should not be negative number.'; $lang->story->form = new stdclass(); $lang->story->form->area = 'Périmètre'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 3d574b9c3d..56ca9a4122 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -396,6 +396,7 @@ $lang->story->batchGradeSameRoot = '%s需求存在父子关系,将不会 $lang->story->batchGradeGtParent = '%s需求的层级不能高于其父需求,本次修改已将其忽略。'; $lang->story->batchParentError = "%s需求的父需求不能为其本身或其子需求,本次修改已将其忽略。"; $lang->story->errorNoGradeSplit = "没有可拆分的需求层级"; +$lang->story->errorRecordMinus = '『%s』不能为负数'; $lang->story->form = new stdclass(); $lang->story->form->area = "该{$lang->SRCommon}所属范围"; diff --git a/module/story/zen.php b/module/story/zen.php index 19dbdd3590..2424268053 100644 --- a/module/story/zen.php +++ b/module/story/zen.php @@ -1215,6 +1215,9 @@ class storyZen extends story if(empty($moduleID)) dao::$errors["modules[{$key}]"][] = sprintf($this->lang->error->notempty, $this->lang->story->module); } } + + if(!empty($_POST['estimate']) && $_POST['estimate'] < 0) dao::$errors['estimate'] = sprintf($this->lang->story->errorRecordMinus, $this->lang->story->estimateAB); + if(dao::isError()) return false; $storyData = form::data($fields) @@ -1252,6 +1255,7 @@ class storyZen extends story { $storyPlan = array(); $oldStory = $this->story->getByID($storyID); + if(!$oldStory) return false; if(!empty($_POST['lastEditedDate']) and $oldStory->lastEditedDate != $this->post->lastEditedDate) dao::$errors[] = $this->lang->error->editedByOther; if(strpos('draft,changing', $oldStory->status) !== false and $this->story->checkForceReview($oldStory->type) and empty($_POST['reviewer'])) dao::$errors[] = $this->lang->story->notice->reviewerNotEmpty; @@ -1268,6 +1272,9 @@ class storyZen extends story if(isset($_POST['reviewer'])) $_POST['reviewer'] = array_filter($_POST['reviewer']); if(!$this->post->needNotReview and empty($_POST['reviewer'])) dao::$errors['reviewer'] = $this->lang->story->errorEmptyReviewedBy; } + + if(!empty($_POST['estimate']) && $_POST['estimate'] < 0) dao::$errors['estimate'] = sprintf($this->lang->story->errorRecordMinus, $this->lang->story->estimateAB); + if(dao::isError()) return false; $hasProduct = $this->dao->select('t2.hasProduct')->from(TABLE_PROJECTPRODUCT)->alias('t1') @@ -1498,6 +1505,7 @@ class storyZen extends story if($result == 'reject' && empty($closedReason)) dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->story->rejectedReason); if($result == 'reject' && $closedReason == 'duplicate' && empty($storyData->duplicateStory)) dao::$errors[] = sprintf($this->lang->error->notempty, $this->lang->story->duplicateStory); + if(!empty($storyData->estimate) && $storyData->estimate < 0) dao::$errors['estimate'] = sprintf($this->lang->story->errorRecordMinus, $this->lang->story->estimate); if(dao::isError()) return false; return $this->loadModel('file')->processImgURL($storyData, $this->config->story->editor->review['id'], $this->post->uid); @@ -1529,6 +1537,8 @@ class storyZen extends story dao::$errors["title[$i]"] = sprintf($this->lang->story->error->length, 255); } + if(!empty($story->estimate) && $story->estimate < 0) dao::$errors["estimate[$i]"] = sprintf($this->lang->story->errorRecordMinus, $this->lang->story->estimate); + $story->type = $storyType; $story->status = (empty($story->reviewer) && !$forceReview) ? 'active' : 'reviewing'; $story->status = $saveDraft ? 'draft' : $story->status; @@ -1595,6 +1605,8 @@ class storyZen extends story if($story->stage == 'wait' && !empty($story->roadmap) && isset($roadmaps[$story->roadmap])) $story->stage = $roadmaps[$story->roadmap]->status == 'launched' ? 'incharter' : 'inroadmap'; if(empty($story->roadmap)) $story->stage = 'wait'; } + + if(!empty($story->estimate) && $story->estimate < 0) dao::$errors["estimate[{$storyID}]"] = sprintf($this->lang->story->errorRecordMinus, $this->lang->story->estimate); } return $stories;