Merge remote-tracking branch 'origin/release-20.0'
This commit is contained in:
@@ -17,7 +17,7 @@ $config->build->form->create['builds'] = array('type' => 'array', 'r
|
||||
$config->build->form->create['bugs'] = array('type' => 'string', 'required' => false, 'default' => '');
|
||||
$config->build->form->create['stories'] = array('type' => 'string', 'required' => false, 'default' => '');
|
||||
$config->build->form->create['date'] = array('type' => 'date', 'required' => true, 'default' => helper::today());
|
||||
$config->build->form->create['createdBy'] = array('type' => 'string', 'required' => false, 'default' => $app->user->account);
|
||||
$config->build->form->create['createdBy'] = array('type' => 'string', 'required' => false, 'default' => '');
|
||||
$config->build->form->create['createdDate'] = array('type' => 'datetime ', 'required' => false, 'default' => $now);
|
||||
|
||||
$config->build->form->edit['execution'] = array('type' => 'int', 'required' => $app->tab == 'execution', 'default' => 0);
|
||||
|
||||
@@ -49,7 +49,7 @@ class build extends control
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$build = form::data()->get();
|
||||
$build = form::data()->setDefault('createdBy', $this->app->user->account)->get();
|
||||
if(!empty($_FILES['buildFiles'])) $_FILES['files'] = $_FILES['buildFiles'];
|
||||
unset($_FILES['buildFiles']);
|
||||
if(dao::isError()) return $this->sendError(dao::getError());
|
||||
|
||||
+39
-24
@@ -263,30 +263,8 @@ class buildModel extends model
|
||||
/* if the build has been released and replace is true, replace build name with release name. */
|
||||
if($replace)
|
||||
{
|
||||
$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('t1.product')->in($productIdList)
|
||||
->beginIF(!empty($buildIdList))->andWhere('t2.id')->in($buildIdList)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t1.shadow')->ne(0)
|
||||
->fetchAll('id');
|
||||
|
||||
/* Get the buildID under the shadow product. */
|
||||
$shadows = $this->dao->select('shadow')->from(TABLE_RELEASE)->where('product')->in($productIdList)->fetchPairs('shadow', 'shadow');
|
||||
if($shadows)
|
||||
{
|
||||
/* Append releases of only shadow and not link build. */
|
||||
$releases += $this->dao->select('t1.id,t1.shadow,t1.product,t1.branch,t1.build,t1.name,t1.date,t2.name as branchName,t3.type as productType')->from(TABLE_RELEASE)->alias('t1')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t2')->on('FIND_IN_SET(t2.id, t1.branch)')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product=t3.id')
|
||||
->where('t1.shadow')->in($shadows)
|
||||
->andWhere('t1.build')->eq(0)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
}
|
||||
$builds = $this->replaceNameWithRelease($allBuilds, $builds, $releases, $branch, $params, $excludedReleaseIdList);
|
||||
$releases = $this->getRelatedReleases($productIdList, $buildIdList, $shadows);
|
||||
$builds = $this->replaceNameWithRelease($allBuilds, $builds, $releases, $branch, $params, $excludedReleaseIdList);
|
||||
}
|
||||
|
||||
krsort($builds);
|
||||
@@ -409,6 +387,43 @@ class buildModel extends model
|
||||
return $builds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关联的发布。
|
||||
* Get releated release.
|
||||
*
|
||||
* @param array|int $productIdList
|
||||
* @param string $buildIdList
|
||||
* @param array|bool $shadows
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getRelatedReleases(array|int $productIdList, string $buildIdList = '', array|bool $shadows = false): array
|
||||
{
|
||||
$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('t1.product')->in($productIdList)
|
||||
->beginIF(!empty($buildIdList))->andWhere('t2.id')->in($buildIdList)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t1.shadow')->ne(0)
|
||||
->fetchAll('id');
|
||||
|
||||
if($shadows === false) $shadows = $this->dao->select('shadow')->from(TABLE_RELEASE)->where('product')->in($productIdList)->fetchPairs('shadow', 'shadow'); // Get the buildID under the shadow product.
|
||||
if($shadows)
|
||||
{
|
||||
/* Append releases of only shadow and not link build. */
|
||||
$releases += $this->dao->select('t1.id,t1.shadow,t1.product,t1.branch,t1.build,t1.name,t1.date,t2.name as branchName,t3.type as productType')->from(TABLE_RELEASE)->alias('t1')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t2')->on('FIND_IN_SET(t2.id, t1.branch)')
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product=t3.id')
|
||||
->where('t1.shadow')->in($shadows)
|
||||
->andWhere('t1.build')->eq(0)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
}
|
||||
return $releases;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最后一次创建的版本信息。
|
||||
* Get the last build.
|
||||
|
||||
Reference in New Issue
Block a user