* Fix bug assign logic.
This commit is contained in:
+7
-17
@@ -502,14 +502,12 @@ class bug extends control
|
||||
$moduleOwner = $this->bug->getModuleOwner($moduleID, $productID);
|
||||
|
||||
/* Set team members of the latest execution as assignedTo list. */
|
||||
$latestExecution = $this->product->getLatestProject($productID);
|
||||
$executionMembers = array();
|
||||
if(!empty($latestExecution)) $executionMembers = $this->loadModel('user')->getTeamMemberPairs($latestExecution->id, 'execution', 'nodeleted', $moduleOwner);
|
||||
if(empty($executionMembers)) $executionMembers = $this->view->users;
|
||||
if($assignedTo and !isset($executionMembers[$assignedTo]))
|
||||
$productMembers = $this->bug->getProductMemberPairs($productID);
|
||||
if(empty($productMembers)) $productMembers = $this->view->users;
|
||||
if($assignedTo and !isset($productMembers[$assignedTo]))
|
||||
{
|
||||
$user = $this->loadModel('user')->getById($assignedTo);
|
||||
if($user) $executionMembers[$assignedTo] = $user->realname;
|
||||
if($user) $productMembers[$assignedTo] = $user->realname;
|
||||
}
|
||||
|
||||
$moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
|
||||
@@ -583,7 +581,7 @@ class bug extends control
|
||||
$this->view->steps = htmlspecialchars($steps);
|
||||
$this->view->os = $os;
|
||||
$this->view->browser = $browser;
|
||||
$this->view->executionMembers = $executionMembers;
|
||||
$this->view->productMembers = $productMembers;
|
||||
$this->view->assignedTo = $assignedTo;
|
||||
$this->view->deadline = $deadline;
|
||||
$this->view->mailto = $mailto;
|
||||
@@ -1613,17 +1611,9 @@ class bug extends control
|
||||
*/
|
||||
public function ajaxLoadExecutionTeamMembers($productID, $selectedUser = '')
|
||||
{
|
||||
$latestExecution = $this->product->getLatestProject($productID);
|
||||
if(!empty($latestExecution))
|
||||
{
|
||||
$executionMembers = $this->user->getTeamMemberPairs($latestExecution->id, 'execution', 'nodeleted', $selectedUser);
|
||||
}
|
||||
else
|
||||
{
|
||||
$executionMembers = $this->user->getPairs('devfirst|noclosed|nodeleted');
|
||||
}
|
||||
$productMembers = $this->bug->getProductMemberPairs($productID);
|
||||
|
||||
die(html::select('assignedTo', $executionMembers, $selectedUser, 'class="form-control"'));
|
||||
die(html::select('assignedTo', $productMembers, $selectedUser, 'class="form-control"'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,7 +60,7 @@ function loadAll(productID)
|
||||
loadProductBuilds(productID);
|
||||
loadProductplans(productID);
|
||||
loadProductStories(productID);
|
||||
loadTestTasks(productID);
|
||||
//loadTestTasks(productID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,12 @@ function loadAllUsers()
|
||||
function loadExecutionTeamMembers(productID)
|
||||
{
|
||||
var link = createLink('bug', 'ajaxLoadExecutionTeamMembers', 'productID=' + productID + '&selectedUser=' + $('#assignedTo').val());
|
||||
$('#assignedToBox').load(link, function(){$('#assignedTo').chosen();});
|
||||
$.post(link, function(data)
|
||||
{
|
||||
$('#assignedTo').replaceWith(data);
|
||||
$('#assignedTo_chosen').remove();
|
||||
$('#assignedTo').chosen();
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1592,6 +1592,29 @@ class bugModel extends model
|
||||
return $bugs;
|
||||
}
|
||||
|
||||
public function getProductMemberPairs($productID)
|
||||
{
|
||||
$projects = $this->loadModel('product')->getProjectPairsByProduct($productID);
|
||||
|
||||
$users = $this->dao->select("t2.id, t2.account, t2.realname")->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')
|
||||
->where('t1.root')->in(array_keys($projects))
|
||||
->andWhere('t1.type')->eq('project')
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->fi()
|
||||
->fetchAll('account');
|
||||
|
||||
if(!$users) return array('' => '');
|
||||
|
||||
foreach($users as $account => $user)
|
||||
{
|
||||
$firstLetter = ucfirst(substr($user->account, 0, 1)) . ':';
|
||||
if(!empty($this->config->isINT)) $firstLetter = '';
|
||||
$users[$account] = $firstLetter . ($user->realname ? $user->realname : $user->account);
|
||||
}
|
||||
return array('' => '') + $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bugs according to buildID and productID.
|
||||
*
|
||||
|
||||
@@ -129,7 +129,7 @@ js::set('blockID', $blockID);
|
||||
<th><nobr><?php echo $lang->bug->lblAssignedTo;?></nobr></th>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select('assignedTo', $executionMembers, $assignedTo, "class='form-control chosen'");?>
|
||||
<?php echo html::select('assignedTo', $productMembers, $assignedTo, "class='form-control chosen'");?>
|
||||
<span class='input-group-btn'><?php echo html::commonButton($lang->bug->allUsers, "class='btn btn-default' onclick='loadAllUsers()' data-toggle='tooltip'");?></span>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user