From f01d68f80b6250a63c110db754b81b4ce45774aa Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Mon, 7 Nov 2022 07:58:08 +0000 Subject: [PATCH] * Code for task#75325. Finish submit review sync siblings. --- module/story/lang/de.php | 15 ++++++++------- module/story/lang/en.php | 15 ++++++++------- module/story/lang/fr.php | 15 ++++++++------- module/story/lang/vi.php | 13 +++++++------ module/story/lang/zh-cn.php | 15 ++++++++------- module/story/model.php | 24 +++++++++++++++++++++++- 6 files changed, 62 insertions(+), 35 deletions(-) diff --git a/module/story/lang/de.php b/module/story/lang/de.php index 503a183021..d5e3e08eb7 100644 --- a/module/story/lang/de.php +++ b/module/story/lang/de.php @@ -480,12 +480,13 @@ $lang->story->featureBar['browse']['draft'] = $lang->story->statusList['draf $lang->story->featureBar['browse']['reviewing'] = $lang->story->statusList['reviewing']; $lang->story->operateList = array(); -$lang->story->operateList['assigned'] = 'assigned'; -$lang->story->operateList['closed'] = 'closed'; -$lang->story->operateList['activated'] = 'activated'; -$lang->story->operateList['changed'] = 'changed'; -$lang->story->operateList['reviewed'] = 'reviewed'; -$lang->story->operateList['edited'] = 'edited'; +$lang->story->operateList['assigned'] = 'assigned'; +$lang->story->operateList['closed'] = 'closed'; +$lang->story->operateList['activated'] = 'activated'; +$lang->story->operateList['changed'] = 'changed'; +$lang->story->operateList['reviewed'] = 'reviewed'; +$lang->story->operateList['edited'] = 'edited'; +$lang->story->operateList['submitreview'] = 'submit review'; $lang->requirement->common = $lang->URCommon; $lang->requirement->create = 'Create Requirement'; @@ -514,4 +515,4 @@ $lang->requirement->linkStory = 'Link Story'; $lang->story->addBranch = 'Add %s'; $lang->story->deleteBranch = 'Delete %s'; -$lang->story->notice->branch = 'Each branch will establish a requirement, and the requirements are twins. The twins requirements are synchronized except for the product, branch, module, plan, and stage fields. You can manually remove the twins relationship later'; \ No newline at end of file +$lang->story->notice->branch = 'Each branch will establish a requirement, and the requirements are twins. The twins requirements are synchronized except for the product, branch, module, plan, and stage fields. You can manually remove the twins relationship later'; diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 7c16cd5314..10e9e56319 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -480,12 +480,13 @@ $lang->story->featureBar['browse']['draft'] = $lang->story->statusList['draf $lang->story->featureBar['browse']['reviewing'] = $lang->story->statusList['reviewing']; $lang->story->operateList = array(); -$lang->story->operateList['assigned'] = 'assigned'; -$lang->story->operateList['closed'] = 'closed'; -$lang->story->operateList['activated'] = 'activated'; -$lang->story->operateList['changed'] = 'changed'; -$lang->story->operateList['reviewed'] = 'reviewed'; -$lang->story->operateList['edited'] = 'edited'; +$lang->story->operateList['assigned'] = 'assigned'; +$lang->story->operateList['closed'] = 'closed'; +$lang->story->operateList['activated'] = 'activated'; +$lang->story->operateList['changed'] = 'changed'; +$lang->story->operateList['reviewed'] = 'reviewed'; +$lang->story->operateList['edited'] = 'edited'; +$lang->story->operateList['submitreview'] = 'submit review'; $lang->requirement->common = $lang->URCommon; $lang->requirement->create = 'Create Requirement'; @@ -514,4 +515,4 @@ $lang->requirement->linkStory = 'Link Story'; $lang->story->addBranch = 'Add %s'; $lang->story->deleteBranch = 'Delete %s'; -$lang->story->notice->branch = 'Each branch will establish a requirement, and the requirements are twins. The twins requirements are synchronized except for the product, branch, module, plan, and stage fields. You can manually remove the twins relationship later'; \ No newline at end of file +$lang->story->notice->branch = 'Each branch will establish a requirement, and the requirements are twins. The twins requirements are synchronized except for the product, branch, module, plan, and stage fields. You can manually remove the twins relationship later'; diff --git a/module/story/lang/fr.php b/module/story/lang/fr.php index 2d8ef45343..9f33cdc716 100644 --- a/module/story/lang/fr.php +++ b/module/story/lang/fr.php @@ -480,12 +480,13 @@ $lang->story->featureBar['browse']['draft'] = $lang->story->statusList['draf $lang->story->featureBar['browse']['reviewing'] = $lang->story->statusList['reviewing']; $lang->story->operateList = array(); -$lang->story->operateList['assigned'] = 'assigned'; -$lang->story->operateList['closed'] = 'closed'; -$lang->story->operateList['activated'] = 'activated'; -$lang->story->operateList['changed'] = 'changed'; -$lang->story->operateList['reviewed'] = 'reviewed'; -$lang->story->operateList['edited'] = 'edited'; +$lang->story->operateList['assigned'] = 'assigned'; +$lang->story->operateList['closed'] = 'closed'; +$lang->story->operateList['activated'] = 'activated'; +$lang->story->operateList['changed'] = 'changed'; +$lang->story->operateList['reviewed'] = 'reviewed'; +$lang->story->operateList['edited'] = 'edited'; +$lang->story->operateList['submitreview'] = 'submit review'; $lang->requirement->common = $lang->URCommon; $lang->requirement->create = 'Create Requirement'; @@ -514,4 +515,4 @@ $lang->requirement->linkStory = 'Lier Story'; $lang->story->addBranch = 'Add %s'; $lang->story->deleteBranch = 'Delete %s'; -$lang->story->notice->branch = 'Each branch will establish a requirement, and the requirements are twins. The twins requirements are synchronized except for the product, branch, module, plan, and stage fields. You can manually remove the twins relationship later'; \ No newline at end of file +$lang->story->notice->branch = 'Each branch will establish a requirement, and the requirements are twins. The twins requirements are synchronized except for the product, branch, module, plan, and stage fields. You can manually remove the twins relationship later'; diff --git a/module/story/lang/vi.php b/module/story/lang/vi.php index 591d98b0ae..b8cff231f9 100644 --- a/module/story/lang/vi.php +++ b/module/story/lang/vi.php @@ -467,9 +467,10 @@ $lang->story->featureBar['browse']['draft'] = $lang->story->statusList['draf $lang->story->featureBar['browse']['reviewing'] = $lang->story->statusList['reviewing']; $lang->story->operateList = array(); -$lang->story->operateList['assigned'] = 'assigned'; -$lang->story->operateList['closed'] = 'closed'; -$lang->story->operateList['activated'] = 'activated'; -$lang->story->operateList['changed'] = 'changed'; -$lang->story->operateList['reviewed'] = 'reviewed'; -$lang->story->operateList['edited'] = 'edited'; +$lang->story->operateList['assigned'] = 'assigned'; +$lang->story->operateList['closed'] = 'closed'; +$lang->story->operateList['activated'] = 'activated'; +$lang->story->operateList['changed'] = 'changed'; +$lang->story->operateList['reviewed'] = 'reviewed'; +$lang->story->operateList['edited'] = 'edited'; +$lang->story->operateList['submitreview'] = 'submit review'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 4380f85915..8e5b9c9e70 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -480,12 +480,13 @@ $lang->story->featureBar['browse']['draft'] = $lang->story->statusList['draf $lang->story->featureBar['browse']['reviewing'] = $lang->story->statusList['reviewing']; $lang->story->operateList = array(); -$lang->story->operateList['assigned'] = '指派'; -$lang->story->operateList['closed'] = '关闭'; -$lang->story->operateList['activated'] = '激活'; -$lang->story->operateList['changed'] = '变更'; -$lang->story->operateList['reviewed'] = '评审'; -$lang->story->operateList['edited'] = '编辑'; +$lang->story->operateList['assigned'] = '指派'; +$lang->story->operateList['closed'] = '关闭'; +$lang->story->operateList['activated'] = '激活'; +$lang->story->operateList['changed'] = '变更'; +$lang->story->operateList['reviewed'] = '评审'; +$lang->story->operateList['edited'] = '编辑'; +$lang->story->operateList['submitreview'] = '提交评审'; $lang->requirement->common = $lang->URCommon; $lang->requirement->create = "提{$lang->URCommon}"; @@ -514,4 +515,4 @@ $lang->requirement->linkStory = "关联{$lang->SRCommon}"; $lang->story->addBranch = '添加%s'; $lang->story->deleteBranch = '删除%s'; -$lang->story->notice->branch = '每个分支会建立一个需求,需求间互为孪生关系,孪生需求间除产品、分支、模块、计划、阶段字段外均同步,后期您可以手动解除孪生关系'; \ No newline at end of file +$lang->story->notice->branch = '每个分支会建立一个需求,需求间互为孪生关系,孪生需求间除产品、分支、模块、计划、阶段字段外均同步,后期您可以手动解除孪生关系'; diff --git a/module/story/model.php b/module/story/model.php index f9a0bf33ec..d733cd0a2b 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1798,6 +1798,15 @@ class storyModel extends model $this->dao->delete()->from(TABLE_STORYREVIEW)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->exec(); + /* Sync siblings. */ + if(!empty($oldStory->siblings)) + { + foreach(explode(',', trim($oldStory->siblings, ',')) as $siblingID) + { + $this->dao->delete()->from(TABLE_STORYREVIEW)->where('story')->eq($siblingID)->andWhere('version')->eq($oldStory->version)->exec(); + } + } + if(isset($_POST['reviewer'])) { foreach($this->post->reviewer as $reviewer) @@ -1809,12 +1818,25 @@ class storyModel extends model $reviewData->version = $oldStory->version; $reviewData->reviewer = $reviewer; $this->dao->insert(TABLE_STORYREVIEW)->data($reviewData)->exec(); + + /* Sync siblings. */ + if(!empty($oldStory->siblings)) + { + foreach(explode(',', trim($oldStory->siblings, ',')) as $siblingID) + { + $reviewData->story = $siblingID; + $this->dao->insert(TABLE_STORYREVIEW)->data($reviewData)->exec(); + } + } } $story->status = 'reviewing'; } $this->dao->update(TABLE_STORY)->data($story, 'reviewer')->where('id')->eq($storyID)->exec(); - if(!dao::isError()) return common::createChanges($oldStory, $story); + + $changes = common::createChanges($oldStory, $story); + if(!empty($oldStory->siblings)) $this->syncSiblings($storyID, $oldStory->siblings, $changes, 'submitReview'); + if(!dao::isError()) return $changes; return false; }