* [task#125051,done,4h,3h] change the design of the submitted list to related.
This commit is contained in:
@@ -2085,4 +2085,62 @@ class bugModel extends model
|
||||
foreach($branches as $branchID => $branchName) $modules += $this->tree->getOptionMenu($productID, 'bug', 0, (string)$branchID);
|
||||
return $modules;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新Bug关联的代码提交记录。
|
||||
* Update the commit logs linked with the bugs.
|
||||
*
|
||||
* @param int $bugID
|
||||
* @param int $repoID
|
||||
* @param array $revisions
|
||||
* @access protected
|
||||
* @return bool
|
||||
*/
|
||||
public function updateLinkedCommits(int $bugID, int $repoID, array $revisions): bool
|
||||
{
|
||||
if(!$bugID || !$repoID || empty($revisions)) return true;
|
||||
$bug = $this->dao->select('product')->from(TABLE_BUG)->where('id')->eq($bugID)->fetch();
|
||||
if(!$bug) return true;
|
||||
foreach($revisions as $revision)
|
||||
{
|
||||
$data = new stdclass();
|
||||
$data->project = $bug->project;
|
||||
$data->product = $bug->product;
|
||||
$data->AType = 'bug';
|
||||
$data->AID = $bugID;
|
||||
$data->BType = 'commit';
|
||||
$data->BID = $revision;
|
||||
$data->relation = 'completedin';
|
||||
$data->extra = $repoID;
|
||||
$this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec();
|
||||
|
||||
$data->AType = 'commit';
|
||||
$data->AID = $revision;
|
||||
$data->BType = 'bug';
|
||||
$data->BID = $bugID;
|
||||
$data->relation = 'completedfrom';
|
||||
$this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec();
|
||||
}
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Bug关联的提交数据。
|
||||
* Get the commit data for the associated bugs
|
||||
* @param int $repoID
|
||||
* @param array $revisions
|
||||
* @access protected
|
||||
* @return bool
|
||||
*/
|
||||
public function getLinkedCommits(int $repoID, array $revisions): array
|
||||
{
|
||||
return $this->dao->select('h.revision,b.id AS id,b.title AS title')
|
||||
->from(TABLE_REPOHISTORY)->alias('h')
|
||||
->leftJoin(TABLE_RELATION)->alias('r')->on('r.relation="completedin" and r.BType="commit" and r.BID=h.id')
|
||||
->leftJoin(TABLE_BUG)->alias('b')->on('r.AType="bug" and r.AID=b.id')
|
||||
->where('h.revision')->in($revisions)
|
||||
->andWhere('h.repo')->eq($repoID)
|
||||
->andWhere('b.id')->ne('')
|
||||
->fetchGroup('revision', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,4 +413,25 @@ class designModel extends model
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_REPOHISTORY)->where('id')->eq($revisionID)->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设计关联的提交数据。
|
||||
* Get the commit data for the associated designs
|
||||
* @param int $repoID
|
||||
* @param array $revisions
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function getLinkedCommits(int $repoID, array $revisions): array
|
||||
{
|
||||
return $this->dao->select('h.revision,d.id AS id,d.name AS title')
|
||||
->from(TABLE_REPOHISTORY)->alias('h')
|
||||
->leftJoin(TABLE_RELATION)->alias('r')->on('r.relation="completedin" and r.BType="commit" and r.BID=h.id')
|
||||
->leftJoin(TABLE_DESIGN)->alias('d')->on('r.AType="design" and r.AID=d.id')
|
||||
->where('h.revision')->in($revisions)
|
||||
->andWhere('h.repo')->eq($repoID)
|
||||
->andWhere('d.id')->ne('')
|
||||
->orderBy('id')
|
||||
->fetchGroup('revision', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +156,11 @@ $config->repo->logDtable->fieldList['date']['width'] = '160';
|
||||
$config->repo->logDtable->fieldList['committer']['name'] = 'committer';
|
||||
$config->repo->logDtable->fieldList['committer']['width'] = '160';
|
||||
|
||||
$config->repo->logDtable->fieldList['design']['name'] = 'designName';
|
||||
$config->repo->logDtable->fieldList['design']['type'] = 'html';
|
||||
$config->repo->logDtable->fieldList['design']['width'] = '450';
|
||||
$config->repo->logDtable->fieldList['design']['title'] = $lang->repo->design;
|
||||
|
||||
$config->repo->logDtable->fieldList['comment']['type'] = 'html';
|
||||
$config->repo->logDtable->fieldList['comment']['width'] = '400';
|
||||
|
||||
|
||||
@@ -583,6 +583,47 @@ class repo extends control
|
||||
$query = $browseType == 'bysearch' ? $this->repoZen->getSearchForm($queryID, !in_array($repo->SCM, $this->config->repo->notSyncSCM)) : null;
|
||||
$logs = $this->repo->getCommits($repo, $entry, $branchID, 'dir', $pager, '', '', $query);
|
||||
|
||||
$revisionIds = array_column($logs, 'revision');
|
||||
|
||||
$stories = $this->loadModel('story')->getLinkedCommits($repoID, $revisionIds);
|
||||
$designs = $this->loadModel('design')->getLinkedCommits($repoID, $revisionIds);
|
||||
$tasks = $this->loadModel('task')->getLinkedCommits($repoID, $revisionIds);
|
||||
$bugs = $this->loadModel('bug')->getLinkedCommits($repoID, $revisionIds);
|
||||
foreach($logs as $logItem)
|
||||
{
|
||||
if(!empty($designs[$logItem->revision]))
|
||||
{
|
||||
foreach($designs[$logItem->revision] as $item) $item->url = !empty($item->id) ?
|
||||
$this->createLink('design', 'view','designID=' . $item->id) :
|
||||
'';
|
||||
$logItem->relations['designs'] = $designs[$logItem->revision];
|
||||
}
|
||||
|
||||
if(!empty($stories[$logItem->revision]))
|
||||
{
|
||||
foreach($stories[$logItem->revision] as $item) $item->url = !empty($item->id) ?
|
||||
$this->createLink('story', 'view','storyID=' . $item->id) :
|
||||
'';
|
||||
$logItem->relations['stroies'] = $stories[$logItem->revision];
|
||||
}
|
||||
|
||||
if(!empty($tasks[$logItem->revision]))
|
||||
{
|
||||
foreach($tasks[$logItem->revision] as $item) $item->url = !empty($item->id) ?
|
||||
$this->createLink('task', 'view','taskID=' . $item->id) :
|
||||
'';
|
||||
$logItem->relations['tasks'] = $tasks[$logItem->revision];
|
||||
}
|
||||
|
||||
if(!empty($bugs[$logItem->revision]))
|
||||
{
|
||||
foreach($bugs[$logItem->revision] as $item) $item->url = !empty($item->id) ?
|
||||
$this->createLink('bug', 'view','bugID=' . $item->id) :
|
||||
'';
|
||||
$logItem->relations['bugs'] = $bugs[$logItem->revision];
|
||||
}
|
||||
}
|
||||
|
||||
$this->view->repo = $repo;
|
||||
$this->view->title = $this->lang->repo->common;
|
||||
$this->view->logs = $logs;
|
||||
|
||||
@@ -147,6 +147,8 @@ $lang->repo->lastCommitter = 'committer';
|
||||
$lang->repo->lastUpdateTime = 'Last update time';
|
||||
$lang->repo->createdBy = 'Created by';
|
||||
$lang->repo->sourceCommit = 'Source Commit';
|
||||
$lang->repo->design = 'Design';
|
||||
$lang->repo->story = 'Story';
|
||||
|
||||
$lang->repo->title = 'Title';
|
||||
$lang->repo->status = 'Status';
|
||||
|
||||
@@ -147,6 +147,8 @@ $lang->repo->lastCommitter = 'committer';
|
||||
$lang->repo->lastUpdateTime = 'Last update time';
|
||||
$lang->repo->createdBy = 'Created by';
|
||||
$lang->repo->sourceCommit = 'Source Commit';
|
||||
$lang->repo->design = 'Design';
|
||||
$lang->repo->story = 'story';
|
||||
|
||||
$lang->repo->title = 'Title';
|
||||
$lang->repo->status = 'Status';
|
||||
|
||||
@@ -147,6 +147,8 @@ $lang->repo->lastCommitter = 'committer';
|
||||
$lang->repo->lastUpdateTime = 'Last update time';
|
||||
$lang->repo->createdBy = 'Created by';
|
||||
$lang->repo->sourceCommit = 'Source Commit';
|
||||
$lang->repo->design = 'Design';
|
||||
$lang->repo->story = 'Story';
|
||||
|
||||
$lang->repo->title = 'Titre';
|
||||
$lang->repo->status = 'Statut';
|
||||
|
||||
@@ -104,7 +104,7 @@ $lang->repo->password = '密码';
|
||||
$lang->repo->encoding = '编码';
|
||||
$lang->repo->client = '客户端';
|
||||
$lang->repo->size = '大小';
|
||||
$lang->repo->revision = '查看提交';
|
||||
$lang->repo->revision = '提交';
|
||||
$lang->repo->revisionA = '提交';
|
||||
$lang->repo->revisions = '提交';
|
||||
$lang->repo->time = '提交时间';
|
||||
@@ -147,6 +147,8 @@ $lang->repo->lastCommitter = '提交人';
|
||||
$lang->repo->lastUpdateTime = '最后修改时间';
|
||||
$lang->repo->createdBy = '创建人';
|
||||
$lang->repo->sourceCommit = '来源提交';
|
||||
$lang->repo->design = '相关设计';
|
||||
$lang->repo->story = '需求';
|
||||
|
||||
$lang->repo->title = '标题';
|
||||
$lang->repo->status = '状态';
|
||||
|
||||
+26
-1
@@ -1882,8 +1882,33 @@ class repoModel extends model
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($objects['stories']) || !empty($objects['tasks']) || !empty($objects['bugs']))
|
||||
{
|
||||
$historyLog = new stdclass();
|
||||
$historyLog->committer = $log->author;
|
||||
$historyLog->revision = $log->revision;
|
||||
$historyLog->comment = $commit->message;
|
||||
$historyLog->time = date("Y-m-d H:i:s", strtotime($time));
|
||||
$this->saveCommit($repo->id, array('commits' => [$historyLog]), 0);
|
||||
$revisions = $this->dao->select('id')->from(TABLE_REPOHISTORY)
|
||||
->where('revision')->in([$log->revision])
|
||||
->andWhere('repo')->eq($repo->id)
|
||||
->fetchPairs('id');
|
||||
if(!empty($objects['stories']))
|
||||
{
|
||||
foreach($objects['stories'] as $storyID) $this->loadModel('story')->updateLinkedCommits((int)$storyID, $repo->id, $revisions);
|
||||
}
|
||||
if(!empty($objects['tasks']))
|
||||
{
|
||||
foreach($objects['tasks'] as $taskID) $this->loadModel('task')->updateLinkedCommits((int)$taskID, $repo->id, $revisions);
|
||||
}
|
||||
if(!empty($objects['bugs']))
|
||||
{
|
||||
foreach($objects['bugs'] as $bugID) $this->loadModel('bug')->updateLinkedCommits((int)$bugID, $repo->id, $revisions);
|
||||
}
|
||||
}
|
||||
}
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,30 @@ if($fileName) $breadcrumbItems[] = h::span($fileName);
|
||||
foreach($logs as $log)
|
||||
{
|
||||
$log->revision = substr($log->revision, 0, 10);
|
||||
$log->designName = '';
|
||||
if(!empty($log->relations['stroies']))
|
||||
{
|
||||
$log->designName .= html::commonButton($lang->repo->story , '', 'btn size-sm mx-2');
|
||||
foreach($log->relations['stroies'] as $item) $log->designName .= html::a($item->url, '#'.$item->id, '_blank');
|
||||
}
|
||||
|
||||
if(!empty($log->relations['designs']))
|
||||
{
|
||||
$log->designName .= html::commonButton($lang->design->common , '', 'btn size-sm mx-2');
|
||||
foreach($log->relations['designs'] as $item) $log->designName .= html::a($item->url, '#'.$item->id,'_blank');
|
||||
}
|
||||
|
||||
if(!empty($log->relations['tasks']))
|
||||
{
|
||||
$log->designName .= html::commonButton($lang->task->common , '', 'btn size-sm mx-2');
|
||||
foreach($log->relations['tasks'] as $item) $log->designName .= html::a($item->url, '#'.$item->id,'_blank');
|
||||
}
|
||||
|
||||
if(!empty($log->relations['bugs']))
|
||||
{
|
||||
$log->designName .= html::commonButton($lang->bug->common , '', 'btn size-sm mx-2');
|
||||
foreach($log->relations['bugs'] as $item) $log->designName .= html::a($item->url, '#'.$item->id,'_blank');
|
||||
}
|
||||
}
|
||||
|
||||
/* Disbale check all checkbox of table header */
|
||||
|
||||
@@ -5363,4 +5363,63 @@ class storyModel extends model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新需求关联的代码提交记录。
|
||||
* Update the commit logs linked with the stories.
|
||||
*
|
||||
* @param int $storyID
|
||||
* @param int $repoID
|
||||
* @param array $revisions
|
||||
* @access protected
|
||||
* @return bool
|
||||
*/
|
||||
public function updateLinkedCommits(int $storyID, int $repoID, array $revisions): bool
|
||||
{
|
||||
if(!$storyID || !$repoID || empty($revisions)) return true;
|
||||
$story = $this->dao->select('product')->from(TABLE_STORY)->where('id')->eq($storyID)->fetch();
|
||||
if(!$story) return true;
|
||||
foreach($revisions as $revision)
|
||||
{
|
||||
$data = new stdclass();
|
||||
$data->product = $story->product;
|
||||
$data->AType = 'story';
|
||||
$data->AID = $storyID;
|
||||
$data->BType = 'commit';
|
||||
$data->BID = $revision;
|
||||
$data->relation = 'completedin';
|
||||
$data->extra = $repoID;
|
||||
$this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec();
|
||||
|
||||
$data->AType = 'commit';
|
||||
$data->AID = $revision;
|
||||
$data->BType = 'story';
|
||||
$data->BID = $storyID;
|
||||
$data->relation = 'completedfrom';
|
||||
$this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec();
|
||||
}
|
||||
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取需求关联的提交数据。
|
||||
* Get the commit data for the associated stories
|
||||
* @param int $storyID
|
||||
* @param int $repoID
|
||||
* @param array $revisions
|
||||
* @access protected
|
||||
* @return bool
|
||||
*/
|
||||
public function getLinkedCommits(int $repoID, array $revisions): array
|
||||
{
|
||||
return $this->dao->select('h.revision,s.id AS id,s.title AS title')
|
||||
->from(TABLE_REPOHISTORY)->alias('h')
|
||||
->leftJoin(TABLE_RELATION)->alias('r')->on('r.relation="completedin" and r.BType="commit" and r.BID=h.id')
|
||||
->leftJoin(TABLE_STORY)->alias('s')->on('r.AType="story" and r.AID=s.id')
|
||||
->where('h.revision')->in($revisions)
|
||||
->andWhere('h.repo')->eq($repoID)
|
||||
->andWhere('s.id')->ne('')
|
||||
->fetchGroup('revision', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3279,4 +3279,61 @@ class taskModel extends model
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_TASKTEAM)->where('task')->eq($taskID)->orderBy($orderBy)->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务关联的代码提交记录。
|
||||
* Update the commit logs linked with the tasks.
|
||||
*
|
||||
* @param int $taskID
|
||||
* @param int $repoID
|
||||
* @param array $revisions
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updateLinkedCommits(int $taskID, int $repoID, array $revisions): bool
|
||||
{
|
||||
if(!$taskID || !$repoID || empty($revisions)) return true;
|
||||
$task = $this->dao->select('project')->from(TABLE_TASK)->where('id')->eq($taskID)->fetch();
|
||||
if(!$task) return true;
|
||||
foreach($revisions as $revision)
|
||||
{
|
||||
$data = new stdclass();
|
||||
$data->project = $task->project;
|
||||
$data->AType = 'task';
|
||||
$data->AID = $taskID;
|
||||
$data->BType = 'commit';
|
||||
$data->BID = $revision;
|
||||
$data->relation = 'completedin';
|
||||
$data->extra = $repoID;
|
||||
$this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec();
|
||||
|
||||
$data->AType = 'commit';
|
||||
$data->AID = $revision;
|
||||
$data->BType = 'task';
|
||||
$data->BID = $taskID;
|
||||
$data->relation = 'completedfrom';
|
||||
$this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec();
|
||||
}
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Task关联的提交数据。
|
||||
* Get the commit data for the associated bugs
|
||||
* @param int $repoID
|
||||
* @param array $revisions
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function getLinkedCommits(int $repoID, array $revisions): array
|
||||
{
|
||||
return $this->dao->select('h.revision,t.id AS id,t.name AS name')
|
||||
->from(TABLE_REPOHISTORY)->alias('h')
|
||||
->leftJoin(TABLE_RELATION)->alias('r')->on('r.relation="completedin" and r.BType="commit" and r.BID=h.id')
|
||||
->leftJoin(TABLE_TASK)->alias('t')->on('r.AType="task" and r.AID=t.id')
|
||||
->where('h.revision')->in($revisions)
|
||||
->andWhere('h.repo')->eq($repoID)
|
||||
->andWhere('t.id')->ne('')
|
||||
->fetchGroup('revision', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user