* Rename saveRelation.
This commit is contained in:
@@ -7,6 +7,9 @@ $config->gitlab->edit->requiredFields = 'name,url,token';
|
||||
|
||||
$config->gitlab->zentaoLabel = 'Zentao';
|
||||
|
||||
$config->gitlab->actions = array();
|
||||
$config->gitlab->actions['issue'] = array();
|
||||
|
||||
$config->gitlab->taskLabel = new stdclass();
|
||||
$config->gitlab->taskLabel->name = "zentao task";
|
||||
$config->gitlab->taskLabel->description = "task label from zentao, do NOT remove this";
|
||||
@@ -27,3 +30,24 @@ $config->gitlab->storyLabel->priority = "0";
|
||||
|
||||
$config->gitlab->zentaoApiWebhookUrl = "%s/api.php?m=gitlab&f=webhook&product=%s&gitlab=%s";
|
||||
$config->gitlab->zentaoApiWebhookToken = "<access token>";
|
||||
|
||||
$config->gitlab->maps = new stdclass;
|
||||
$config->gitlab->maps->task = array();
|
||||
$config->gitlab->maps->task['execution'] = 'execution';
|
||||
$config->gitlab->maps->task['name'] = 'title';
|
||||
$config->gitlab->maps->task['desc'] = 'description';
|
||||
$config->gitlab->maps->task['deadline'] = 'due_date';
|
||||
|
||||
$config->gitlab->maps->task['openedBy'] = 'due_date';
|
||||
$config->gitlab->maps->task['openedDate'] = 'created_at';
|
||||
$config->gitlab->maps->task['assignedTo'] = 'due_date';
|
||||
$config->gitlab->maps->task['closedBy'] = 'due_date';
|
||||
$config->gitlab->maps->task['closedDate'] = 'due_date';
|
||||
$config->gitlab->maps->task['finishedDate'] = 'closed_at';
|
||||
$config->gitlab->maps->task['lastEditedDate'] = 'last_edited_at';
|
||||
$config->gitlab->maps->task['deadline'] = 'due_date';
|
||||
|
||||
$config->gitlab->issueOptions = new stdclass;
|
||||
$config->gitlab->issueOptions->task['type'] = 'devel';
|
||||
$config->gitlab->issueOptions->task['pri'] = '3';
|
||||
$config->gitlab->issueOptions->task['status'] = array();
|
||||
|
||||
+26
-32
@@ -232,28 +232,26 @@ class gitlabModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createAssociat($products, $gitlabID, $gitlabProjectID)
|
||||
public function saveRelation($products, $gitlabID, $gitlabProjectID)
|
||||
{
|
||||
$productIDs = $this->dao->select('id,program')->from(TABLE_PRODUCT)->fetchAll();
|
||||
$programs = $this->dao->select('id,program')->from(TABLE_PRODUCT)->where('id')->in($products)->fetchPairs();
|
||||
|
||||
$projectID = array();
|
||||
foreach($productIDs as $project) $projectID[$project->id] = $project->program;
|
||||
$relation = new stdclass;
|
||||
$relation->execution = 0;
|
||||
$relation->AType = 'gitlab';
|
||||
$relation->AID = $gitlabID;
|
||||
$relation->AVersion = '';
|
||||
$relation->relation = 'interrated';
|
||||
$relation->BType = 'gitlabProject';
|
||||
$relation->BID = $gitlabProjectID;
|
||||
$relation->BVersion = '';
|
||||
$relation->extra = '';
|
||||
|
||||
$gitlabAssociat = new stdclass;
|
||||
$gitlabAssociat->execution = 0;
|
||||
$gitlabAssociat->AVersion = 0;
|
||||
$gitlabAssociat->relation = 'interrated';
|
||||
$gitlabAssociat->BVersion = 0;
|
||||
$gitlabAssociat->extra = 0;
|
||||
$gitlabAssociat->BID = $gitlabID;
|
||||
|
||||
foreach($products as $index => $prodcut)
|
||||
foreach($products as $product)
|
||||
{
|
||||
$gitlabAssociat->BType = $this->getprojectpairs($gitlabID)[$gitlabProjectID];
|
||||
$gitlabAssociat->Project = $projectID[$prodcut];
|
||||
$gitlabAssociat->Product = $prodcut;
|
||||
|
||||
$this->dao->replace(TABLE_RELATION)->data($gitlabAssociat)->exec();
|
||||
$relation->project = zget($programs, $product, 0);
|
||||
$relation->product = $product;
|
||||
$this->dao->replace(TABLE_RELATION)->data($relation)->exec();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -567,12 +565,10 @@ class gitlabModel extends model
|
||||
|
||||
public function parseIssueWebhook($body)
|
||||
{
|
||||
$request = new stdclass;
|
||||
$request->type = $body->object_kind;
|
||||
$issue = $body->object_attributes;
|
||||
|
||||
$request->labels = $body->labels;
|
||||
$request->project = $body->project->id;
|
||||
$issue = new stdclass;
|
||||
$issue->action = $body->object_attributes->action . $body->object_kind;
|
||||
$issue->issue = $body->object_attributes;
|
||||
$object = $this->parseObjectFromLabels($issue->labels);
|
||||
}
|
||||
|
||||
public function parseNoteWebhook($body)
|
||||
@@ -659,13 +655,11 @@ class gitlabModel extends model
|
||||
*/
|
||||
public function getAccountName($gitlabID, $userID)
|
||||
{
|
||||
$account = $this->dao->select("account")
|
||||
->from(TABLE_OAUTH)
|
||||
->where('providerType')->eq('gitlab')
|
||||
->andwhere('providerID')->eq($gitlabID)
|
||||
->andwhere('openID')->eq($userID)
|
||||
->fetch();
|
||||
if(!dao::isError()) return $account->account;
|
||||
return false;
|
||||
return $this->dao->select("account")
|
||||
->from(TABLE_OAUTH)
|
||||
->where('providerType')->eq('gitlab')
|
||||
->andwhere('providerID')->eq($gitlabID)
|
||||
->andwhere('openID')->eq($userID)
|
||||
->fetch('account');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user