diff --git a/module/productplan/control.php b/module/productplan/control.php
index f4419871cc..ce80f5e403 100644
--- a/module/productplan/control.php
+++ b/module/productplan/control.php
@@ -673,7 +673,7 @@ class productplan extends control
$this->config->product->search['style'] = 'simple';
$this->config->product->search['params']['product']['values'] = $products + array('all' => $this->lang->product->allProductsOfProject);
$this->config->product->search['params']['plan']['values'] = $this->productplan->getPairsForStory($plan->product, $plan->branch, 'skipParent|withMainPlan');
- $this->config->product->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($plan->product, 'story', 0, $plan->branch);
+ $this->config->product->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($plan->product, 'story', 0, 'all');
$storyStatusList = $this->lang->story->statusList;
unset($storyStatusList['closed']);
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $storyStatusList);
@@ -685,8 +685,12 @@ class productplan extends control
else
{
$this->config->product->search['fields']['branch'] = $this->lang->product->branch;
- $branchName = $this->loadModel('branch')->getById($plan->branch);
- $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $plan->branch => $branchName);
+ $branchPairs = $this->loadModel('branch')->getPairs($plan->product);
+ foreach($branchPairs as $branchID => $branchName)
+ {
+ if(strpos(",$plan->branch,", ",$branchID,") === false) unset($branchPairs[$branchID]);
+ }
+ $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main) + $branchPairs;
$this->config->product->search['params']['branch']['values'] = $branches;
}
$this->loadModel('search')->setSearchParams($this->config->product->search);
@@ -809,7 +813,7 @@ class productplan extends control
$this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($plan->product, $plan->branch);
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getBuildPairs($productID, $branch = 'all', $params = '');
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getBuildPairs($productID, $branch = 'all', $params = '');
- $this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($plan->product, 'bug', 0, $plan->branch);
+ $this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($plan->product, 'bug', 0, 'all');
$this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairsByProduct($productID, $plan->branch);
unset($this->config->bug->search['fields']['product']);
@@ -922,29 +926,49 @@ class productplan extends control
}
/**
- * AJAX: Get conflict story.
+ * AJAX: Get conflict story and bug.
*
* @param int $planID
* @param int $branch
* @access public
* @return void
*/
- public function ajaxGetConflictStory($planID, $newBranch)
+ public function ajaxGetConflict($planID, $newBranch)
{
- $conflictStoryIdList = '';
- if(empty($newBranch)) return $conflictStoryIdList;
+ if(empty($newBranch)) return;
$plan = $this->productplan->getByID($planID);
$oldBranch = $plan->branch;
$planStories = $this->loadModel('story')->getPlanStories($planID, 'all');
+ $planBugs = $this->loadModel('bug')->getPlanBugs($planID, 'all');
+
+ $conflictStoryCounts = 0;
+ $conflictBugCounts = 0;
if($oldBranch)
{
foreach($planStories as $storyID => $story)
{
- if($story->branch and strpos(",$newBranch,", ",$story->branch,") === false) $conflictStoryIdList .= '[' . $storyID . ']';
+ if($story->branch and strpos(",$newBranch,", ",$story->branch,") === false) $conflictStoryCounts ++;
+ }
+
+ foreach($planBugs as $bugID => $bug)
+ {
+ if($bug->branch and strpos(",$newBranch,", ",$bug->branch,") === false) $conflictBugCounts ++;
}
}
- if($conflictStoryIdList != '') printf($this->lang->story->confirmChangePlan, $conflictStoryIdList);
+
+ if($conflictStoryCounts and $conflictBugCounts)
+ {
+ printf($this->lang->productplan->confirmChangePlan, $conflictStoryCounts, $conflictBugCounts);
+ }
+ elseif($conflictStoryCounts)
+ {
+ printf($this->lang->productplan->confirmRemoveStory, $conflictStoryCounts);
+ }
+ elseif($conflictBugCounts)
+ {
+ printf($this->lang->productplan->confirmRemoveBug, $conflictBugCounts);
+ }
}
/**
diff --git a/module/productplan/js/batchedit.js b/module/productplan/js/batchedit.js
index 2e06088dcb..9384b7631a 100644
--- a/module/productplan/js/batchedit.js
+++ b/module/productplan/js/batchedit.js
@@ -30,11 +30,11 @@ function changeDate(planID)
function getConflictStories(planID)
{
var newBranch = $('#branch' + planID).val() ? $('#branch' + planID).val().toString() : '';
- $.get(createLink('productplan', 'ajaxGetConflictStory', 'planID=' + planID + '&newBranch=' + newBranch), function(conflictStories)
+ $.get(createLink('productplan', 'ajaxGetConflict', 'planID=' + planID + '&newBranch=' + newBranch), function(conflictStories)
{
if(conflictStories != '' && !confirm(conflictStories))
{
- $('#branch' + planID).val(oldBranch[planID]);
+ $('#branch' + planID).val(oldBranch[planID].split(','));
$('#branch' + planID).trigger("chosen:updated");
}
});
diff --git a/module/productplan/js/edit.js b/module/productplan/js/edit.js
index 0de68fe3d0..14108a29c7 100644
--- a/module/productplan/js/edit.js
+++ b/module/productplan/js/edit.js
@@ -23,7 +23,7 @@ function convertStringToDate(dateString)
function getConflictStories(planID)
{
var newBranch = $('#branch').val() ? $('#branch').val().toString() : '';
- $.get(createLink('productplan', 'ajaxGetConflictStory', 'planID=' + planID + '&newBranch=' + newBranch), function(conflictStories)
+ $.get(createLink('productplan', 'ajaxGetConflict', 'planID=' + planID + '&newBranch=' + newBranch), function(conflictStories)
{
if(conflictStories != '')
{
diff --git a/module/productplan/lang/de.php b/module/productplan/lang/de.php
index 0776e1a3be..7a1550c3fd 100644
--- a/module/productplan/lang/de.php
+++ b/module/productplan/lang/de.php
@@ -75,6 +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->id = 'ID';
$lang->productplan->product = $lang->productCommon;
diff --git a/module/productplan/lang/en.php b/module/productplan/lang/en.php
index 41b5fe348c..b87926374b 100644
--- a/module/productplan/lang/en.php
+++ b/module/productplan/lang/en.php
@@ -75,6 +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->id = 'ID';
$lang->productplan->product = $lang->productCommon;
diff --git a/module/productplan/lang/fr.php b/module/productplan/lang/fr.php
index dc5390ac80..2cc9a36ff8 100644
--- a/module/productplan/lang/fr.php
+++ b/module/productplan/lang/fr.php
@@ -75,6 +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->id = 'ID';
$lang->productplan->product = $lang->productCommon;
diff --git a/module/productplan/lang/zh-cn.php b/module/productplan/lang/zh-cn.php
index 119714e9de..42edec06be 100644
--- a/module/productplan/lang/zh-cn.php
+++ b/module/productplan/lang/zh-cn.php
@@ -75,6 +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->id = '编号';
$lang->productplan->product = $lang->productCommon;