* Add code for gitlab.
This commit is contained in:
@@ -2233,6 +2233,7 @@ EOD;
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$errors = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
$logFile = $app->getLogRoot() . 'saas.'. date('Ymd') . '.log.php';
|
||||
|
||||
@@ -1548,7 +1548,7 @@ class executionModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProducts($executionID, $withBranch = true)
|
||||
public function getProducts($executionID, $withBranch = true, $gitlab = false)
|
||||
{
|
||||
if(defined('TUTORIAL'))
|
||||
{
|
||||
@@ -1556,12 +1556,14 @@ class executionModel extends model
|
||||
return $this->loadModel('tutorial')->getExecutionProducts();
|
||||
}
|
||||
|
||||
|
||||
$query = $this->dao->select('t2.id, t2.name, t2.type, t1.branch, t1.plan')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t2')
|
||||
->on('t1.product = t2.id')
|
||||
->where('t1.project')->eq((int)$executionID)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->products)->fi();
|
||||
if($gitlab) return implode(',' ,$query->fetchPairs('id','id'));
|
||||
if(!$withBranch) return $query->fetchPairs('id', 'name');
|
||||
return $query->fetchAll('id');
|
||||
}
|
||||
|
||||
@@ -248,6 +248,25 @@ class gitlabModel extends model
|
||||
return $gitlab_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind gitlab project.
|
||||
*
|
||||
* @param int $gitlabID
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function bindGitlabProject($executionID)
|
||||
{
|
||||
$products = $this->loadModel('execution')->getProducts($executionID, false, 'gitlab');
|
||||
|
||||
$bindGitlabAIDS = $this->dao->select('AID')->from(TABLE_RELATION)->where('product')->in($products)->fetchPairs();
|
||||
|
||||
$nameList = $this->dao->select('id,name')->from(TABLE_PIPELINE)->where('id')->in(implode(',' ,$bindGitlabAIDS))->fetchPairs();
|
||||
|
||||
return $nameList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create relationship between zentao product and gitlab project.
|
||||
*
|
||||
|
||||
@@ -172,7 +172,6 @@ class task extends control
|
||||
|
||||
$users = $this->loadModel('user')->getPairs('noclosed|nodeleted');
|
||||
$members = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted');
|
||||
$syncGitlabMembers = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted', 'gitlab');
|
||||
$showAllModule = isset($this->config->execution->task->allModule) ? $this->config->execution->task->allModule : '';
|
||||
$moduleOptionMenu = $this->tree->getTaskOptionMenu($executionID, 0, 0, $showAllModule ? 'allModule' : '');
|
||||
|
||||
@@ -211,11 +210,14 @@ class task extends control
|
||||
$position[] = html::a($taskLink, $execution->name);
|
||||
$position[] = $this->lang->task->common;
|
||||
$position[] = $this->lang->task->create;
|
||||
|
||||
|
||||
/* Set Custom*/
|
||||
foreach(explode(',', $this->config->task->customCreateFields) as $field) $customFields[$field] = $this->lang->task->$field;
|
||||
if($execution->type == 'ops') unset($customFields['story']);
|
||||
|
||||
/* */
|
||||
$this->loadModel('gitlab')->bindGitlabProject($executionID);
|
||||
|
||||
$this->view->customFields = $customFields;
|
||||
$this->view->showFields = $this->config->task->custom->createFields;
|
||||
$this->view->showAllModule = $showAllModule;
|
||||
@@ -223,7 +225,6 @@ class task extends control
|
||||
$this->view->title = $title;
|
||||
$this->view->position = $position;
|
||||
$this->view->execution = $execution;
|
||||
$this->view->syncGitlabMembers = $syncGitlabMembers;
|
||||
$this->view->executions = $this->config->systemMode == 'classic' ? $executions : $this->execution->getByProject(0, 'all', 0, true);
|
||||
$this->view->task = $task;
|
||||
$this->view->users = $users;
|
||||
|
||||
@@ -45,10 +45,6 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->sync;?></th>
|
||||
<td><?php echo html::select('sync', $syncGitlabMembers, $syncGitlabMembers->realname, "class='form-control chosen' onchange='setOwners(this.value)'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->module;?></th>
|
||||
<td id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $task->module, "class='form-control chosen' onchange='setStories(this.value, $execution->id)'");?></td>
|
||||
@@ -245,6 +241,10 @@
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->sync;?></th>
|
||||
<td><?php echo html::select('sync', '', '', "class='form-control chosen' onchange='setOwners(this.value)'");?></td>
|
||||
</tr>
|
||||
<tr id='after-tr'>
|
||||
<th><?php echo $lang->task->afterSubmit;?></th>
|
||||
<td colspan='3'><?php echo html::radio('after', $lang->task->afterChoices, !empty($task->id) ? 'toTaskList' : 'continueAdding');?></td>
|
||||
|
||||
@@ -2388,24 +2388,18 @@ class userModel extends model
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getTeamMemberPairs($objectID, $type = 'project', $params = '', $usersToAppended = '', $sync = '')
|
||||
public function getTeamMemberPairs($objectID, $type = 'project', $params = '', $usersToAppended = '')
|
||||
{
|
||||
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getTeamMembersPairs();
|
||||
|
||||
$keyField = strpos($params, 'useid') !== false ? 'id' : 'account';
|
||||
$users = $this->dao->select("t2.id, t2.account, t2.realname")->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')
|
||||
->beginIF(!empty($sync))
|
||||
->leftJoin(TABLE_OAUTH)->alias('t3')->on('t2.account = t3.account')
|
||||
->fi()
|
||||
->where('t1.root')->eq((int)$objectID)
|
||||
->andWhere('t1.type')->eq($type)
|
||||
->beginIF($params == 'nodeleted' or empty($this->config->user->showDeleted))
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->fi()
|
||||
->beginIF(!empty($sync))
|
||||
->andWhere('providerType')->eq($sync)
|
||||
->fi()
|
||||
->fetchAll($keyField);
|
||||
|
||||
if($usersToAppended) $users += $this->dao->select("id, account, realname")->from(TABLE_USER)->where('account')->in($usersToAppended)->fetchAll($keyField);
|
||||
|
||||
Reference in New Issue
Block a user