* Finish task #48612.
This commit is contained in:
@@ -305,6 +305,7 @@ class bug extends control
|
||||
/* Whether there is a object to transfer bug, for example feedback. */
|
||||
$extras = str_replace(array(',', ' '), array('&', ''), $extras);
|
||||
parse_str($extras, $output);
|
||||
$from = isset($output['from']) ? $output['from'] : '';
|
||||
|
||||
$project = new stdclass();
|
||||
|
||||
@@ -331,28 +332,6 @@ class bug extends control
|
||||
$this->qa->setMenu($this->products, $productID, $branch);
|
||||
}
|
||||
|
||||
foreach($output as $paramKey => $paramValue)
|
||||
{
|
||||
if(isset($this->config->bug->fromObjects[$paramKey]))
|
||||
{
|
||||
$fromObjectIDKey = $paramKey;
|
||||
$fromObjectID = $paramValue;
|
||||
$fromObjectName = $this->config->bug->fromObjects[$fromObjectIDKey]['name'];
|
||||
$fromObjectAction = $this->config->bug->fromObjects[$fromObjectIDKey]['action'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If there is a object to transfer bug, get it by getById function and set objectID,object in views. */
|
||||
if(isset($fromObjectID))
|
||||
{
|
||||
$fromObject = $this->loadModel($fromObjectName)->getById($fromObjectID);
|
||||
if(!$fromObject) return print(js::error($this->lang->notFound) . js::locate('back', 'parent'));
|
||||
|
||||
$this->view->$fromObjectIDKey = $fromObjectID;
|
||||
$this->view->$fromObjectName = $fromObject;
|
||||
}
|
||||
|
||||
$this->view->users = $this->user->getPairs('devfirst|noclosed|nodeleted');
|
||||
$this->app->loadLang('release');
|
||||
|
||||
@@ -363,7 +342,7 @@ class bug extends control
|
||||
|
||||
/* Set from param if there is a object to transfer bug. */
|
||||
setcookie('lastBugModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false);
|
||||
$bugResult = $this->bug->create($from = isset($fromObjectIDKey) ? $fromObjectIDKey : '', $extras);
|
||||
$bugResult = $this->bug->create('', $extras);
|
||||
if(!$bugResult or dao::isError())
|
||||
{
|
||||
$response['result'] = 'fail';
|
||||
@@ -380,15 +359,9 @@ class bug extends control
|
||||
return $this->send($response);
|
||||
}
|
||||
|
||||
/* Record related action, for example FromFeedback. */
|
||||
if(isset($fromObjectID))
|
||||
{
|
||||
$actionID = $this->action->create('bug', $bugID, $fromObjectAction, '', $fromObjectID);
|
||||
}
|
||||
else
|
||||
{
|
||||
$actionID = $this->action->create('bug', $bugID, 'Opened');
|
||||
}
|
||||
/* Record related action, for example FromSonarqube. */
|
||||
$createAction = $from == 'sonarqube' ? 'fromSonarqube' : 'Opened';
|
||||
$actionID = $this->action->create('bug', $bugID, $createAction);
|
||||
|
||||
$extras = str_replace(array(',', ' '), array('&', ''), $extras);
|
||||
parse_str($extras, $output);
|
||||
@@ -466,7 +439,7 @@ class bug extends control
|
||||
$runID = 0;
|
||||
$testtask = 0;
|
||||
$version = 0;
|
||||
$title = '';
|
||||
$title = $from == 'sonarqube' ? $_COOKIE['sonarqubeIssue'] : '';
|
||||
$steps = $this->lang->bug->tplStep . $this->lang->bug->tplResult . $this->lang->bug->tplExpect;
|
||||
$os = '';
|
||||
$browser = '';
|
||||
@@ -532,15 +505,6 @@ class bug extends control
|
||||
$branches = $productInfo->type != 'normal' ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
|
||||
}
|
||||
|
||||
/* Replace the value of bug that needs to be replaced with the value of the object that is transferred to bug. */
|
||||
if(isset($fromObject))
|
||||
{
|
||||
foreach($this->config->bug->fromObjects[$fromObjectIDKey]['fields'] as $bugField => $fromObjectField)
|
||||
{
|
||||
$$bugField = $fromObject->{$fromObjectField};
|
||||
}
|
||||
}
|
||||
|
||||
/* If executionID is setted, get builds and stories of this execution. */
|
||||
if($executionID)
|
||||
{
|
||||
@@ -671,6 +635,7 @@ class bug extends control
|
||||
$this->view->color = $color;
|
||||
$this->view->stepsRequired = strpos($this->config->bug->create->requiredFields, 'steps');
|
||||
$this->view->isStepsTemplate = $steps == $this->lang->bug->tplStep . $this->lang->bug->tplResult . $this->lang->bug->tplExpect ? true : false;
|
||||
$this->view->issueKey = $from == 'sonarqube' ? $output['sonarqubeID'] . ':' . $output['issueKey'] : '';
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -2556,6 +2556,20 @@ class bugModel extends model
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get by Sonarqube id.
|
||||
*
|
||||
* @param int $sonarqubeID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getBySonarqubeID($sonarqubeID)
|
||||
{
|
||||
return $this->dao->select('issueKey')->from(TABLE_BUG)
|
||||
->where('issueKey')->like("$sonarqubeID:%")
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bugs by search.
|
||||
*
|
||||
|
||||
@@ -338,6 +338,7 @@ if($this->app->tab == 'project') js::set('objectID', $projectID);
|
||||
<tr class='hide'>
|
||||
<th><?php echo $lang->bug->status;?></th>
|
||||
<td><?php echo html::hidden('status', 'active');?></td>
|
||||
<td><?php echo html::hidden('issueKey', $issueKey);?></td>
|
||||
</tr>
|
||||
<?php $this->printExtendFields('', 'table');?>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user