* Finish task #77795.

This commit is contained in:
mayue
2022-11-30 17:22:39 +08:00
parent 9952631059
commit fe91c3e210
7 changed files with 49 additions and 13 deletions
+34 -10
View File
@@ -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);
}
}
/**
+2 -2
View File
@@ -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");
}
});
+1 -1
View File
@@ -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 != '')
{
+3
View File
@@ -75,6 +75,9 @@ $lang->productplan->projectNotEmpty = 'Project cannot be empty.';
$lang->productplan->nextStep = "Next step";
$lang->productplan->summary = "Total: <strong>%s</strong>, Parents: <strong>%s</strong>, Children: <strong>%s</strong>,Independent: <strong>%s</strong>.";
$lang->productplan->checkedSummary = "Seleted: <strong>%total%</strong>, Parents: <strong>%parent%</strong>, Children: <strong>%child%</strong>, Independent: <strong>%independent%</strong>.";
$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;
+3
View File
@@ -75,6 +75,9 @@ $lang->productplan->projectNotEmpty = 'Project cannot be empty.';
$lang->productplan->nextStep = "Next step";
$lang->productplan->summary = "Total: <strong>%s</strong>, Parents: <strong>%s</strong>, Children: <strong>%s</strong>,Independent: <strong>%s</strong>.";
$lang->productplan->checkedSummary = "Seleted: <strong>%total%</strong>, Parents: <strong>%parent%</strong>, Children: <strong>%child%</strong>, Independent: <strong>%independent%</strong>.";
$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;
+3
View File
@@ -75,6 +75,9 @@ $lang->productplan->projectNotEmpty = 'Project cannot be empty.';
$lang->productplan->nextStep = "Next step";
$lang->productplan->summary = "Total: <strong>%s</strong>, Parents: <strong>%s</strong>, Children: <strong>%s</strong>,Independent: <strong>%s</strong>.";
$lang->productplan->checkedSummary = "Seleted: <strong>%total%</strong>, Parents: <strong>%parent%</strong>, Children: <strong>%child%</strong>, Independent: <strong>%independent%</strong>.";
$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;
+3
View File
@@ -75,6 +75,9 @@ $lang->productplan->projectNotEmpty = '所属项目不能为空。';
$lang->productplan->nextStep = "下一步";
$lang->productplan->summary = "本页共 <strong>%s</strong> 个计划,父计划 <strong>%s</strong>,子计划 <strong>%s</strong>,独立计划 <strong>%s</strong>。";
$lang->productplan->checkedSummary = "共选中 <strong>%total%</strong> 个计划,父计划 <strong>%parent%</strong>,子计划 <strong>%child%</strong>,独立计划 <strong>%independent%</strong>。";
$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;