* finish task #2570.
This commit is contained in:
@@ -110,6 +110,7 @@ class bug extends control
|
||||
$this->view->productID = $productID;
|
||||
$this->view->productName = $this->products[$productID];
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
|
||||
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'), '', $branch);
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->bugs = $bugs;
|
||||
@@ -654,6 +655,32 @@ class bug extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch change the module of bug.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function batchChangeModule($moduleID)
|
||||
{
|
||||
if($this->post->bugIDList)
|
||||
{
|
||||
$bugIDList = $this->post->bugIDList;
|
||||
unset($_POST['bugIDList']);
|
||||
$allChanges = $this->bug->batchChangeModule($bugIDList, $moduleID);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
foreach($allChanges as $bugID => $changes)
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$actionID = $this->action->create('bug', $bugID, 'Edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
$this->sendmail($bugID, $actionID);
|
||||
}
|
||||
}
|
||||
die(js::locate($this->session->bugList, 'parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch update assign of bug.
|
||||
*
|
||||
|
||||
@@ -15,6 +15,7 @@ $lang->bug->id = 'ID';
|
||||
$lang->bug->product = $lang->productCommon;
|
||||
$lang->bug->productplan = 'Plan';
|
||||
$lang->bug->module = 'Module';
|
||||
$lang->bug->moduleAB = 'Module';
|
||||
$lang->bug->project = $lang->projectCommon;
|
||||
$lang->bug->story = 'Story';
|
||||
$lang->bug->task = 'Task';
|
||||
|
||||
@@ -15,6 +15,7 @@ $lang->bug->id = 'Bug编号';
|
||||
$lang->bug->product = '所属' . $lang->productCommon;
|
||||
$lang->bug->productplan = '所属计划';
|
||||
$lang->bug->module = '所属模块';
|
||||
$lang->bug->moduleAB = '模块';
|
||||
$lang->bug->project = '所属' . $lang->projectCommon;
|
||||
$lang->bug->story = '相关需求';
|
||||
$lang->bug->task = '相关任务';
|
||||
|
||||
@@ -672,6 +672,35 @@ class bugModel extends model
|
||||
$this->linkBugToBuild($bugID, $bug->resolvedBuild);
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch change the module of bug.
|
||||
*
|
||||
* @param array $bugIDList
|
||||
* @param int $moduleID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function batchChangeModule($bugIDList, $moduleID)
|
||||
{
|
||||
$now = helper::now();
|
||||
$allChanges = array();
|
||||
$oldBugs = $this->getByList($bugIDList);
|
||||
foreach($bugIDList as $bugID)
|
||||
{
|
||||
$oldBug = $oldBugs[$bugID];
|
||||
if($moduleID == $oldBug->module) continue;
|
||||
|
||||
$bug = new stdclass();
|
||||
$bug->lastEditedBy = $this->app->user->account;
|
||||
$bug->lastEditedDate = $now;
|
||||
$bug->module = $moduleID;
|
||||
|
||||
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec();
|
||||
if(!dao::isError()) $allChanges[$bugID] = common::createChanges($oldBug, $bug);
|
||||
}
|
||||
return $allChanges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Batch resolve bugs.
|
||||
*
|
||||
|
||||
+115
-97
@@ -86,106 +86,124 @@ js::set('moduleID', $moduleID);
|
||||
$vars = "productID=$productID&branch=$branch&browseType=$browseType¶m=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
|
||||
include $useDatatable ? dirname(__FILE__) . '/datatabledata.html.php' : dirname(__FILE__) . '/browsedata.html.php';
|
||||
?>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<?php
|
||||
$columns = $this->cookie->windowWidth >= $this->config->wideSize ? 12 : 10;
|
||||
if($browseType == 'needconfirm') $columns = 7;
|
||||
?>
|
||||
<td colspan='<?php echo $columns;?>'>
|
||||
<?php if(!empty($bugs)):?>
|
||||
<div class='table-actions clearfix'>
|
||||
<?php if(!$useDatatable) echo html::selectButton();?>
|
||||
<div class='btn-group dropup'>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<?php
|
||||
$columns = $this->cookie->windowWidth >= $this->config->wideSize ? 12 : 10;
|
||||
if($browseType == 'needconfirm') $columns = 7;
|
||||
?>
|
||||
<td colspan='<?php echo $columns;?>'>
|
||||
<?php if(!empty($bugs)):?>
|
||||
<div class='table-actions clearfix'>
|
||||
<?php if(!$useDatatable) echo html::selectButton();?>
|
||||
<div class='btn-group dropup'>
|
||||
<?php
|
||||
$actionLink = $this->createLink('bug', 'batchEdit', "productID=$productID&branch=$branch");
|
||||
$misc = common::hasPriv('bug', 'batchEdit') ? "onclick=\"setFormAction('$actionLink')\"" : "disabled='disabled'";
|
||||
echo html::commonButton($lang->edit, $misc);
|
||||
?>
|
||||
<button type='button' class='btn dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>
|
||||
<ul class='dropdown-menu'>
|
||||
<?php
|
||||
$actionLink = $this->createLink('bug', 'batchEdit', "productID=$productID&branch=$branch");
|
||||
$misc = common::hasPriv('bug', 'batchEdit') ? "onclick=\"setFormAction('$actionLink')\"" : "disabled='disabled'";
|
||||
echo html::commonButton($lang->edit, $misc);
|
||||
$class = "class='disabled'";
|
||||
$actionLink = $this->createLink('bug', 'batchConfirm');
|
||||
$misc = common::hasPriv('bug', 'batchConfirm') ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : $class;
|
||||
if($misc) echo "<li>" . html::a('javascript:;', $lang->bug->confirmBug, '', $misc) . "</li>";
|
||||
|
||||
$actionLink = $this->createLink('bug', 'batchClose');
|
||||
$misc = common::hasPriv('bug', 'batchClose') ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : $class;
|
||||
if($misc) echo "<li>" . html::a('javascript:;', $lang->bug->close, '', $misc) . "</li>";
|
||||
|
||||
if(common::hasPriv('bug', 'batchChangeModule'))
|
||||
{
|
||||
$withSearch = count($modules) > 8;
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript:;', $lang->bug->moduleAB, '', "id='moduleItem'");
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
foreach($modules as $moduleId => $module)
|
||||
{
|
||||
$actionLink = $this->createLink('bug', 'batchChangeModule', "moduleID=$moduleId");
|
||||
echo "<li class='option' data-key='$moduleID'>" . html::a('#', $module, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"") . "</li>";
|
||||
}
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo '</ul></li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<li>' . html::a('javascript:;', $lang->bug->moduleAB, '', $class) . '</li>';
|
||||
}
|
||||
|
||||
$misc = common::hasPriv('bug', 'batchResolve') ? "id='resolveItem'" : '';
|
||||
if($misc)
|
||||
{
|
||||
echo "<li class='dropdown-submenu'>" . html::a('javascript:;', $lang->bug->resolve, '', $misc);
|
||||
echo "<ul class='dropdown-menu'>";
|
||||
unset($lang->bug->resolutionList['']);
|
||||
unset($lang->bug->resolutionList['duplicate']);
|
||||
unset($lang->bug->resolutionList['tostory']);
|
||||
foreach($lang->bug->resolutionList as $key => $resolution)
|
||||
{
|
||||
$actionLink = $this->createLink('bug', 'batchResolve', "resolution=$key");
|
||||
if($key == 'fixed')
|
||||
{
|
||||
$withSearch = count($builds) > 4;
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript:;', $resolution, '', "id='fixedItem'");
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
unset($builds['']);
|
||||
foreach($builds as $key => $build)
|
||||
{
|
||||
$actionLink = $this->createLink('bug', 'batchResolve', "resolution=fixed&resolvedBuild=$key");
|
||||
echo "<li class='option' data-key='$key'>";
|
||||
echo html::a('javascript:;', $build, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"");
|
||||
echo "</li>";
|
||||
}
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo '</ul></li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<li>' . html::a('javascript:;', $resolution, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"") . '</li>';
|
||||
}
|
||||
}
|
||||
echo '</ul></li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<li>" . html::a('javascript:;', $lang->bug->resolve, '', $class);
|
||||
}
|
||||
|
||||
$canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
|
||||
if($canBatchAssignTo && count($bugs))
|
||||
{
|
||||
$withSearch = count($memberPairs) > 10;
|
||||
$actionLink = $this->createLink('bug', 'batchAssignTo', "productID={$productID}&type=product");
|
||||
echo html::select('assignedTo', $memberPairs, '', 'class="hidden"');
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript::', $lang->bug->assignedTo, 'id="assignItem"');
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
foreach ($memberPairs as $key => $value)
|
||||
{
|
||||
if(empty($key)) continue;
|
||||
echo "<li class='option' data-key='$key'>" . html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', '') . '</li>';
|
||||
}
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo "</ul>";
|
||||
echo "</li>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<li>" . html::a('javascript:;', $lang->bug->assignedTo, '', $class);
|
||||
}
|
||||
?>
|
||||
<button type='button' class='btn dropdown-toggle' data-toggle='dropdown'><span class='caret'></span></button>
|
||||
<ul class='dropdown-menu'>
|
||||
<?php
|
||||
$class = "class='disabled'";
|
||||
$actionLink = $this->createLink('bug', 'batchConfirm');
|
||||
$misc = common::hasPriv('bug', 'batchConfirm') ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : $class;
|
||||
if($misc) echo "<li>" . html::a('javascript:;', $lang->bug->confirmBug, '', $misc) . "</li>";
|
||||
|
||||
$actionLink = $this->createLink('bug', 'batchClose');
|
||||
$misc = common::hasPriv('bug', 'batchClose') ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : $class;
|
||||
if($misc) echo "<li>" . html::a('javascript:;', $lang->bug->close, '', $misc) . "</li>";
|
||||
|
||||
$misc = common::hasPriv('bug', 'batchResolve') ? "id='resolveItem'" : '';
|
||||
if($misc)
|
||||
{
|
||||
echo "<li class='dropdown-submenu'>" . html::a('javascript:;', $lang->bug->resolve, '', $misc);
|
||||
echo "<ul class='dropdown-menu'>";
|
||||
unset($lang->bug->resolutionList['']);
|
||||
unset($lang->bug->resolutionList['duplicate']);
|
||||
unset($lang->bug->resolutionList['tostory']);
|
||||
foreach($lang->bug->resolutionList as $key => $resolution)
|
||||
{
|
||||
$actionLink = $this->createLink('bug', 'batchResolve', "resolution=$key");
|
||||
if($key == 'fixed')
|
||||
{
|
||||
$withSearch = count($builds) > 4;
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript:;', $resolution, '', "id='fixedItem'");
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
unset($builds['']);
|
||||
foreach($builds as $key => $build)
|
||||
{
|
||||
$actionLink = $this->createLink('bug', 'batchResolve', "resolution=fixed&resolvedBuild=$key");
|
||||
echo "<li class='option' data-key='$key'>";
|
||||
echo html::a('javascript:;', $build, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"");
|
||||
echo "</li>";
|
||||
}
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo '</ul></li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo '<li>' . html::a('javascript:;', $resolution, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"") . '</li>';
|
||||
}
|
||||
}
|
||||
echo '</ul></li>';
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<li>" . html::a('javascript:;', $lang->bug->resolve, '', $class);
|
||||
}
|
||||
|
||||
$canBatchAssignTo = common::hasPriv('bug', 'batchAssignTo');
|
||||
if($canBatchAssignTo && count($bugs))
|
||||
{
|
||||
$withSearch = count($memberPairs) > 10;
|
||||
$actionLink = $this->createLink('bug', 'batchAssignTo', "productID={$productID}&type=product");
|
||||
echo html::select('assignedTo', $memberPairs, '', 'class="hidden"');
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript::', $lang->bug->assignedTo, 'id="assignItem"');
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
foreach ($memberPairs as $key => $value)
|
||||
{
|
||||
if(empty($key)) continue;
|
||||
echo "<li class='option' data-key='$key'>" . html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', '') . '</li>';
|
||||
}
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo "</ul>";
|
||||
echo "</li>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<li>" . html::a('javascript:;', $lang->bug->assignedTo, '', $class);
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class='text-right'><?php $pager->show();?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class='text-right'><?php $pager->show();?></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user