* Batch modify the judgment of the branch to which the bug belongs.

This commit is contained in:
tianshujie
2021-11-18 13:49:04 +08:00
parent 79fa075854
commit 5e473398be
4 changed files with 32 additions and 6 deletions
+28 -3
View File
@@ -1133,10 +1133,35 @@ class bug extends control
{
if($this->post->bugIDList)
{
$bugIDList = $this->post->bugIDList;
$bugIDList = array_unique($bugIDList);
$bugIDList = $this->post->bugIDList;
$bugIDList = array_unique($bugIDList);
$oldBugs = $this->bug->getByList($bugIDList);
$skipBugIDList = '';
unset($_POST['bugIDList']);
$allChanges = $this->bug->batchChangeBranch($bugIDList, $branchID);
/* Remove condition mismatched bugs. */
foreach($bugIDList as $key => $bugID)
{
$oldBug = $oldBugs[$bugID];
if($branchID == $oldBug->branch)
{
unset($bugIDList[$key]);
continue;
}
elseif($branchID != $oldBug->branch and !empty($oldBug->module))
{
$skipBugIDList .= '[' . $bugID . ']';
unset($bugIDList[$key]);
continue;
}
}
if(!empty($skipBugIDList))
{
echo js::alert(sprintf($this->lang->bug->noSwitchBranch, $skipBugIDList));
}
$allChanges = $this->bug->batchChangeBranch($bugIDList, $branchID, $oldBugs);
if(dao::isError()) die(js::error(dao::getError()));
foreach($allChanges as $bugID => $changes)
{
+1
View File
@@ -192,6 +192,7 @@ $lang->bug->skipClose = 'Bug %s is active. You cannot close it.';
$lang->bug->executionAccessDenied = "You access to the {$lang->executionCommon} to which this bug belongs is denied!";
$lang->bug->stepsNotEmpty = "The reproduction step cannot be empty.";
$lang->bug->confirmUnlinkBuild = "Replacing the solution version will disassociate the bug from the old version. Are you sure you want to disassociate the bug from %s?";
$lang->bug->noSwitchBranch = 'The linked module of Bug%s is not in the current branch. It will be omitted.';
/* Template. */
$lang->bug->tplStep = "<p>[Steps]</p><br/>";
+1
View File
@@ -192,6 +192,7 @@ $lang->bug->skipClose = 'Bug %s 不是已解决状态,不能关闭
$lang->bug->executionAccessDenied = "您无权访问该Bug所属的{$lang->executionCommon}!";
$lang->bug->stepsNotEmpty = "重现步骤不能为空。";
$lang->bug->confirmUnlinkBuild = "更换解决版本将取消与旧版本的关联,您确定取消该bug与%s的关联吗?";
$lang->bug->noSwitchBranch = 'Bug%s所属模块不在当前分支下,将自动忽略。';
/* 模板。*/
$lang->bug->tplStep = "<p>[步骤]</p><br/>";
+2 -3
View File
@@ -1043,18 +1043,17 @@ class bugModel extends model
*
* @param array $bugIDList
* @param int $branchID
* @param array $oldBugs
* @access public
* @return array
*/
public function batchChangeBranch($bugIDList, $branchID)
public function batchChangeBranch($bugIDList, $branchID, $oldBugs)
{
$now = helper::now();
$allChanges = array();
$oldBugs = $this->getByList($bugIDList);
foreach($bugIDList as $bugID)
{
$oldBug = $oldBugs[$bugID];
if($branchID == $oldBug->branch) continue;
$bug = new stdclass();
$bug->lastEditedBy = $this->app->user->account;