Merge branch 'zentaopms261_wyd' into 'master'
Zentaopms261 wyd See merge request easycorp/zentaopms!6255
This commit is contained in:
+42
-17
@@ -227,7 +227,7 @@ class buildModel extends model
|
||||
}
|
||||
|
||||
$branchs = strpos($params, 'separate') === false ? "0,$branch" : $branch;
|
||||
$allBuilds = $this->dao->select('t1.id, t1.name, t1.deleted, t2.status as objectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName, t5.type as productType')->from(TABLE_BUILD)->alias('t1')
|
||||
$allBuilds = $this->dao->select('t1.id, t1.name, t1.date, t1.deleted, t2.status as objectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName, t5.type as productType')->from(TABLE_BUILD)->alias('t1')
|
||||
->beginIF($objectType === 'execution')->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')->fi()
|
||||
->beginIF($objectType === 'project')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->fi()
|
||||
->leftJoin(TABLE_RELEASE)->alias('t3')->on("FIND_IN_SET(t1.id,t3.build)")
|
||||
@@ -243,9 +243,10 @@ class buildModel extends model
|
||||
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
|
||||
|
||||
/* Set builds and filter done executions and terminate releases. */
|
||||
$builds = array();
|
||||
$builds = array();
|
||||
$buildIdList = array();
|
||||
$this->app->loadLang('branch');
|
||||
foreach($allBuilds as $key => $build)
|
||||
foreach($allBuilds as $id => $build)
|
||||
{
|
||||
if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->objectStatus === 'done')) continue;
|
||||
if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue;
|
||||
@@ -253,32 +254,56 @@ class buildModel extends model
|
||||
if($build->deleted == 1) $build->name .= ' (' . $this->lang->build->deleted . ')';
|
||||
$branchName = $build->branchName ? $build->branchName : $this->lang->branch->main;
|
||||
|
||||
$builds[$key] = $build->name;
|
||||
if(strpos($params, 'withbranch') !== false and $build->productType != 'normal') $builds[$key] = $branchName . '/' . $builds[$key];
|
||||
$buildName = $build->name;
|
||||
if(strpos($params, 'withbranch') !== false and $build->productType != 'normal') $buildName = $branchName . '/' . $buildName;
|
||||
|
||||
$buildIdList[$id] = $id;
|
||||
$builds[$build->date][$id] = $buildName;
|
||||
}
|
||||
|
||||
if(!$builds) return $sysBuilds + $selectedBuilds;
|
||||
if(empty($builds)) return $sysBuilds + $selectedBuilds;
|
||||
|
||||
/* if the build has been released and replace is true, replace build name with release name. */
|
||||
if($replace)
|
||||
{
|
||||
$releases = $this->dao->select('build, name')->from(TABLE_RELEASE)
|
||||
->where('build')->in(array_keys($builds))
|
||||
->andWhere('product')->in($products)
|
||||
->beginIF($branch !== 'all')->andWhere('branch')->in("$branchs")->fi()
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs();
|
||||
foreach($releases as $buildID => $releaseName)
|
||||
$releases = $this->dao->select('t1.id,t1.shadow,t1.product,t1.branch,t1.build,t1.name,t1.date,t3.name as branchName,t4.type as productType')->from(TABLE_RELEASE)->alias('t1')
|
||||
->leftJoin(TABLE_BUILD)->alias('t2')->on('FIND_IN_SET(t2.id, t1.build)')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t3')->on('FIND_IN_SET(t3.id, t1.branch)')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t1.product=t4.id')
|
||||
->where('t2.id')->in($buildIdList)
|
||||
->andWhere('t1.product')->in($products)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t1.shadow')->ne(0)
|
||||
->fetchAll('id');
|
||||
foreach($releases as $release)
|
||||
{
|
||||
$branchName = $allBuilds[$buildID]->branchName ? $allBuilds[$buildID]->branchName : $this->lang->branch->main;
|
||||
if($allBuilds[$buildID]->productType != 'normal')
|
||||
if($branch !== 'all')
|
||||
{
|
||||
$builds[$buildID] = (strpos($params, 'withbranch') !== false ? $branchName . '/' : '') . $releaseName;
|
||||
$inBranch = false;
|
||||
foreach(explode(',', trim( $release->branch, ',')) as $branchID)
|
||||
{
|
||||
if(strpos(",{$branchs},", ",{$branchID},") !== false) $inBranch = true;
|
||||
}
|
||||
if(!$inBranch) continue;
|
||||
}
|
||||
|
||||
$releaseName = $release->name;
|
||||
$branchName = $release->branchName ? $release->branchName : $this->lang->branch->main;
|
||||
if($release->productType != 'normal') $releaseName = (strpos($params, 'withbranch') !== false ? $branchName . '/' : '') . $releaseName;
|
||||
$builds[$release->date][$release->shadow] = $releaseName;
|
||||
foreach(explode(',', trim($release->build, ',')) as $buildID)
|
||||
{
|
||||
$build = $allBuilds[$buildID];
|
||||
unset($builds[$build->date][$buildID]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sysBuilds + $builds + $selectedBuilds;
|
||||
krsort($builds);
|
||||
$buildPairs = array();
|
||||
foreach($builds as $date => $childBuilds) $buildPairs += $childBuilds;
|
||||
|
||||
return $sysBuilds + $buildPairs + $selectedBuilds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user