* Fix bug,story,task code format.

This commit is contained in:
lichengjun
2021-07-03 10:25:58 +08:00
parent 0e1f288c4b
commit 1c5aed2d76
3 changed files with 12 additions and 17 deletions
+2 -3
View File
@@ -865,11 +865,10 @@ class bugModel extends model
->where('id')->eq($bugID)->exec();
$relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID);
$attribute = new stdclass();
$attribute = $this->getByID($bugID);
$attribute->assignee_id = $this->loadModel('gitlab')->getGitlabUserID($relation->gitlabID, $bug->assignedTo);
if($attribute->assignee_id != '')
{
$attribute = $this->getByID($bugID);
// TODO(dingguodong) we should alert to operator when can not find the user, and the operator should reconfigure user binding.
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $attribute);
}
@@ -1255,7 +1254,7 @@ class bugModel extends model
if($singleIssue->state != 'closed')
{
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $object);
if(!empty($object)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $object);
}
}
return common::createChanges($oldBug, $bug);
+5 -7
View File
@@ -838,7 +838,7 @@ class storyModel extends model
$relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID);
if($relation)
{
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $object);
$if(!empty($object)) this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $object);
}
}
@@ -1435,6 +1435,7 @@ class storyModel extends model
->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty')
->where('id')->eq($storyID)->exec();
$object = $this->getByID($storyID);
$relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID);
if(!empty($relation))
@@ -1444,11 +1445,9 @@ class storyModel extends model
if($singleIssue->state != 'closed')
{
$object = $this->getByID($storyID);
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $object);
$if(!empty($object)) this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $object);
}
}
/* Update parent story status. */
if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent);
@@ -1794,11 +1793,10 @@ class storyModel extends model
if(!dao::isError())
{
$relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID);
$attribute = new stdclass();
$attribute = $this->getByID($storyID);
$attribute->assignee_id = $this->loadModel('gitlab')->getGitlabUserID($relation->gitlabID, $story->assignedTo);
if($attribute->assignee_id != '')
{
$object = $this->getByID($storyID);
// TODO(dingguodong) we should alert to operator when can not find the user, and the operator should reconfigure user binding.
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story' $attribute);
}
@@ -1841,7 +1839,7 @@ class storyModel extends model
$relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID);
if($relation)
{
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $object);
$if(!empty($object)) this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $object);
}
}
}
+5 -7
View File
@@ -958,8 +958,7 @@ class taskModel extends model
$relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID);
if($relation)
{
$object = $this->getByID($taskID);
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $object);
if(!empty($object)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $object);
}
}
@@ -1350,11 +1349,10 @@ class taskModel extends model
->where('id')->eq($taskID)->exec();
$relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID);
$attribute = new stdclass();
$attribute = $this->getByID($taskID);
$attribute->assignee_id = $this->loadModel('gitlab')->getGitlabUserID($relation->gitlabID, $task->assignedTo);
if($attribute->assignee_id != '')
{
$attribute = $this->getByID($taskID);
// TODO(dingguodong) we should alert to operator when can not find the user, and the operator should reconfigure user binding.
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, $attribute);
}
@@ -1763,6 +1761,7 @@ class taskModel extends model
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec();
$object = $this->getByID($bugID);
$relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID);
if(!empty($relation))
{
@@ -1771,7 +1770,6 @@ class taskModel extends model
if($singleIssue->state != 'closed')
{
$object = $this->getByID($bugID);
if(!empty($object)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $object);
}
}
@@ -1820,6 +1818,7 @@ class taskModel extends model
}
if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story);
$object = $this->getByID($taskID);
$relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID);
if(!empty($relation))
{
@@ -1828,8 +1827,7 @@ class taskModel extends model
if($singleIssue->state != 'closed')
{
$object = $this->getByID($taskID);
$this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $object);
$if(!empty($object)) this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $object);
}
}