Merge branch 'jihu' of https://gitlab.zcorp.cc/easycorp/zentaopms into jihu
This commit is contained in:
@@ -90,8 +90,7 @@ class bugModel extends model
|
||||
$bugID = $this->dao->lastInsertID();
|
||||
|
||||
$object = $this->getByID($bugID);
|
||||
$issue = $this->loadModel('gitlab')->parseObjectToIssue($this->post->gitlab, $this->post->gitlabProject, 'bug', $object);
|
||||
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject, $issue, 'bug', $bugID, $object);
|
||||
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject, 'bug', $bugID, $object);
|
||||
|
||||
$this->file->updateObjectID($this->post->uid, $bugID, 'bug');
|
||||
$this->file->saveUpload('bug', $bugID);
|
||||
|
||||
@@ -27,7 +27,9 @@ $config->gitlab->webhookURL = "%s/api.php?m=gitlab&f=webhook&product=%s&gitlab=%
|
||||
|
||||
$config->gitlab->skippedFields = new stdclass;
|
||||
$config->gitlab->skippedFields->issueCreate = array();
|
||||
$config->gitlab->skippedFields->issueCreate[] = '';
|
||||
$config->gitlab->skippedFields->issueCreate['story'] = array();
|
||||
$config->gitlab->skippedFields->issueCreate['task'] = array();
|
||||
$config->gitlab->skippedFields->issueCreate['bug'] = array();
|
||||
|
||||
$config->gitlab->maps = new stdclass;
|
||||
$config->gitlab->maps->task = array();
|
||||
|
||||
@@ -276,6 +276,8 @@ class gitlabModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
* Send an api post request.
|
||||
*
|
||||
* @param int|string $host gitlab server ID | gitlab host url.
|
||||
@@ -295,6 +297,7 @@ class gitlabModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
>>>>>>> 388f6365c925b48fc5fe9db65977f00ad4bda236
|
||||
* Get current user.
|
||||
*
|
||||
* @param string $host
|
||||
@@ -570,7 +573,6 @@ class gitlabModel extends model
|
||||
|
||||
$issue = $this->loadModel('gitlab')->parseObjectToIssue($gitlabID, $projectID, $objectType, $object);
|
||||
if(isset($label->name)) $issue->labels = $label->name;
|
||||
|
||||
foreach($this->config->gitlab->skippedFields->issueCreate[$objectType] as $field)
|
||||
{
|
||||
if(isset($issue->$field)) unset($issue->$field);
|
||||
|
||||
+26
-3
@@ -341,8 +341,7 @@ class storyModel extends model
|
||||
|
||||
/* push this story to gitlab issue */
|
||||
$object = $this->getByID($storyID);
|
||||
$issue = $this->loadModel('gitlab')->parseObjectToIssue($this->post->gitlab, $this->post->gitlabProject, 'story', $object);
|
||||
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject, $issue, 'story', $storyID, $object);
|
||||
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject, 'story', $storyID, $object);
|
||||
|
||||
return array('status' => 'created', 'id' => $storyID);
|
||||
}
|
||||
@@ -1168,6 +1167,18 @@ class storyModel extends model
|
||||
/* Update story sort of plan when story plan has changed. */
|
||||
if($oldStory->plan != $story->plan) $this->updateStoryOrderOfPlan($storyID, $story->plan, $oldStory->plan);
|
||||
|
||||
/* update story to gitlab issue. */
|
||||
$object = $this->getByID($storyID);
|
||||
|
||||
if(!empty($object))
|
||||
{
|
||||
$relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID);
|
||||
if($relation)
|
||||
{
|
||||
if(!empty($object)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $object);
|
||||
}
|
||||
}
|
||||
|
||||
$this->executeHooks($storyID);
|
||||
if($story->type == 'story') $this->batchChangeStage(array($storyID), $story->stage);
|
||||
if($story->closedReason == 'done') $this->loadModel('score')->create('story', 'close');
|
||||
@@ -1440,7 +1451,6 @@ class storyModel extends model
|
||||
|
||||
if(!empty($relation))
|
||||
{
|
||||
$singleIssue = new stdclass();
|
||||
$singleIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->issueID);
|
||||
|
||||
if($singleIssue->state != 'closed')
|
||||
@@ -1515,6 +1525,19 @@ class storyModel extends model
|
||||
if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent);
|
||||
$this->setStage($storyID);
|
||||
$allChanges[$storyID] = common::createChanges($oldStory, $story);
|
||||
|
||||
$object = $this->getByID($storyID);
|
||||
$relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID);
|
||||
|
||||
if(!empty($relation))
|
||||
{
|
||||
$singleIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->issueID);
|
||||
|
||||
if($singleIssue->state != 'closed')
|
||||
{
|
||||
if(!empty($object)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $object);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -124,8 +124,7 @@ class taskModel extends model
|
||||
/* Sync this task to gitlab issue. */
|
||||
|
||||
$object = $this->getByID($taskID);
|
||||
$issue = $this->loadModel('gitlab')->parseObjectToIssue($this->post->gitlab, $this->post->gitlabProject, 'task', $object);
|
||||
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject, $issue, 'task', $taskID, $object);
|
||||
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject, 'task', $taskID, $object);
|
||||
|
||||
/* Mark design version.*/
|
||||
if(isset($task->design) && !empty($task->design))
|
||||
@@ -386,8 +385,7 @@ class taskModel extends model
|
||||
|
||||
/* Sync this task to gitlab issue. */
|
||||
$object = $this->getByID($taskID);
|
||||
$issue = $this->loadModel('gitlab')->parseObjectToIssue($this->post->gitlab, $this->post->gitlabProject, 'task', $object);
|
||||
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject, $issue, 'task', $taskID, $object);
|
||||
$this->loadModel('gitlab')->apiCreateIssue($this->post->gitlab, $this->post->gitlabProject,'task', $taskID, $object);
|
||||
|
||||
$taskSpec = new stdClass();
|
||||
$taskSpec->task = $taskID;
|
||||
|
||||
Reference in New Issue
Block a user