@@ -30,17 +31,7 @@ productplan->product;?> name;?> - type != 'normal' and $plan->parent != '-1'):?> - - product->branch;?> - branch, "onchange='getConflictStories($plan->id);' class='form-control chosen' multiple");?> - - - - productplan->title;?> - title, "class='form-control' required");?> - parent == '-1'):?> parent);?> @@ -49,6 +40,16 @@ '') + $parentPlanPairs, $plan->parent, "class='form-control chosen'");?> + shadow and $product->type != 'normal' and $plan->parent != '-1'):?> + + product->branch;?> + branch, "class='form-control chosen' multiple");?> + + + + productplan->title;?> + title, "class='form-control' required");?> + productplan->status;?> parent == -1 ? "disabled='disabled'" : '' ;?> From c1257aac6b00892f84929daafcf727b3b95ec9c7 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 6 Dec 2022 09:57:03 +0800 Subject: [PATCH 2/5] * Code for task#78669. --- module/productplan/control.php | 2 -- module/productplan/js/create.js | 2 +- module/productplan/js/edit.js | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/module/productplan/control.php b/module/productplan/control.php index 389b366571..d2b1ff27b6 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -956,8 +956,6 @@ class productplan extends control */ public function ajaxGetConflict($planID, $newBranch) { - if($newBranch == '') return; - $plan = $this->productplan->getByID($planID); $oldBranch = $plan->branch; $planStories = $this->loadModel('story')->getPlanStories($planID, 'all'); diff --git a/module/productplan/js/create.js b/module/productplan/js/create.js index fdf7805e8f..6bfe71b4ba 100644 --- a/module/productplan/js/create.js +++ b/module/productplan/js/create.js @@ -74,7 +74,7 @@ $('#parent').change(function() }) }) -$('#branch').change(function() +$('#dataform').on('change', '#branch', function() { if(parentPlanID) return; diff --git a/module/productplan/js/edit.js b/module/productplan/js/edit.js index 6a6f6fd562..7e0541f621 100644 --- a/module/productplan/js/edit.js +++ b/module/productplan/js/edit.js @@ -13,7 +13,7 @@ function convertStringToDate(dateString) return Date.parse(dateString); } -$('#branch').change(function() +$('#dataform').on('change', '#branch', function() { var newBranch = $('#branch').val() ? $('#branch').val().toString() : ''; $.get(createLink('productplan', 'ajaxGetConflict', 'planID=' + planID + '&newBranch=' + newBranch), function(conflictStories) From c23d02ca73fd7459648d267798a40a99a187d054 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 6 Dec 2022 10:03:42 +0800 Subject: [PATCH 3/5] * Code for task#78669. --- module/productplan/control.php | 2 +- module/productplan/model.php | 17 +---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/module/productplan/control.php b/module/productplan/control.php index d2b1ff27b6..8ef3268a79 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -117,7 +117,7 @@ class productplan extends control $this->view->branches = $branchPairs; $this->view->defaultBranch = $defaultBranch; $this->view->parent = $parent; - $this->view->parentPlanPairs = $this->productplan->getTopPlanPairs($productID, '', 'done,closed'); + $this->view->parentPlanPairs = $this->productplan->getTopPlanPairs($productID, 'done,closed'); $this->display(); } diff --git a/module/productplan/model.php b/module/productplan/model.php index d378d62382..a5604badb9 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -222,29 +222,14 @@ class productplanModel extends model * Get top plan pairs. * * @param int $productID - * @param int $branch * @param int $exclude * @access public * @return array */ - public function getTopPlanPairs($productID, $branch = '', $exclude = '') + public function getTopPlanPairs($productID, $exclude = '') { - $branchQuery = ''; - if($branch !== '') - { - $branchQuery .= '('; - $branchCount = count(explode(',', $branch)); - foreach(explode(',', $branch) as $index => $branchID) - { - $branchQuery .= "CONCAT(',', branch, ',') LIKE '%,$branchID,%'"; - if($index < $branchCount - 1) $branchQuery .= ' AND '; - } - $branchQuery .= ')'; - } - $planPairs = $this->dao->select("id,title")->from(TABLE_PRODUCTPLAN) ->where('product')->eq($productID) - ->beginIF($branch !== '' and !empty($branchQuery))->andWhere($branchQuery)->fi() ->andWhere('parent')->le(0) ->andWhere('deleted')->eq(0) ->beginIF($exclude)->andWhere('status')->notin($exclude) From 62157bf79e43c1e6a991fdb90b33081f1e24378a Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 6 Dec 2022 10:24:11 +0800 Subject: [PATCH 4/5] * Code for task#78669. --- module/productplan/control.php | 14 ++++++++++---- module/productplan/js/create.js | 6 ++++-- module/productplan/js/edit.js | 6 +++--- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/module/productplan/control.php b/module/productplan/control.php index 8ef3268a79..f2fad8c605 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -1008,20 +1008,26 @@ class productplan extends control /** * AJAX: Get parent branches. * - * @param int $parentID + * @param int $productID + * @param int $parentID + * @param string $currentBranches * @access public * @return void */ - public function ajaxGetParentBranches($productID = 0, $parentID = 0) + public function ajaxGetParentBranches($productID = 0, $parentID = 0, $currentBranches = '') { $branchPairs = $this->loadModel('branch')->getPairs($productID, 'active'); if(!empty($parentID)) { $parentBranches = array(); $parentPlan = $this->productplan->getByID($parentID); - foreach(explode(',', $parentPlan->branch) as $parentBranchID) $parentBranches[$parentBranchID] = $branchPairs[$parentBranchID]; + foreach(explode(',', $parentPlan->branch) as $parentBranchID) + { + $parentBranches[$parentBranchID] = $branchPairs[$parentBranchID]; + if(!empty($currentBranches) and strpos(",$currentBranches,", ",$parentBranchID,") === false) $currentBranches = str_replace(",$parentBranchID,", ',', $currentBranches); + } } - return print(html::select('branch[]', empty($parentID) ? $branchPairs : $parentBranches, '', "class='form-control chosen' multiple required")); + return print(html::select('branch[]', empty($parentID) ? $branchPairs : $parentBranches, trim($currentBranches, ','), "class='form-control chosen' multiple required")); } /** diff --git a/module/productplan/js/create.js b/module/productplan/js/create.js index 6bfe71b4ba..dc43f76277 100644 --- a/module/productplan/js/create.js +++ b/module/productplan/js/create.js @@ -65,12 +65,14 @@ $('#future').on('change', function() $('#parent').change(function() { - var parentID = $(this).val(); - $.post(createLink('productplan', 'ajaxGetParentBranches', "productID=" + productID + "&parentID=" + parentID), function(data) + var parentID = $(this).val(); + var currentBranches = $('#branch').val() ? $('#branch').val().toString() : ''; + $.post(createLink('productplan', 'ajaxGetParentBranches', "productID=" + productID + "&parentID=" + parentID + "¤tBranches=" + currentBranches), function(data) { $('#branch').replaceWith(data); $('#branch_chosen').remove(); $('#branch').chosen(); + $('#branch').change(); }) }) diff --git a/module/productplan/js/edit.js b/module/productplan/js/edit.js index 7e0541f621..9d3733f176 100644 --- a/module/productplan/js/edit.js +++ b/module/productplan/js/edit.js @@ -23,7 +23,6 @@ $('#dataform').on('change', '#branch', function() var result = confirm(conflictStories) ? true : false; if(!result) { - newBranch = oldBranch[planID]; $('#branch').val(oldBranch[planID].split(',')); $('#branch').trigger("chosen:updated"); } @@ -59,8 +58,9 @@ function computeEndDate(delta) $('#parent').change(function() { - var parentID = $(this).val(); - $.post(createLink('productplan', 'ajaxGetParentBranches', "productID=" + productID + "&parentID=" + parentID), function(data) + var parentID = $(this).val(); + var currentBranches = $('#branch').val() ? $('#branch').val().toString() : ''; + $.post(createLink('productplan', 'ajaxGetParentBranches', "productID=" + productID + "&parentID=" + parentID + "¤tBranches=" + currentBranches), function(data) { $('#branch').replaceWith(data); $('#branch_chosen').remove(); From 6f8dd9e186dff47b951a0220ba34ddc59de30954 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 6 Dec 2022 14:27:17 +0800 Subject: [PATCH 5/5] * Code for task#78669. Add branch name in tips. --- module/productplan/control.php | 13 ++++++++++--- module/productplan/lang/de.php | 8 ++++---- module/productplan/lang/en.php | 8 ++++---- module/productplan/lang/fr.php | 8 ++++---- module/productplan/lang/zh-cn.php | 8 ++++---- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/module/productplan/control.php b/module/productplan/control.php index f2fad8c605..3d34f90760 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -960,6 +960,13 @@ class productplan extends control $oldBranch = $plan->branch; $planStories = $this->loadModel('story')->getPlanStories($planID, 'all'); $planBugs = $this->loadModel('bug')->getPlanBugs($planID, 'all'); + $branchPairs = $this->loadModel('branch')->getPairs($plan->product); + + $removeBranches = ''; + foreach(explode(',', $oldBranch) as $oldBranchID) + { + if($oldBranchID and strpos(",$newBranch,", ",$oldBranchID,") === false) $removeBranches .= "{$branchPairs[$oldBranchID]},"; + } $conflictStoryCounts = 0; $conflictBugCounts = 0; @@ -978,15 +985,15 @@ class productplan extends control if($conflictStoryCounts and $conflictBugCounts) { - printf($this->lang->productplan->confirmChangePlan, $conflictStoryCounts, $conflictBugCounts); + printf($this->lang->productplan->confirmChangePlan, trim($removeBranches, ','), $conflictStoryCounts, $conflictBugCounts); } elseif($conflictStoryCounts) { - printf($this->lang->productplan->confirmRemoveStory, $conflictStoryCounts); + printf($this->lang->productplan->confirmRemoveStory, trim($removeBranches, ','), $conflictStoryCounts); } elseif($conflictBugCounts) { - printf($this->lang->productplan->confirmRemoveBug, $conflictBugCounts); + printf($this->lang->productplan->confirmRemoveBug, trim($removeBranches, ','), $conflictBugCounts); } } diff --git a/module/productplan/lang/de.php b/module/productplan/lang/de.php index c402dd43ff..ac56c0aeec 100644 --- a/module/productplan/lang/de.php +++ b/module/productplan/lang/de.php @@ -75,9 +75,9 @@ $lang->productplan->projectNotEmpty = 'Project cannot be empty.'; $lang->productplan->nextStep = "Next step"; $lang->productplan->summary = "Total: %s, Parents: %s, Children: %s,Independent: %s."; $lang->productplan->checkedSummary = "Seleted: %total%, Parents: %parent%, Children: %child%, Independent: %independent%."; -$lang->productplan->confirmChangePlan = "After the branch is unlinked, %s {$lang->SRCommon} and %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; -$lang->productplan->confirmRemoveStory = "After the branch is unlinked, %s {$lang->SRCommon} under the branch will be removed from the plan at the same time, so still want to unassociate?"; -$lang->productplan->confirmRemoveBug = "After the branch is unlinked, %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmChangePlan = "After the branch of『%s』is unlinked, %s {$lang->SRCommon} and %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmRemoveStory = "After the branch of『%s』is unlinked, %s {$lang->SRCommon} under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmRemoveBug = "After the branch of『%s』is unlinked, %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; $lang->productplan->id = 'ID'; $lang->productplan->product = $lang->productCommon; @@ -139,7 +139,7 @@ $lang->productplan->beginGreaterChildTip = "The start date of the parent plan[%s $lang->productplan->endLetterChildTip = "The completion date of the parent plan[%s]: %s, cannot be less than the completion date of the child plan: %s."; $lang->productplan->beginLetterParentTip = "The start date of the child plan[%s]: %s, cannot be less than the start date of the parent plan: %s."; $lang->productplan->endGreaterParentTip = "The completion date of the child plan[%s]: %s, cannot be greater than the completion date of the parent plan: %s."; -$lang->productplan->diffBranchesTip = "The @branch@ %s of parent plan is not linked with the child plan. @branch@'s stories and bugs whill be removed from the plan. Do you want to save?"; +$lang->productplan->diffBranchesTip = "The @branch@『%s』 of parent plan is not linked with the child plan. @branch@'s stories and bugs whill be removed from the plan. Do you want to save?"; $lang->productplan->featureBar['browse']['all'] = 'Alle'; $lang->productplan->featureBar['browse']['undone'] = 'Undone'; diff --git a/module/productplan/lang/en.php b/module/productplan/lang/en.php index 3306bc5bdb..49a6bf5bd1 100644 --- a/module/productplan/lang/en.php +++ b/module/productplan/lang/en.php @@ -75,9 +75,9 @@ $lang->productplan->projectNotEmpty = 'Project cannot be empty.'; $lang->productplan->nextStep = "Next step"; $lang->productplan->summary = "Total: %s, Parents: %s, Children: %s,Independent: %s."; $lang->productplan->checkedSummary = "Seleted: %total%, Parents: %parent%, Children: %child%, Independent: %independent%."; -$lang->productplan->confirmChangePlan = "After the branch is unlinked, %s {$lang->SRCommon} and %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; -$lang->productplan->confirmRemoveStory = "After the branch is unlinked, %s {$lang->SRCommon} under the branch will be removed from the plan at the same time, so still want to unassociate?"; -$lang->productplan->confirmRemoveBug = "After the branch is unlinked, %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmChangePlan = "After the branch of『%s』is unlinked, %s {$lang->SRCommon} and %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmRemoveStory = "After the branch of『%s』is unlinked, %s {$lang->SRCommon} under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmRemoveBug = "After the branch of『%s』is unlinked, %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; $lang->productplan->id = 'ID'; $lang->productplan->product = $lang->productCommon; @@ -139,7 +139,7 @@ $lang->productplan->beginGreaterChildTip = "The start date of the parent plan[%s $lang->productplan->endLetterChildTip = "The completion date of the parent plan[%s]: %s, cannot be less than the completion date of the child plan: %s."; $lang->productplan->beginLetterParentTip = "The start date of the child plan[%s]: %s, cannot be less than the start date of the parent plan: %s."; $lang->productplan->endGreaterParentTip = "The completion date of the child plan[%s]: %s, cannot be greater than the completion date of the parent plan: %s."; -$lang->productplan->diffBranchesTip = "The @branch@ %s of parent plan is not linked with the child plan. @branch@'s stories and bugs whill be removed from the plan. Do you want to save?"; +$lang->productplan->diffBranchesTip = "The @branch@『%s』of parent plan is not linked with the child plan. @branch@'s stories and bugs whill be removed from the plan. Do you want to save?"; $lang->productplan->featureBar['browse']['all'] = 'All'; $lang->productplan->featureBar['browse']['undone'] = 'Undone'; diff --git a/module/productplan/lang/fr.php b/module/productplan/lang/fr.php index 46bfcaf196..5fd88247f3 100644 --- a/module/productplan/lang/fr.php +++ b/module/productplan/lang/fr.php @@ -75,9 +75,9 @@ $lang->productplan->projectNotEmpty = 'Project cannot be empty.'; $lang->productplan->nextStep = "Next step"; $lang->productplan->summary = "Total: %s, Parents: %s, Children: %s,Independent: %s."; $lang->productplan->checkedSummary = "Seleted: %total%, Parents: %parent%, Children: %child%, Independent: %independent%."; -$lang->productplan->confirmChangePlan = "After the branch is unlinked, %s {$lang->SRCommon} and %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; -$lang->productplan->confirmRemoveStory = "After the branch is unlinked, %s {$lang->SRCommon} under the branch will be removed from the plan at the same time, so still want to unassociate?"; -$lang->productplan->confirmRemoveBug = "After the branch is unlinked, %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmChangePlan = "After the branch of『%s』is unlinked, %s {$lang->SRCommon} and %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmRemoveStory = "After the branch of『%s』is unlinked, %s {$lang->SRCommon} under the branch will be removed from the plan at the same time, so still want to unassociate?"; +$lang->productplan->confirmRemoveBug = "After the branch of『%s』is unlinked, %s bugs under the branch will be removed from the plan at the same time, so still want to unassociate?"; $lang->productplan->id = 'ID'; $lang->productplan->product = $lang->productCommon; @@ -139,7 +139,7 @@ $lang->productplan->beginGreaterChildTip = "The start date of the parent plan[%s $lang->productplan->endLetterChildTip = "The completion date of the parent plan[%s]: %s, cannot be less than the completion date of the child plan: %s."; $lang->productplan->beginLetterParentTip = "The start date of the child plan[%s]: %s, cannot be less than the start date of the parent plan: %s."; $lang->productplan->endGreaterParentTip = "The completion date of the child plan[%s]: %s, cannot be greater than the completion date of the parent plan: %s."; -$lang->productplan->diffBranchesTip = "The @branch@ %s of parent plan is not linked with the child plan. @branch@'s stories and bugs whill be removed from the plan. Do you want to save?"; +$lang->productplan->diffBranchesTip = "The @branch@『%s』of parent plan is not linked with the child plan. @branch@'s stories and bugs whill be removed from the plan. Do you want to save?"; $lang->productplan->featureBar['browse']['all'] = 'Tous'; $lang->productplan->featureBar['browse']['undone'] = 'Undone'; diff --git a/module/productplan/lang/zh-cn.php b/module/productplan/lang/zh-cn.php index b1765303ea..f756060d8e 100644 --- a/module/productplan/lang/zh-cn.php +++ b/module/productplan/lang/zh-cn.php @@ -75,9 +75,9 @@ $lang->productplan->projectNotEmpty = '所属项目不能为空。'; $lang->productplan->nextStep = "下一步"; $lang->productplan->summary = "本页共 %s 个计划,父计划 %s,子计划 %s,独立计划 %s。"; $lang->productplan->checkedSummary = "共选中 %total% 个计划,父计划 %parent%,子计划 %child%,独立计划 %independent%。"; -$lang->productplan->confirmChangePlan = "分支解除关联后,分支下的%s个{$lang->SRCommon}和%s个Bug将同步从计划中移除,是否解除?"; -$lang->productplan->confirmRemoveStory = "分支解除关联后,分支下的%s个{$lang->SRCommon}将同步从计划中移除,是否解除?"; -$lang->productplan->confirmRemoveBug = "分支解除关联后,分支下的%s个Bug将同步从计划中移除,是否解除?"; +$lang->productplan->confirmChangePlan = "分支『%s』解除关联后,分支下的%s个{$lang->SRCommon}和%s个Bug将同步从计划中移除,是否解除?"; +$lang->productplan->confirmRemoveStory = "分支『%s』解除关联后,分支下的%s个{$lang->SRCommon}将同步从计划中移除,是否解除?"; +$lang->productplan->confirmRemoveBug = "分支『%s』解除关联后,分支下的%s个Bug将同步从计划中移除,是否解除?"; $lang->productplan->id = '编号'; $lang->productplan->product = $lang->productCommon; @@ -139,7 +139,7 @@ $lang->productplan->beginGreaterChildTip = "父计划[%s]的开始日期:%s, $lang->productplan->endLetterChildTip = "父计划[%s]的完成日期:%s,不能小于子计划的完成日期: %s"; $lang->productplan->beginLetterParentTip = "子计划[%s]的开始日期:%s,不能小于父计划的开始日期: %s"; $lang->productplan->endGreaterParentTip = "子计划[%s]的完成日期:%s,不能大于父计划的完成日期: %s"; -$lang->productplan->diffBranchesTip = "父计划的@branch@ %s 未被子计划关联,对应@branch@的需求和bug将自动从计划中移除,是否保存?"; +$lang->productplan->diffBranchesTip = "父计划的@branch@『%s』未被子计划关联,对应@branch@的需求和bug将自动从计划中移除,是否保存?"; $lang->productplan->featureBar['browse']['all'] = '全部'; $lang->productplan->featureBar['browse']['undone'] = '未完成';