* Rename linkBug to relatedBug.

This commit is contained in:
daitingting
2023-05-31 03:10:05 +00:00
parent 4242e42433
commit f1529456dd
17 changed files with 72 additions and 70 deletions
+2
View File
@@ -24,3 +24,5 @@ ALTER TABLE `zt_project` ADD `stageBy` enum('project', 'product') NOT NULL DEFAU
UPDATE `zt_project` SET `stageBy` = 'project' WHERE `division` = '0';
UPDATE `zt_project` SET `stageBy` = 'product' WHERE `division` = '1';
ALTER TABLE `zt_project` DROP `division`;
ALTER TABLE `zt_bug` CHANGE `linkBug` `relatedBug` varchar(255) NOT NULL DEFAULT '';
+1 -1
View File
@@ -296,7 +296,7 @@ CREATE TABLE IF NOT EXISTS `zt_bug` (
`closedBy` varchar(30) NOT NULL DEFAULT '',
`closedDate` datetime NULL,
`duplicateBug` mediumint(8) unsigned NOT NULL DEFAULT '0',
`linkBug` varchar(255) NOT NULL DEFAULT '',
`relatedBug` varchar(255) NOT NULL DEFAULT '',
`case` mediumint(8) unsigned NOT NULL DEFAULT '0',
`caseVersion` smallint(6) NOT NULL DEFAULT '1',
`feedback` mediumint(8) unsigned NOT NULL DEFAULT '0',
+2 -2
View File
@@ -25,7 +25,7 @@ $config->bug->list->allFields = 'id, module, execution, story, task,
assignedTo, assignedDate,
resolvedBy, resolution, resolvedBuild, resolvedDate,
closedBy, closedDate,
duplicateBug, linkBug,
duplicateBug, relatedBug,
case,
lastEditedBy,
lastEditedDate';
@@ -39,7 +39,7 @@ $config->bug->exportFields = 'id, product, branch, module, project, execution, s
assignedTo, assignedDate,
resolvedBy, resolution, resolvedBuild, resolvedDate,
closedBy, closedDate,
duplicateBug, linkBug,
duplicateBug, relatedBug,
case,
lastEditedBy,
lastEditedDate, files ,feedbackBy, notifyEmail';
+1 -1
View File
@@ -66,7 +66,7 @@ $config->bug->form->edit['notifyEmail'] = array('required' => false, 'type' =
$config->bug->form->edit['uid'] = array('required' => false, 'type' => 'string', 'default' => '');
$config->bug->form->edit['os'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
$config->bug->form->edit['browser'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
$config->bug->form->edit['linkBug'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
$config->bug->form->edit['relatedBug'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
$config->bug->form->edit['mailto'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
$config->bug->form->edit['deadline'] = array('required' => false, 'type' => 'date', 'default' => null);
$config->bug->form->edit['resolvedDate'] = array('required' => false, 'type' => 'date', 'default' => null);
+22 -22
View File
@@ -202,7 +202,7 @@ class bugModel extends model
if($bug->project) $bug->projectName = $this->bugTao->getNameFromTable($bug->project, TABLE_PROJECT, 'name');
if($bug->duplicateBug) $bug->duplicateBugTitle = $this->bugTao->getNameFromTable($bug->duplicateBug, TABLE_BUG, 'title');
if($bug->case) $bug->caseTitle = $this->bugTao->getNameFromTable($bug->case, TABLE_CASE, 'title');
if($bug->linkBug) $bug->linkBugTitles = $this->bugTao->getBugPairsByList($bug->linkBug);
if($bug->relatedBug) $bug->relatedBugTitles = $this->bugTao->getBugPairsByList($bug->relatedBug);
if($bug->toStory) $bug->toStoryTitle = $this->bugTao->getNameFromTable($bug->toStory, TABLE_STORY, 'title');
if($bug->toTask) $bug->toTaskTitle = $this->bugTao->getNameFromTable($bug->toTask, TABLE_TASK, 'name');
@@ -737,7 +737,7 @@ class bugModel extends model
{
$bug = $this->getByID($bugID);
$excludeBugs .= ",{$bug->id},{$bug->linkBug}";
$excludeBugs .= ",{$bug->id},{$bug->relatedBug}";
if($bySearch) return $this->bugTao->getBySearch((array)$bug->product, 'all', 0, $queryID, $excludeBugs, 'id desc', $pager);
@@ -1906,39 +1906,39 @@ class bugModel extends model
/**
* 更新相关 bug。
* Update the linked bug.
* Update the related bug.
*
* @param int $bugID
* @param string $linkBug
* @param string $oldLinkBug
* @access protected
* @param int $bugID
* @param string $relatedBug
* @param string $oldRelatedBug
* @access public
* @return bool
*/
protected function updateLinkBug(int $bugID, string $linkBug, string $oldLinkBug): bool
public function updateRelatedBug(int $bugID, string $relatedBug, string $oldRelatedBug): bool
{
$linkBugs = explode(',', $linkBug);
$oldLinkBugs = explode(',', $oldLinkBug);
$addedLinkBugs = array_diff($linkBugs, $oldLinkBugs);
$removedLinkBugs = array_diff($oldLinkBugs, $linkBugs);
$changedLinkBugs = array_merge($addedLinkBugs, $removedLinkBugs);
$changedLinkBugs = $this->dao->select('id, linkbug')->from(TABLE_BUG)->where('id')->in(array_filter($changedLinkBugs))->fetchPairs();
$relatedBugs = explode(',', $relatedBug);
$oldRelatedBugs = explode(',', $oldRelatedBug);
$addedRelatedBugs = array_diff($relatedBugs, $oldRelatedBugs);
$removedRelatedBugs = array_diff($oldRelatedBugs, $relatedBugs);
$changedRelatedBugs = array_merge($addedRelatedBugs, $removedRelatedBugs);
$changedRelatedBugs = $this->dao->select('id, relatedBug')->from(TABLE_BUG)->where('id')->in(array_filter($changedRelatedBugs))->fetchPairs();
foreach($changedLinkBugs as $changedBugID => $linkBugs)
foreach($changedRelatedBugs as $changedBugID => $relatedBugs)
{
if(in_array($changedBugID, $addedLinkBugs))
if(in_array($changedBugID, $addedRelatedBugs))
{
$linkBugs = explode(',', $linkBugs);
if(!empty($linkBugs) && !in_array($bugID, $linkBugs)) $linkBugs[] = $bugID;
$relatedBugs = explode(',', $relatedBugs);
if(!empty($relatedBugs) && !in_array($bugID, $relatedBugs)) $relatedBugs[] = $bugID;
}
else
{
$linkBugs = explode(',', $linkBugs);
unset($linkBugs[array_search($bugID, $linkBugs)]);
$relatedBugs = explode(',', $relatedBugs);
unset($relatedBugs[array_search($bugID, $relatedBugs)]);
}
$currentLinkBug = implode(',', array_filter($linkBugs));
$currentRelatedBug = implode(',', array_filter($relatedBugs));
$this->dao->update(TABLE_BUG)->set('linkBug')->eq($currentLinkBug)->where('id')->eq($changedBugID)->exec();
$this->dao->update(TABLE_BUG)->set('relatedBug')->eq($currentRelatedBug)->where('id')->eq($changedBugID)->exec();
}
return !dao::isError();
+12 -12
View File
@@ -2033,29 +2033,29 @@ class bugTest
* The test for updatelinkbug function.
*
* @param string $bugID
* @param string $linkBug
* @param string $oldLinkBug
* @param string $relatedBug
* @param string $oldRelatedBug
* @access public
* @return array
*/
public function updateLinkBugTest($bugID, $linkBug, $oldLinkBug)
public function updateRelatedBugTest($bugID, $relatedBug, $oldRelatedBug)
{
$this->objectModel->updateLinkBug($bugID, $linkBug, $oldLinkBug);
$this->objectModel->updateRelatedBug($bugID, $relatedBug, $oldRelatedBug);
$linkBugs = explode(',', $linkBug);
$oldLinkBugs = explode(',', $oldLinkBug);
$addedLinkBugs = array_diff($linkBugs, $oldLinkBugs);
$removedLinkBugs = array_diff($oldLinkBugs, $linkBugs);
$allRelatedLinkBugs = array_merge($addedLinkBugs, $removedLinkBugs, array($bugID));
$relatedBugs = explode(',', $relatedBug);
$oldRelatedBugs = explode(',', $oldRelatedBug);
$addedRelatedBugs = array_diff($relatedBugs, $oldRelatedBugs);
$removedRelatedBugs = array_diff($oldRelatedBugs, $relatedBugs);
$allRelatedRelatedBugs = array_merge($addedRelatedBugs, $removedRelatedBugs, array($bugID));
global $tester;
$linkBugPairs = $tester->dao->select('id, linkBug')->from(TABLE_BUG)
->where('id')->in(array_filter($allRelatedLinkBugs))
$relatedBugPairs = $tester->dao->select('id, relatedBug')->from(TABLE_BUG)
->where('id')->in(array_filter($allRelatedRelatedBugs))
->andWhere('deleted')->eq('0')
->fetchPairs();
if(dao::isError()) return dao::getError();
return $linkBugPairs;
return $relatedBugPairs;
}
/**
@@ -24,7 +24,7 @@ function initData()
/**
title=bugModel->updateLinkBug();
title=bugModel->updateRelatedBug();
timeout=0
cid=1
@@ -45,7 +45,7 @@ initData();
$bugIDList = array(1, 2, 3);
$bug = new bugTest();
r($bug->updateLinkBugTest($bugIDList[0], '2', '')) && p('2', ';') && e('1'); //测试关联bug2的关联bug同步更新为1
r($bug->updateLinkBugTest($bugIDList[0], '3', '2')) && p('2;3', ';') && e('~~;1'); //测试关联bug2的关联bug同步更新为空,bug3的关联bug为1
r($bug->updateLinkBugTest($bugIDList[0], '2,3', '3')) && p('2') && e('1'); //测试关联bug2的关联bug同步更新为1
r($bug->updateLinkBugTest($bugIDList[1], '1,3', '1')) && p('3', ';') && e('1,2'); //测试关联bug3的关联bug同步更新为1,2
r($bug->updateRelatedBugTest($bugIDList[0], '2', '')) && p('2', ';') && e('1'); //测试关联bug2的关联bug同步更新为1
r($bug->updateRelatedBugTest($bugIDList[0], '3', '2')) && p('2;3', ';') && e('~~;1'); //测试关联bug2的关联bug同步更新为空,bug3的关联bug为1
r($bug->updateRelatedBugTest($bugIDList[0], '2,3', '3')) && p('2') && e('1'); //测试关联bug2的关联bug同步更新为1
r($bug->updateRelatedBugTest($bugIDList[1], '1,3', '1')) && p('3', ';') && e('1,2'); //测试关联bug3的关联bug同步更新为1,2
+2 -2
View File
@@ -410,14 +410,14 @@ panel
(
set::multiple(true),
set::name('resolvedBuild[]'),
set::items($bug->linkBugTitles)
set::items($bug->relatedBugTitles)
),
span
(
set('class', 'input-group-addon'),
a
(
set('id', 'linkBug'),
set('id', 'relatedBug'),
set('href', 'javascript:;'),
$lang->bug->linkBugs
)
+7 -7
View File
@@ -68,16 +68,16 @@ if(!empty($bug->mailto))
}
}
$linkBugs = array();
if(!empty($bug->linkBugTitles))
$relatedBugs = array();
if(!empty($bug->relatedBugTitles))
{
foreach($bug->linkBugTitles as $linkBugID => $linkBugTitle)
foreach($bug->relatedBugTitles as $relatedBugID => $relatedBugTitle)
{
$linkBugs[] = a
$relatedBugs[] = a
(
set('href', $this->createLink('bug', 'view', "bugID=$linkBugID")),
set('href', $this->createLink('bug', 'view', "bugID=$relatedBugID")),
set('data-toggle', 'modal'),
"#$linkBugID $linkBugTitle"
"#$relatedBugID $relatedBugTitle"
);
}
}
@@ -174,7 +174,7 @@ $toStoryLink = $bug->toStory && $canViewStory ? $this->createLink('story', '
$toTaskLink = $bug->toTask && $canViewTask ? $this->createLink('task', 'view', "taskID=$bug->toTask") : '';
$legendMisc = array();
$legendMisc['linkBug'] = array('name' => $lang->bug->linkBug, 'text' => $linkBugs);
$legendMisc['relatedBug'] = array('name' => $lang->bug->relatedBug, 'text' => $relatedBugs);
$legendMisc['fromCase'] = array('name' => $lang->bug->fromCase, 'text' => $fromCaseName, 'href' => $fromCaseLink, 'attr' => array('data-toggle' => 'modal'));
$legendMisc['toCase'] = array('name' => $lang->bug->toCase, 'text' => $bug->toCases);
$legendMisc['toStory'] = array('name' => $lang->bug->toStory, 'text' => $toStoryName, 'href' => $toStoryLink, 'attr' => array('data-toggle' => 'modal'));
+5 -5
View File
@@ -291,18 +291,18 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
<th class='thWidth'><?php echo $lang->bug->relatedBug;?></th>
<td><?php if(common::hasPriv('bug', 'linkBugs')) echo html::a('#', $lang->bug->linkBugs, '', "class='text-primary' id='linkBugsLink'");?></td>
</tr>
<tr <?php if(!isset($bug->linkBugTitles)) echo 'class="hidden"';?>>
<tr <?php if(!isset($bug->relatedBugTitles)) echo 'class="hidden"';?>>
<th></th>
<td>
<ul class='list-unstyled'>
<?php
if(isset($bug->linkBugTitles))
if(isset($bug->relatedBugTitles))
{
foreach($bug->linkBugTitles as $linkBugID => $linkBugTitle)
foreach($bug->relatedBugTitles as $relatedBugID => $relatedBugTitle)
{
echo "<li><div class='checkbox-primary'>";
echo "<input type='checkbox' checked='checked' name='linkBug[]' value=$linkBugID />";
echo "<label>#{$linkBugID} {$linkBugTitle}</label>";
echo "<input type='checkbox' checked='checked' name='relatedBug[]' value=$relatedBugID />";
echo "<label>#{$relatedBugID} {$relatedBugTitle}</label>";
echo '</div></li>';
}
}
+1 -1
View File
@@ -85,7 +85,7 @@ $(function()
$('#linkBugsForm').find('tr.checked').each(function(){
var bugID = $(this).find('td.c-id').find('div.checkbox-primary input').attr('value');
var bugTitle = "#" + bugID + ' ' + $(this).find('td').eq(3).attr('title');
var checkbox = "<li><div class='checkbox-primary'><input type='checkbox' checked='checked' name='linkBug[]' " + "value=" + bugID + " /><label>" + bugTitle + "</label></div></li>";
var checkbox = "<li><div class='checkbox-primary'><input type='checkbox' checked='checked' name='relatedBug[]' " + "value=" + bugID + " /><label>" + bugTitle + "</label></div></li>";
output += checkbox;
});
+3 -3
View File
@@ -385,11 +385,11 @@
<th class='w-90px'><?php echo $lang->bug->relatedBug;?></th>
<td>
<?php
if(isset($bug->linkBugTitles))
if(isset($bug->relatedBugTitles))
{
foreach($bug->linkBugTitles as $linkBugID => $linkBugTitle)
foreach($bug->relatedBugTitles as $relatedBugID => $relatedBugTitle)
{
echo html::a($this->createLink('bug', 'view', "bugID=$linkBugID", '', true), "#$linkBugID $linkBugTitle", '', "class='iframe' data-width='80%'") . '<br />';
echo html::a($this->createLink('bug', 'view', "bugID=$relatedBugID", '', true), "#$relatedBugID $relatedBugTitle", '', "class='iframe' data-width='80%'") . '<br />';
}
}
?>
+2 -2
View File
@@ -892,7 +892,7 @@ class bugZen extends bug
->setDefault('deleteFiles', array())
->setDefault('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
->join('openedBuild,mailto,linkBug,os,browser', ',')
->join('openedBuild,mailto,relatedBug,os,browser', ',')
->setIF($formData->data->assignedTo != $oldBug->assignedTo, 'assignedDate', $now)
->setIF($formData->data->resolvedBy != '' && $formData->data->resolvedDate == '', 'resolvedDate', $now)
->setIF($formData->data->resolution != '' && $formData->data->resolvedDate == '', 'resolvedDate', $now)
@@ -1723,7 +1723,7 @@ class bugZen extends bug
if(!empty($bug->plan)) $this->action->create('productplan', $bug->plan, 'linkbug', '', $bug->id);
}
$this->updateLinkBug($bug->id, $bug->linkBug, $oldBug->linkBug);
$this->bug->updateRelatedBug($bug->id, $bug->relatedBug, $oldBug->relatedBug);
/* 给 bug 解决者积分奖励。*/
/* Add score to the user who resolved the bug. */
+1 -1
View File
@@ -228,7 +228,7 @@ class bugfree2ConvertModel extends bugfreeConvertModel
howFound AS found,
reproSteps AS steps,
bugStatus AS status,
linkID AS linkBug,
linkID AS relatedBug,
duplicateID AS duplicateBug,
caseID AS `case`,
1 AS caseVersion,
+1 -1
View File
@@ -1148,7 +1148,7 @@ class convertModel extends model
}
elseif($sourceObjectType == 'bug' and $destObjectType == 'bug')
{
$this->dao->dbh($this->dbh)->update(TABLE_BUG)->set("linkBug=concat(linkBug, ',{$issueBugs[$dest]}')")->where('id')->eq($issueBugs[$source])->exec();
$this->dao->dbh($this->dbh)->update(TABLE_BUG)->set("relatedBug=concat(relatedBug, ',{$issueBugs[$dest]}')")->where('id')->eq($issueBugs[$source])->exec();
}
}
}
+4 -4
View File
@@ -6898,11 +6898,11 @@ class upgradeModel extends model
*/
public function processBugLinkBug()
{
$bugs = $this->dao->select('id,linkBug')->from(TABLE_BUG)->where('linkBug')->ne('')->fetchPairs();
foreach($bugs as $bugID => $linkBugs)
$bugs = $this->dao->select('id,relatedBug')->from(TABLE_BUG)->where('relatedBug')->ne('')->fetchPairs();
foreach($bugs as $bugID => $relatedBugs)
{
$linkBugs = explode(',', $linkBugs);
$this->dao->update(TABLE_BUG)->set("linkBug = TRIM(BOTH ',' from CONCAT(linkbug, ',$bugID'))")->where('id')->in($linkBugs)->andWhere('id')->ne($bugID)->andWhere("CONCAT(',', linkBug, ',')")->notlike("%,$bugID,%")->exec();
$relatedBugs = explode(',', $relatedBugs);
$this->dao->update(TABLE_BUG)->set("relatedBug = TRIM(BOTH ',' from CONCAT(relatedbug, ',$bugID'))")->where('id')->in($relatedBugs)->andWhere('id')->ne($bugID)->andWhere("CONCAT(',', relatedBug, ',')")->notlike("%,$bugID,%")->exec();
}
return !dao::isError();
+1 -1
View File
@@ -101,7 +101,7 @@ fields:
range: "[]{50},admin{30}"
- field: duplicateBug
range: 0{55},1-5,0{40},10-15
- field: linkBug
- field: relatedBug
range:
- field: case
range: 0