diff --git a/module/story/js/common.js b/module/story/js/common.js index f0481757a9..de732986ab 100644 --- a/module/story/js/common.js +++ b/module/story/js/common.js @@ -109,7 +109,8 @@ $('[data-toggle="popover"]').each(function(item) { function relieve(index) { - $.post(relieveURL, {storyID:storyID, siblingID:index}, function(data){ + $.post(relieveURL, {siblingID: index}, function(data) + { $('[data-id="' + index + '"]').popover('hide'); if(data.result == 'success') diff --git a/module/story/lang/de.php b/module/story/lang/de.php index 14c4e80eb5..503a183021 100644 --- a/module/story/lang/de.php +++ b/module/story/lang/de.php @@ -99,12 +99,14 @@ $lang->story->successToTask = "Converted to task."; $lang->story->storyRound = '%s time estimation'; $lang->story->float = "『%s』should be positive number, decimals included."; $lang->story->saveDraftSuccess = 'Save as draft succeeded.'; -$lang->story->changeSyncTip = "The modification of this story will be synchronized to the following twin requirements"; -$lang->story->syncTip = "The twin story are synchronized except for product, branch, module, plan, and stage. After the twin relationship is dissolved, they are no longer synchronized."; -$lang->story->relievedTip = "The twin relationship cannot be restored after dissolving, the content of the demand is no longer synchronized, whether to dissolving?"; -$lang->story->assignSyncTip = "Both twin stories modify the assignor synchronously"; -$lang->story->closeSyncTip = "Twin stories are closed synchronously"; -$lang->story->activateSyncTip = "Twin stories are activated synchronously"; + +$lang->story->changeSyncTip = "The modification of this story will be synchronized to the following twin requirements"; +$lang->story->syncTip = "The twin story are synchronized except for product, branch, module, plan, and stage. After the twin relationship is dissolved, they are no longer synchronized."; +$lang->story->relievedTip = "The twin relationship cannot be restored after dissolving, the content of the demand is no longer synchronized, whether to dissolving?"; +$lang->story->assignSyncTip = "Both twin stories modify the assignor synchronously"; +$lang->story->closeSyncTip = "Twin stories are closed synchronously"; +$lang->story->activateSyncTip = "Twin stories are activated synchronously"; +$lang->story->relievedSiblingsTip = "After product adjustment, the twin relationship of this story will be automatically removed, and the story will no longer be synchronized. Do you want to save?"; $lang->story->id = 'ID'; $lang->story->parent = 'Parent'; @@ -483,6 +485,7 @@ $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->requirement->common = $lang->URCommon; $lang->requirement->create = 'Create Requirement'; diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 4de2c96313..7c16cd5314 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -99,12 +99,14 @@ $lang->story->successToTask = "Converted to task."; $lang->story->storyRound = '%s time estimation'; $lang->story->float = "『%s』should have positive number, or decimals."; $lang->story->saveDraftSuccess = 'Save as draft succeeded.'; -$lang->story->changeSyncTip = "The modification of this story will be synchronized to the following twin requirements"; -$lang->story->syncTip = "The twin story are synchronized except for product, branch, module, plan, and stage. After the twin relationship is dissolved, they are no longer synchronized."; -$lang->story->relievedTip = "The twin relationship cannot be restored after dissolving, the content of the demand is no longer synchronized, whether to dissolving?"; -$lang->story->assignSyncTip = "Both twin stories modify the assignor synchronously"; -$lang->story->closeSyncTip = "Twin stories are closed synchronously"; -$lang->story->activateSyncTip = "Twin stories are activated synchronously"; + +$lang->story->changeSyncTip = "The modification of this story will be synchronized to the following twin requirements"; +$lang->story->syncTip = "The twin story are synchronized except for product, branch, module, plan, and stage. After the twin relationship is dissolved, they are no longer synchronized."; +$lang->story->relievedTip = "The twin relationship cannot be restored after dissolving, the content of the demand is no longer synchronized, whether to dissolving?"; +$lang->story->assignSyncTip = "Both twin stories modify the assignor synchronously"; +$lang->story->closeSyncTip = "Twin stories are closed synchronously"; +$lang->story->activateSyncTip = "Twin stories are activated synchronously"; +$lang->story->relievedSiblingsTip = "After product adjustment, the twin relationship of this story will be automatically removed, and the story will no longer be synchronized. Do you want to save?"; $lang->story->id = 'ID'; $lang->story->parent = 'Parent'; @@ -483,6 +485,7 @@ $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->requirement->common = $lang->URCommon; $lang->requirement->create = 'Create Requirement'; diff --git a/module/story/lang/fr.php b/module/story/lang/fr.php index df1111501f..2d8ef45343 100644 --- a/module/story/lang/fr.php +++ b/module/story/lang/fr.php @@ -99,12 +99,14 @@ $lang->story->successToTask = "Converted to task."; $lang->story->storyRound = '%s time estimation'; $lang->story->float = "『 %s 』doit avoir des nombres positifs ou décimaux."; $lang->story->saveDraftSuccess = 'Save as draft succeeded.'; -$lang->story->changeSyncTip = "The modification of this story will be synchronized to the following twin requirements"; -$lang->story->syncTip = "The twin story are synchronized except for product, branch, module, plan, and stage. After the twin relationship is dissolved, they are no longer synchronized."; -$lang->story->relievedTip = "The twin relationship cannot be restored after dissolving, the content of the demand is no longer synchronized, whether to dissolving?"; -$lang->story->assignSyncTip = "Both twin stories modify the assignor synchronously"; -$lang->story->closeSyncTip = "Twin stories are closed synchronously"; -$lang->story->activateSyncTip = "Twin stories are activated synchronously"; + +$lang->story->changeSyncTip = "The modification of this story will be synchronized to the following twin requirements"; +$lang->story->syncTip = "The twin story are synchronized except for product, branch, module, plan, and stage. After the twin relationship is dissolved, they are no longer synchronized."; +$lang->story->relievedTip = "The twin relationship cannot be restored after dissolving, the content of the demand is no longer synchronized, whether to dissolving?"; +$lang->story->assignSyncTip = "Both twin stories modify the assignor synchronously"; +$lang->story->closeSyncTip = "Twin stories are closed synchronously"; +$lang->story->activateSyncTip = "Twin stories are activated synchronously"; +$lang->story->relievedSiblingsTip = "After product adjustment, the twin relationship of this story will be automatically removed, and the story will no longer be synchronized. Do you want to save?"; $lang->story->id = 'ID'; $lang->story->parent = 'Parent'; @@ -483,6 +485,7 @@ $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->requirement->common = $lang->URCommon; $lang->requirement->create = 'Create Requirement'; diff --git a/module/story/lang/vi.php b/module/story/lang/vi.php index cd8ced45fd..591d98b0ae 100644 --- a/module/story/lang/vi.php +++ b/module/story/lang/vi.php @@ -93,11 +93,13 @@ $lang->story->successToTask = "Converted to task."; $lang->story->storyRound = '%s time estimation'; $lang->story->float = "『%s』should be positive number, decimals included."; $lang->story->saveDraftSuccess = 'Save as draft succeeded.'; -$lang->story->changeSyncTip = "The modification of this story will be synchronized to the following twin requirements"; -$lang->story->syncTip = "The twin story are synchronized except for product, branch, module, plan, and stage. After the twin relationship is dissolved, they are no longer synchronized."; -$lang->story->assignSyncTip = "Both twin stories modify the assignor synchronously"; -$lang->story->closeSyncTip = "Twin stories are closed synchronously"; -$lang->story->activateSyncTip = "Twin stories are activated synchronously"; + +$lang->story->changeSyncTip = "The modification of this story will be synchronized to the following twin requirements"; +$lang->story->syncTip = "The twin story are synchronized except for product, branch, module, plan, and stage. After the twin relationship is dissolved, they are no longer synchronized."; +$lang->story->assignSyncTip = "Both twin stories modify the assignor synchronously"; +$lang->story->closeSyncTip = "Twin stories are closed synchronously"; +$lang->story->activateSyncTip = "Twin stories are activated synchronously"; +$lang->story->relievedSiblingsTip = "After product adjustment, the twin relationship of this story will be automatically removed, and the story will no longer be synchronized. Do you want to save?"; $lang->story->id = 'ID'; $lang->story->parent = 'Mẹ'; @@ -470,3 +472,4 @@ $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'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 4d522d9645..4380f85915 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -99,12 +99,14 @@ $lang->story->successToTask = '批量转任务成功'; $lang->story->storyRound = '第 %s 轮估算'; $lang->story->float = "『%s』应当是正数,可以是小数。"; $lang->story->saveDraftSuccess = '存为草稿成功'; -$lang->story->changeSyncTip = "该需求的修改会同步到如下的孪生需求"; -$lang->story->syncTip = "孪生需求间除产品、分支 、模块、计划、阶段外均同步,孪生关系解除后不再同步"; -$lang->story->relievedTip = "孪生关系解除后无法恢复,需求的内容不再同步,是否解除?"; -$lang->story->assignSyncTip = "孪生需求均同步修改指派人"; -$lang->story->closeSyncTip = "孪生需求均同步关闭"; -$lang->story->activateSyncTip = "孪生需求均同步激活"; + +$lang->story->changeSyncTip = "该需求的修改会同步到如下的孪生需求"; +$lang->story->syncTip = "孪生需求间除产品、分支 、模块、计划、阶段外均同步,孪生关系解除后不再同步"; +$lang->story->relievedTip = "孪生关系解除后无法恢复,需求的内容不再同步,是否解除?"; +$lang->story->assignSyncTip = "孪生需求均同步修改指派人"; +$lang->story->closeSyncTip = "孪生需求均同步关闭"; +$lang->story->activateSyncTip = "孪生需求均同步激活"; +$lang->story->relievedSiblingsTip = '产品调整后,本需求自动解除孪生关系,需求不再同步,是否保存?'; $lang->story->id = '编号'; $lang->story->parent = '父需求'; @@ -483,6 +485,7 @@ $lang->story->operateList['closed'] = '关闭'; $lang->story->operateList['activated'] = '激活'; $lang->story->operateList['changed'] = '变更'; $lang->story->operateList['reviewed'] = '评审'; +$lang->story->operateList['edited'] = '编辑'; $lang->requirement->common = $lang->URCommon; $lang->requirement->create = "提{$lang->URCommon}"; diff --git a/module/story/model.php b/module/story/model.php index 9e4f359820..5cf8b3f3e1 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -910,6 +910,14 @@ class storyModel extends model ->remove('files,labels,comment,contactListMenu,stages,reviewer,needNotReview') ->get(); + /* Relieve siblings when change product. */ + if(!empty($oldStory->siblings) and $story->product != $oldStory->product) + { + $this->dbh->exec("UPDATE " . TABLE_STORY . " SET siblings = REPLACE(siblings, ',$storyID,', ',') WHERE `product` = $oldStory->product"); + $this->dao->update(TABLE_STORY)->set('siblings')->eq('')->where('id')->eq($storyID)->orWhere('siblings')->eq(',')->exec(); + $oldStory->siblings = ''; + } + if($oldStory->type == 'story' and !isset($story->linkStories)) $story->linkStories = ''; if($oldStory->type == 'requirement' and !isset($story->linkRequirements)) $story->linkRequirements = ''; if($oldStory->status == 'changing' and $story->status == 'draft') $story->status = 'changing'; @@ -961,6 +969,19 @@ class storyModel extends model ->beginIF($oldStory->status == 'reviewing')->andWhere('reviewer')->notin(implode(',', $_POST['reviewer'])) ->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) + ->beginIF($oldStory->status == 'reviewing')->andWhere('reviewer')->notin(implode(',', $_POST['reviewer'])) + ->exec(); + } + } + foreach($_POST['reviewer'] as $reviewer) { if($oldStory->status == 'reviewing' and in_array($reviewer, array_keys($oldReviewer))) continue; @@ -970,6 +991,16 @@ 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(); + } + } } if($oldStory->status == 'reviewing') $story = $this->updateStoryByReview($storyID, $oldStory, $story); @@ -1007,6 +1038,18 @@ class storyModel extends model $data->verify = $story->verify; $data->files = $story->files = $addedFiles . trim($storyFiles, ','); $this->dao->update(TABLE_STORYSPEC)->data($data)->where('story')->eq((int)$storyID)->andWhere('version')->eq($oldStory->version)->exec(); + + /* Sync siblings. */ + if(!empty($oldStory->siblings)) + { + foreach(explode(',', trim($oldStory->siblings, ',')) as $siblingID) + { + $this->dao->update(TABLE_STORYSPEC)->data($data) + ->where('story')->eq((int)$siblingID) + ->andWhere('version')->eq($oldStory->version) + ->exec(); + } + } } if($story->product != $oldStory->product) @@ -1136,6 +1179,8 @@ class storyModel extends model if(isset($story->finalResult)) $this->recordReviewAction($story); } + if(!empty($oldStory->siblings)) $this->syncSiblings($oldStory->id, $oldStory->siblings, $changes, 'Edited'); + return true; } } @@ -1549,14 +1594,26 @@ class storyModel extends model /* Fix bug #671. */ $this->lang->story->closedReason = $this->lang->story->rejectedReason; - $this->dao->update(TABLE_STORYREVIEW)->set('result')->eq($this->post->result)->set('reviewDate')->eq($now)->where('story')->eq($storyID)->andWhere('version')->eq($oldStory->version)->andWhere('reviewer')->eq($this->app->user->account)->exec(); + $this->dao->update(TABLE_STORYREVIEW) + ->set('result')->eq($this->post->result) + ->set('reviewDate')->eq($now) + ->where('story')->eq($storyID) + ->andWhere('version')->eq($oldStory->version) + ->andWhere('reviewer')->eq($this->app->user->account) + ->exec(); /* Sync siblings. */ if(!empty($oldStory->siblings)) { foreach(explode(',', trim($oldStory->siblings, ',')) as $siblingID) { - $this->dao->update(TABLE_STORYREVIEW)->set('result')->eq($this->post->result)->set('reviewDate')->eq($now)->where('story')->eq($siblingID)->andWhere('version')->eq($oldStory->version)->andWhere('reviewer')->eq($this->app->user->account)->exec(); + $this->dao->update(TABLE_STORYREVIEW) + ->set('result')->eq($this->post->result) + ->set('reviewDate')->eq($now) + ->where('story')->eq($siblingID) + ->andWhere('version')->eq($oldStory->version) + ->andWhere('reviewer')->eq($this->app->user->account) + ->exec(); } } @@ -6211,6 +6268,8 @@ class storyModel extends model $syncFieldList[$fieldName] = $fieldValue; } + if(empty($syncFieldList)) return; + /* Synchronize and record dynamics. */ $this->loadModel('action'); $siblings = explode(',', trim($siblings, ',')); diff --git a/module/story/view/edit.html.php b/module/story/view/edit.html.php index b2065d0f61..f0affe9be5 100644 --- a/module/story/view/edit.html.php +++ b/module/story/view/edit.html.php @@ -24,6 +24,8 @@ story->feedbackSource); ?> status);?> +siblings)?> +story->relievedSiblingsTip)?>