This commit is contained in:
Guan Xiying
2021-06-24 13:28:15 +08:00
4 changed files with 34 additions and 15 deletions
+25 -9
View File
@@ -56,7 +56,7 @@ class gitlabModel extends model
*/
public function getUserIdAccountPairs($gitlab)
{
return $this->dao->select('openID,account')->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andwhere('providerID')->eq($gitlab)->fetchPairs();
return $this->dao->select('openID,account')->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andWhere('providerID')->eq($gitlab)->fetchPairs();
}
/**
@@ -68,7 +68,7 @@ class gitlabModel extends model
*/
public function getUserAccountIdPairs($gitlab)
{
return $this->dao->select('account,openID')->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andwhere('providerID')->eq($gitlab)->fetchPairs();
return $this->dao->select('account,openID')->from(TABLE_OAUTH)->where('providerType')->eq('gitlab')->andWhere('providerID')->eq($gitlab)->fetchPairs();
}
/**
@@ -571,7 +571,7 @@ class gitlabModel extends model
if($syncedIssue) $issue = $this->apiUpdateIssue($gitlab, $gitlabProject, $syncedIssue, $issue);
$issue = $this->apiCreateIssue($gitlab, $gitlabProject, $issue);
$this->saveSyncedIssue('task', $taskID, $gitlab, $issue);
$this->saveSyncedIssue('task', $task, $gitlab, $issue);
}
/**
@@ -819,11 +819,27 @@ class gitlabModel extends model
*/
public function getAccount($gitlabID, $userID)
{
return $this->dao->select('account')
->from(TABLE_OAUTH)
->where('providerType')->eq('gitlab')
->andwhere('providerID')->eq($gitlabID)
->andwhere('openID')->eq($userID)
->fetch('account');
return $this->dao->select('account')->from(TABLE_OAUTH)
->where('providerType')->eq('gitlab')
->andWhere('providerID')->eq($gitlabID)
->andWhere('openID')->eq($userID)
->fetch('account');
}
/**
* Get gitlab issue from relation by object type and id.
*
* @param string $objectType
* @param int $objectID
* @access public
* @return object
*/
public function getGitlabIssueFromRelation($objectType,$objectID)
{
return $this->dao->select('extra as gitlabID,BVersion as projectID,BID as issueID,AType,AID')->from(TABLE_RELATION)
->where('relation')->eq('gitlab')
->andWhere('AType')->eq($objectType)
->andWhere('AID')->eq($objectID)
->fetch();
}
}
+4 -4
View File
@@ -1113,16 +1113,16 @@ class repo extends control
* @access public
* @return void
*/
public function ajaxGetGitlabProjects($host, $projectIdList)
public function ajaxGetGitlabProjects($host, $projectIdList = '')
{
$projects = $this->loadModel('gitlab')->apiGetProjects($host);
if(!$projects) $this->send(array('message' => array()));
$projectIdList = explode(',', $projectIdList);
$projectIdList = $projectIdList ? explode(',', $projectIdList) : null;
$options = "<option value=''></option>";
foreach($projects as $project)
{
if($project and !in_array($project->id, $projectIdList)) continue;
if(!empty($projectIdList) and $project and !in_array($project->id, $projectIdList)) continue;
$options .= "<option value='{$project->id}' data-name='{$project->name}'>{$project->name_with_namespace}</option>";
}
die($options);
+2
View File
@@ -92,6 +92,8 @@ class task extends control
setcookie('lastTaskModule', (int)$this->post->module, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, false);
if($this->post->execution) $executionID = (int)$this->post->execution;
/* Create task here. */
$tasksID = $this->task->create($executionID);
if(dao::isError())
{
+3 -2
View File
@@ -22,6 +22,7 @@ class taskModel extends model
*/
public function create($executionID)
{
if($this->post->estimate < 0)
{
dao::$errors[] = $this->lang->task->error->recordMinus;
@@ -67,7 +68,7 @@ class taskModel extends model
->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync')
->add('version', 1)
->get();
if($task->type != 'test') $this->post->set('selectTestStory', 0);
foreach($this->post->assignedTo as $assignedTo)
@@ -109,7 +110,7 @@ class taskModel extends model
/* Fix Bug #2466 */
if($this->post->multiple) $task->assignedTo = '';
$this->dao->insert(TABLE_TASK)->data($task)
$this->dao->insert(TABLE_TASK)->data($task, $skip = 'gitlab,gitlabProject')
->autoCheck()
->batchCheck($requiredFields, 'notempty')
->checkIF($task->estimate != '', 'estimate', 'float')