* finish task #2317.
This commit is contained in:
@@ -772,18 +772,23 @@ class bug extends control
|
||||
die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
|
||||
}
|
||||
|
||||
$bug = $this->bug->getById($bugID);
|
||||
$productID = $bug->product;
|
||||
$bug = $this->bug->getById($bugID);
|
||||
$productID = $bug->product;
|
||||
$users = $this->user->getPairs('nodeleted');
|
||||
$assignedTo = $bug->openedBy;
|
||||
if(!isset($users[$assignedTo])) $assignedTo = $this->bug->getModuleOwner($bug->module, $productID);
|
||||
|
||||
$this->bug->setMenu($this->products, $productID);
|
||||
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve;
|
||||
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->bug->resolve;
|
||||
|
||||
$this->view->bug = $bug;
|
||||
$this->view->users = $this->user->getPairs('nodeleted', $bug->openedBy);
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->view->actions = $this->action->getList('bug', $bugID);
|
||||
$this->view->bug = $bug;
|
||||
$this->view->users = $users;
|
||||
$this->view->assignedTo = $assignedTo;
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->view->actions = $this->action->getList('bug', $bugID);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -1015,9 +1020,7 @@ class bug extends control
|
||||
*/
|
||||
public function ajaxGetModuleOwner($moduleID, $productID = 0)
|
||||
{
|
||||
$owner = '';
|
||||
if($moduleID) $owner = $this->dao->findByID($moduleID)->from(TABLE_MODULE)->fetch('owner');
|
||||
if(!$owner) $owner = $this->dao->findByID($productID)->from(TABLE_PRODUCT)->fetch('QD');
|
||||
$owner = $this->bug->getModuleOwner($moduleID, $productID);
|
||||
die($owner);
|
||||
}
|
||||
|
||||
|
||||
@@ -340,6 +340,43 @@ class bugModel extends model
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get module owner.
|
||||
*
|
||||
* @param int $moduleID
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleOwner($moduleID, $productID)
|
||||
{
|
||||
$users = $this->loadModel('user')->getPairs('nodeleted');
|
||||
|
||||
if($moduleID)
|
||||
{
|
||||
$module = $this->dao->findByID($moduleID)->from(TABLE_MODULE)->fetch();
|
||||
if($module->owner and isset($users[$module->owner])) return $module->owner;
|
||||
|
||||
$moduleIDList = explode(',', trim(str_replace(",$module->id,", ',', $module->path), ','));
|
||||
krsort($moduleIDList);
|
||||
if($moduleIDList)
|
||||
{
|
||||
$modules = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->in($moduleIDList)->fetchAll('id');
|
||||
foreach($moduleIDList as $moduleID)
|
||||
{
|
||||
if(isset($modules[$moduleID]))
|
||||
{
|
||||
$module = $modules[$moduleID];
|
||||
if($module->owner and isset($users[$module->owner])) return $module->owner;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$owner = $this->dao->findByID($productID)->from(TABLE_PRODUCT)->fetch('QD');
|
||||
return isset($users[$owner]) ? $users[$owner] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a bug.
|
||||
*
|
||||
@@ -598,10 +635,37 @@ class bugModel extends model
|
||||
{
|
||||
$now = helper::now();
|
||||
$bugs = $this->getByList($bugIDList);
|
||||
|
||||
$bug = reset($bugs);
|
||||
$productID = $bug->product;
|
||||
$users = $this->loadModel('user')->getPairs('nodeleted');
|
||||
$product = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch();
|
||||
$stmt = $this->dao->query($this->loadModel('tree')->buildMenuQuery($productID, 'bug', ''));
|
||||
$modules = array();
|
||||
while($module = $stmt->fetch()) $modules[$module->id] = $module;
|
||||
|
||||
foreach($bugIDList as $bugID)
|
||||
{
|
||||
$oldBug = $bugs[$bugID];
|
||||
if($oldBug->status != 'active') continue;
|
||||
|
||||
$assignedTo = $oldBug->openedBy;
|
||||
if(!isset($users[$assignedTo]))
|
||||
{
|
||||
$assignedTo = '';
|
||||
$module = isset($modules[$oldBug->module]) ? $modules[$oldBug->module] : '';
|
||||
while($module)
|
||||
{
|
||||
if($module->owner and isset($users[$module->owner]))
|
||||
{
|
||||
$assignedTo = $module->owner;
|
||||
break;
|
||||
}
|
||||
$module = isset($modules[$module->parent]) ? $modules[$module->parent] : '';
|
||||
}
|
||||
if(empty($assignedTo)) $assignedTo = $product->QD;
|
||||
}
|
||||
|
||||
$bug = new stdClass();
|
||||
$bug->resolution = $resolution;
|
||||
$bug->resolvedBuild = $resolution == 'fixed' ? $resolvedBuild : '';
|
||||
@@ -609,7 +673,7 @@ class bugModel extends model
|
||||
$bug->resolvedDate = $now;
|
||||
$bug->status = 'resolved';
|
||||
$bug->confirmed = 1;
|
||||
$bug->assignedTo = $oldBug->openedBy;
|
||||
$bug->assignedTo = $assignedTo;
|
||||
$bug->assignedDate = $now;
|
||||
$bug->lastEditedBy = $this->app->user->account;
|
||||
$bug->lastEditedDate = $now;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->bug->assignedTo?></div>
|
||||
<td><?php echo html::select('assignedTo', $users, $bug->openedBy);?></div>
|
||||
<td><?php echo html::select('assignedTo', $users, $assignedTo);?></div>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo $lang->comment;?></td>
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->bug->assignedTo;?></th>
|
||||
<td><?php echo html::select('assignedTo', $users, $bug->openedBy, "class='form-control chosen'");?></td>
|
||||
<td><?php echo html::select('assignedTo', $users, $assignedTo, "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->bug->files;?></th>
|
||||
|
||||
Reference in New Issue
Block a user