* task #74142 code meeting fix

This commit is contained in:
lanzongjun
2022-11-02 17:06:37 +08:00
parent e523f6390f
commit 73cf79584d
9 changed files with 144 additions and 149 deletions
+2 -19
View File
@@ -150,22 +150,6 @@ class story extends control
return $this->send($response);
}
/* bind siblings story id */
$storyIDs = $storyResult['ids'];
if(count($storyIDs) > 1)
{
foreach($storyIDs as $siblingsStoryID)
{
$siblingsArr = array();
foreach($storyIDs as $idItem)
{
if($idItem != $siblingsStoryID) $siblingsArr[] = $idItem;
$siblings = ',' . implode(',', $siblingsArr) . ',';
$this->dao->update(TABLE_STORY)->set('siblings')->eq($siblings)->where('id')->eq($siblingsStoryID)->exec();
}
}
}
$action = $bugID == 0 ? 'Opened' : 'Frombug';
$extra = $bugID == 0 ? '' : $bugID;
/* Record related action, for example FromFeedback. */
@@ -175,9 +159,8 @@ class story extends control
$extra = $fromObjectID;
}
/* Create actions. */
foreach($storyIDs as $idItem) $actionID = $this->action->create('task', $idItem, $action, '', $extra);
$storyIds = $storyResult['ids'];
foreach($storyIds as $idItem) $actionID = $this->action->create('story', $idItem, $action, '', $extra);
if($objectID != 0)
{
+109
View File
@@ -147,3 +147,112 @@ $(window).unload(function(){
{
$(obj).closest('tr').remove();
}
/**
* Load branch for multi branch or multi platform.
*
* @param int $branch
* @param int $branchIndex
* @access public
* @return void
*/
function loadBranchRelation(branch, branchIndex)
{
var productID = $('#product').val();
if(typeof(branch) == 'undefined') branch = 0;
loadModuleForSiblings(productID, branch, branchIndex)
loadPlanForSiblings(productID, branch, branchIndex)
}
/**
* Load branch for siblings.
*
* @paran int $procutID
* @param int $branch
* @param int $branchIndex
* @access public
* @return void
*/
function loadBranchForSiblings(productID, branch, branchIndex)
{
var isSiblings = storyType == 'story' ? 'yes' : 'no';
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + "&oldBranch=0&param=active&projectID=" + executionID + "&withMainBranch=1&isSiblings=" + isSiblings + "&fieldID=" + branchIndex), function(data)
{
if(data)
{
/* reload branch */
$('#branches' + branchIndex).replaceWith(data);
$('#branches' + branchIndex + "_chosen").remove();
$('#branches' + branchIndex).next('.picker').remove();
$('#branches' + branchIndex).chosen();
}
})
}
/**
* Load module for siblings.
*
* @paran int $procutID
* @param int $branch
* @param int $branchIndex
* @access public
* @return void
*/
function loadModuleForSiblings(productID, branch, branchIndex)
{
/* Load module */
var currentModule = 0;
var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + branchIndex + '&needManage=true&extra=&currentModuleID=' + currentModule);
if(branchIndex > 0)
{
var $moduleIDBox = $('.addBranchesBox'+ branchIndex +' #moduleIdBox');
}
else
{
var $moduleIDBox = $('.switchBranch #moduleIdBox');
}
$moduleIDBox.load(moduleLink, function()
{
$moduleIDBox.find('#modules' + branchIndex).chosen();
if(branchIndex == 0)
{
$('.switchBranch #moduleIdBox span:first-child').remove()
}
$moduleIDBox.prepend("<span class='input-group-addon fix-border'>" + storyModule + "</span>" );
$moduleIDBox.fixInputGroup();
});
}
/**
* Load plan for siblings.
*
* @paran int $procutID
* @param int $branch
* @param int $branchIndex
* @access public
* @return void
*/
function loadPlanForSiblings(productID, branch, branchIndex)
{
/* Load plan */
if(typeof(branch) == 'undefined') branch = 0;
if(!branch) branch = 0;
var expired = config.currentMethod == 'create' ? 'unexpired' : '';
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=' + branchIndex + '&needCreate=true&expired='+ expired +'&param=skipParent,' + config.currentMethod);
if(branchIndex > 0)
{
var $planIdBox = $('.addBranchesBox'+ branchIndex +' #planIdBox');
}
else
{
var $planIdBox = $('#planIdBox');
}
$planIdBox.load(planLink, function()
{
$planIdBox.find('#plans' + branchIndex).chosen();
$planIdBox.prepend("<span class='input-group-addon fix-border'>" + storyPlan + "</span>");
$planIdBox.fixInputGroup();
});
}
+2 -2
View File
@@ -491,6 +491,6 @@ $lang->requirement->batchChangeModule = "Batch Change Modules";
$lang->requirement->submitReview = $lang->story->submitReview;
$lang->requirement->linkStory = 'Link Story';
$lang->story->addBranch = 'Add branch';
$lang->story->deleteBranch = 'Delete branch';
$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';
+2 -2
View File
@@ -491,6 +491,6 @@ $lang->requirement->batchChangeModule = "Batch Change Modules";
$lang->requirement->submitReview = $lang->story->submitReview;
$lang->requirement->linkStory = 'Link Story';
$lang->story->addBranch = 'Add branch';
$lang->story->deleteBranch = 'Delete branch';
$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';
+2 -2
View File
@@ -491,6 +491,6 @@ $lang->requirement->batchChangeModule = "Batch Change Modules";
$lang->requirement->submitReview = $lang->story->submitReview;
$lang->requirement->linkStory = 'Lier Story';
$lang->story->addBranch = 'Add branch';
$lang->story->deleteBranch = 'Delete branch';
$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';
+2 -2
View File
@@ -491,6 +491,6 @@ $lang->requirement->batchChangeModule = "批量修改模块";
$lang->requirement->submitReview = $lang->story->submitReview;
$lang->requirement->linkStory = "关联{$lang->SRCommon}";
$lang->story->addBranch = '添加分支';
$lang->story->deleteBranch = '删除分支';
$lang->story->addBranch = '添加%s';
$lang->story->deleteBranch = '删除%s';
$lang->story->notice->branch = '每个分支会建立一个需求,需求间互为孪生关系,孪生需求间除产品、分支、模块、计划、阶段字段外均同步,后期您可以手动解除孪生关系';
+21 -5
View File
@@ -238,16 +238,16 @@ class storyModel extends model
$product = $this->loadModel('product')->getById($story->product);
if($product->type == 'normal' or $story->type == 'requirement')
{
$this->post->branches = array(isset($story->branch) ? $story->branch : 0);
$this->post->modules = array(isset($story->module) ? $story->module : 0);
$this->post->plans = array(isset($story->plan) ? $story->plan : 0);
$this->post->branches = isset($story->branch) ? array($story->branch) : array(0 => 0);
$this->post->modules = isset($story->module) ? array($story->module) : array(0 => 0);
$this->post->plans = isset($story->plan) ? array($story->plan) : array(0 => 0);
}
$storyIds = array();
$mainStoryID = 0;
foreach($this->post->branches as $key => $postBranch)
foreach($this->post->branches as $key => $branch)
{
$story->branch = $postBranch;
$story->branch = $branch;
$story->module = $this->post->modules[$key];
$story->plan = $this->post->plans[$key];
@@ -412,6 +412,22 @@ class storyModel extends model
if(empty($mainStoryID)) $mainStoryID = $storyID;
}
}
/* bind siblings story id */
if(count($storyIds) > 1)
{
foreach($storyIds as $siblingsStoryID)
{
$siblingsArr = array();
foreach($storyIds as $idItem)
{
if($idItem != $siblingsStoryID) $siblingsArr[] = $idItem;
$siblings = ',' . implode(',', $siblingsArr) . ',';
$this->dao->update(TABLE_STORY)->set('siblings')->eq($siblings)->where('id')->eq($siblingsStoryID)->exec();
}
}
}
return array('status' => 'created', 'id' => $mainStoryID, 'ids' => $storyIds);
}
+3 -3
View File
@@ -108,7 +108,7 @@ foreach(explode(',', $config->story->create->requiredFields) as $field)
</td>
<td class="table-col c-actions text-left w-60px">
<div>
<a href='javascript:;' onclick='addBranchesBox(this)' class='btn btn-link' title='<?php echo $lang->story->addBranch;?>'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='addBranchesBox(this)' class='btn btn-link' title='<?php echo sprintf($lang->story->addBranch, $lang->product->branchName[$product->type])?>'><i class='icon-plus'></i></a>
</div>
</td>
</tr>
@@ -373,8 +373,8 @@ foreach(explode(',', $config->story->create->requiredFields) as $field)
</td>
<td class="table-col text-left w-60px c-actions">
<div>
<a href='javascript:;' onclick='addBranchesBox(this)' class='btn btn-link' title='<?php echo $lang->story->addBranch;?>'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='deleteBranchesBox(this)' class='btn btn-link' title='<?php echo $lang->story->deleteBranch;?>'><i class='icon icon-close'></i></a>
<a href='javascript:;' onclick='addBranchesBox(this)' class='btn btn-link' title='<?php echo sprintf($lang->story->addBranch, $lang->product->branchName[$product->type])?>'><i class='icon-plus'></i></a>
<a href='javascript:;' onclick='deleteBranchesBox(this)' class='btn btn-link' title='<?php echo sprintf($lang->story->deleteBranch, $lang->product->branchName[$product->type])?>'><i class='icon icon-close'></i></a>
</div>
</td>
</tr>
+1 -114
View File
@@ -68,118 +68,6 @@ function loadBranch()
loadProductPlans(productID, branch);
}
/**
* Load branch for multi branch or multi platform.
*
* @param int $branch
* @param int $branchIndex
* @access public
* @return void
*/
function loadBranchRelation(branch, branchIndex)
{
var productID = $('#product').val();
if(typeof(branch) == 'undefined') branch = 0;
loadModuleForSiblings(productID, branch, branchIndex)
loadPlanForSiblings(productID, branch, branchIndex)
}
/**
* Load branch for siblings.
*
* @paran int $procutID
* @param int $branch
* @param int $branchIndex
* @access public
* @return void
*/
function loadBranchForSiblings(productID, branch, branchIndex)
{
var param = 'all';
if(page == 'create') param = 'active';
var isSiblings = storyType == 'story' ? 'yes' : 'no';
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID + "&oldBranch=0&param=" + param + "&projectID=" + executionID + "&withMainBranch=1&isSiblings=" + isSiblings + "&fieldID=" + branchIndex), function(data)
{
if(data)
{
/* reload branch */
$('#branches' + branchIndex).replaceWith(data);
$('#branches' + branchIndex + "_chosen").remove();
$('#branches' + branchIndex).next('.picker').remove();
$('#branches' + branchIndex).chosen();
}
})
}
/**
* Load module for siblings.
*
* @paran int $procutID
* @param int $branch
* @param int $branchIndex
* @access public
* @return void
*/
function loadModuleForSiblings(productID, branch, branchIndex)
{
/* Load module */
var currentModule = 0;
var moduleLink = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=story&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=' + branchIndex + '&needManage=true&extra=&currentModuleID=' + currentModule);
if(branchIndex > 0)
{
var $moduleIDBox = $('.addBranchesBox'+ branchIndex +' #moduleIdBox');
}
else
{
var $moduleIDBox = $('.switchBranch #moduleIdBox');
}
$moduleIDBox.load(moduleLink, function()
{
$moduleIDBox.find('#modules' + branchIndex).chosen();
if(branchIndex == 0)
{
$('.switchBranch #moduleIdBox span:first-child').remove()
}
$moduleIDBox.prepend("<span class='input-group-addon fix-border'>" + storyModule + "</span>" );
$moduleIDBox.fixInputGroup();
});
}
/**
* Load plan for siblings.
*
* @paran int $procutID
* @param int $branch
* @param int $branchIndex
* @access public
* @return void
*/
function loadPlanForSiblings(productID, branch, branchIndex)
{
/* Load plan */
if(typeof(branch) == 'undefined') branch = 0;
if(!branch) branch = 0;
var expired = config.currentMethod == 'create' ? 'unexpired' : '';
planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=' + branchIndex + '&needCreate=true&expired='+ expired +'&param=skipParent,' + config.currentMethod);
if(branchIndex > 0)
{
var $planIdBox = $('.addBranchesBox'+ branchIndex +' #planIdBox');
}
else
{
var $planIdBox = $('#planIdBox');
}
$planIdBox.load(planLink, function()
{
$planIdBox.find('#plans' + branchIndex).chosen();
$planIdBox.prepend("<span class='input-group-addon fix-border'>" + storyPlan + "</span>");
$planIdBox.fixInputGroup();
});
}
/**
* Load branches when change product.
*
@@ -212,7 +100,6 @@ function loadProductBranches(productID)
$.cookie('branchSourceName', data.branchSourceName)
}, 'json')
/* reload branch */
$('#branches0').replaceWith(data);
$('#branches0' + "_chosen").remove();
@@ -348,4 +235,4 @@ function loadProductReviewers(productID)
}
});
}
</script>
</script>