This commit is contained in:
zhujinyong
2021-07-19 11:59:06 +08:00
86 changed files with 656 additions and 515 deletions
+3 -3
View File
@@ -4,9 +4,9 @@ $config->bug->batchCreate = 10;
$config->bug->longlife = 7;
$config->bug->removeFields = 'objectTypeList,productList,executionList,gitlabID,gitlabProjectID';
$config->bug->create = new stdclass();
$config->bug->edit = new stdclass();
$config->bug->resolve = new stdclass();
$config->bug->create = new stdclass();
$config->bug->edit = new stdclass();
$config->bug->resolve = new stdclass();
$config->bug->create->requiredFields = 'title,openedBuild';
$config->bug->edit->requiredFields = $config->bug->create->requiredFields;
$config->bug->resolve->requiredFields = 'resolution';
+12 -3
View File
@@ -519,7 +519,16 @@ class bug extends control
/* Get products and projects. */
$products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed', 0, 'program_asc');
$projects = array(0 => '');
if($projectID)
if($executionID)
{
$products = array();
$linkedProducts = $this->loadModel('execution')->getProducts($executionID);
foreach($linkedProducts as $product) $products[$product->id] = $product->name;
$project = $this->loadModel('project')->getByID($projectID);
$projects = array($projectID => $project->name);
}
elseif($projectID)
{
$products = array();
$productList = $this->config->CRProduct ? $this->product->getOrderedProducts('all', 40, $projectID) : $this->product->getOrderedProducts('normal', 40, $projectID);
@@ -899,7 +908,7 @@ class bug extends control
$this->view->product = $product;
$this->view->productName = $this->products[$productID];
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch);
$this->view->projects = array(0 => '') + $this->product->getProjectPairsByProduct($productID, $bug->branch);
$this->view->projects = array(0 => '') + $this->product->getProjectPairsByProduct($productID, $bug->branch, $bug->project);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch);
$this->view->currentModuleID = $currentModuleID;
$this->view->executions = array(0 => '') + $this->product->getExecutionPairsByProduct($bug->product, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID);
@@ -1563,7 +1572,7 @@ class bug extends control
$this->loadModel('gitlab');
$relation = $this->gitlab->getRelationByObject('bug', $bugID);
if(!empty($relation)) $this->gitlab->deleteIssue('bug', $bugID, $relation->issueID);
$this->bug->delete(TABLE_BUG, $bugID);
if($bug->toTask != 0)
{
+2 -4
View File
@@ -178,13 +178,11 @@ $(document).ready(function()
projects = '';
$.each(gitlabProjects[host], function(id, obj){projects = projects + ',' + obj.gitlabProject});
url = createLink('repo', 'ajaxgetgitlabprojects', "host=" + host + "&projects=" + projects);
$.get(url, function(response)
{
$('#gitlabProject').html('').append(response);
$('#gitlabProject').chosen().trigger("chosen:updated");;
$('#gitlabProject').chosen().trigger("chosen:updated");
});
});
});
+9 -9
View File
@@ -88,7 +88,7 @@ class bugModel extends model
if(!dao::isError())
{
$bugID = $this->dao->lastInsertID();
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject, 'bug', $bugID, $bug);
$this->file->updateObjectID($this->post->uid, $bugID, 'bug');
@@ -278,9 +278,9 @@ class bugModel extends model
/**
* Create bug from gitlab issue.
*
* @param object $bug
* @param int $executionID
*
* @param object $bug
* @param int $executionID
* @access public
* @return int|bool
*/
@@ -675,7 +675,7 @@ class bugModel extends model
if(!empty($bug->resolvedBy)) $this->loadModel('score')->create('bug', 'resolve', $bugID);
$this->file->updateObjectID($this->post->uid, $bugID, 'bug');
if(!empty($bug))
if(!empty($bug))
{
$this->loadModel('gitlab');
$relation = $this->gitlab->getRelationByObject('bug', $bugID);
@@ -862,7 +862,7 @@ class bugModel extends model
$this->loadModel('gitlab');
foreach($activateBugs as $bugID => $bug)
{
if(!empty($bug))
if(!empty($bug))
{
$relation = $this->gitlab->getRelationByObject('bug', $bugID);
if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', (Object)$bug, $bugID);
@@ -904,7 +904,7 @@ class bugModel extends model
$this->loadModel('gitlab');
$relation = $this->gitlab->getRelationByObject('bug', $bugID);
$bug = $this->getById($bugID); // get full bug object to update issue.
$bug = $this->getById($bugID); // Get full bug object to update issue.
$bug->assignee_id = $this->gitlab->getGitlabUserID($relation->gitlabID, $bug->assignedTo);
if($bug->assignee_id != '')
{
@@ -967,7 +967,7 @@ class bugModel extends model
$bug->lastEditedDate = $now;
$bug->confirmed = 1;
if(!empty($bug))
if(!empty($bug))
{
$relation = $this->gitlab->getRelationByObject('bug', $bugID);
if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID);
@@ -1259,7 +1259,7 @@ class bugModel extends model
}
}
if(!empty($bug))
if(!empty($bug))
{
$this->loadModel('gitlab');
$relation = $this->gitlab->getRelationByObject('bug', $bugID);
+7 -7
View File
@@ -313,13 +313,13 @@ js::set('gitlabProjects', $gitlabProjects);
<?php endif;?>
</tr>
<?php endif;?>
<?php if(!empty($gitlabProjects)):?>
<tr>
<th><?php echo $lang->task->sync2Gitlab;?></th>
<td><?php echo html::select('gitlab', $gitlabList, '', "class='form-control chosen'");?></td>
<td><?php echo html::select('gitlabProject', '', '', "class='form-control chosen'");?></td>
</tr>
<?php endif;?>
<?php if(!empty($gitlabProjects)):?>
<tr>
<th><?php echo $lang->task->sync2Gitlab;?></th>
<td><?php echo html::select('gitlab', $gitlabList, '', "class='form-control chosen'");?></td>
<td><?php echo html::select('gitlabProject', '', '', "class='form-control chosen'");?></td>
</tr>
<?php endif;?>
<tr class='hide'>
<th><?php echo $lang->bug->status;?></th>
<td><?php echo html::hidden('status', 'active');?></td>