* Adj Code.

This commit is contained in:
lichengjun
2021-06-28 14:04:02 +08:00
parent 3907ff1ea7
commit be619512c4
3 changed files with 30 additions and 6 deletions
+1 -1
View File
@@ -90,7 +90,7 @@ class bugModel extends model
$bugID = $this->dao->lastInsertID();
/* Sync this bug to gitlab issue. */
$this->loadModel('gitlab')->syncBug($bugID, $this->post->gitlab, $this->post->gitlabProject);
$this->loadModel('gitlab')->pushToissue($bugID, $this->post->gitlab, $this->post->gitlabProject,'bug');
$this->file->updateObjectID($this->post->uid, $bugID, 'bug');
$this->file->saveUpload('bug', $bugID);
+3 -3
View File
@@ -42,14 +42,14 @@ $config->gitlab->maps->story = array();
$config->gitlab->maps->story['title'] = 'title|field|';
$config->gitlab->maps->story['spec'] = 'description|fields|verify';
$config->gitlab->maps->story['openedDate'] = 'created_at|field|';
$config->gitlab->maps->story['openedBy'] = 'assignee_id|userPairs|';
$config->gitlab->maps->story['assignedTo'] = 'assignee_id|userPairs|';
$config->gitlab->maps->story['pri'] = 'weight|configItems|storyWeightMap';
$config->gitlab->maps->bug = array();
$config->gitlab->maps->bug['title'] = 'title|field|';
$config->gitlab->maps->bug['spec'] = 'description|field|';
$config->gitlab->maps->bug['steps'] = 'description|field|';
$config->gitlab->maps->bug['openedDate'] = 'created_at|field|';
$config->gitlab->maps->bug['openedBy'] = 'assignee_id|userPairs|';
$config->gitlab->maps->bug['assignedTo'] = 'assignee_id|userPairs|';
$config->gitlab->maps->bug['pri'] = 'weight|configItems|bugWeightMap';
$config->gitlab->taskWeightMap = array();
+26 -2
View File
@@ -597,13 +597,37 @@ class gitlabModel extends model
$issue = $this->bugToIssue($gitlab, $gitlabProject, $bug);
$this->createZentaoObjectLabel($gitlab, $gitlabProject, 'bug', $bugID);
sprintf($this->config->gitlab->zentaoObjectLabel->name, 'bug', $bugID);
$issue->labels = sprintf($this->config->gitlab->zentaoObjectLabel->name, 'bug', $bugID);
if($syncedIssue) $issue = $this->apiUpdateIssue($gitlab, $gitlabProject, $syncedIssue, $issue);
$issue = $this->apiCreateIssue($gitlab, $gitlabProject, $issue);
if($issue) $this->saveSyncedIssue('bug', $bug, $gitlab, $issue);
}
/**
* Push to gitlab issue.
*
* @param int $storyID
* @param int $gitlab
* @param int $gitlabProject
* @access public
* @return void
*/
public function PushToissue($ID, $gitlabID, $gitlabProject, $type)
{
$data = $this->loadModel($type)->getByID($ID);
$syncedIssue = $this->getSyncedIssue($objectType = $type, $objectID = $ID, $gitlabID);
$issue = $this->bugToIssue($gitlabID, $gitlabProject, $data);
$this->createZentaoObjectLabel($gitlabID, $gitlabProject, $type, $ID);
$issue->labels = sprintf($this->config->gitlab->zentaoObjectLabel->name, $type, $ID);
if($syncedIssue) $issue = $this->apiUpdateIssue($gitlabID, $gitlabProject, $syncedIssue, $issue);
$issue = $this->apiCreateIssue($gitlabID, $gitlabProject, $issue);
if($issue) $this->saveSyncedIssue($type, $data, $gitlabID, $issue);
}
/**
* Get synced issue from relation table.
*
@@ -735,7 +759,7 @@ class gitlabModel extends model
$value = '';
list($field, $optionType, $options) = explode('|', $config);
if($optionType == 'field') $value = $bug->$bugField;
if($optionType == 'fields') $value = $bug->$bugField . "\n\n" . $story->$options;
if($optionType == 'fields') $value = $bug->$bugField . "\n\n" . $bug->$options;
if($optionType == 'userPairs')
{
$value = zget($gitlabUsers, $bug->$bugField);