Files
EasySoft-ZenTaoPMS/module/execution/zen.php
T

56 lines
1.9 KiB
PHP

<?php
declare(strict_types=1);
/**
* The zen file of execution module of ZenTaoPMS.
*
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Shujie Tian<tianshujie@easycorp.ltd>
* @package xxx
* @link https://www.zentao.net
*/
class executionZen extends execution
{
/**
* 处理版本列表展示数据。
* Process build list display data.
*
* @param array $buildList
* @param string $executionID
* @access protected
* @return object[]
*/
protected function processBuildListData(array $buildList, int $executionID = 0): array
{
$this->loadModel('build');
$productIdList = array();
foreach($buildList as $build) $productIdList[$build->product] = $build->product;
/* Get branch name. */
$showBranch = false;
$branchGroups = $this->loadModel('branch')->getByProducts($productIdList);
foreach($buildList as $build)
{
$build->branchName = '';
if(isset($branchGroups[$build->product]))
{
$showBranch = true;
$branchPairs = $branchGroups[$build->product];
foreach(explode(',', trim($build->branch, ',')) as $branchID)
{
if(isset($branchPairs[$branchID])) $build->branchName .= "{$branchPairs[$branchID]},";
}
$build->branchName = trim($build->branchName, ',');
}
$build->actions = $this->build->buildActionList($build, $executionID, 'execution');
}
if(!$showBranch) unset($this->config->build->dtable->fieldList['branch']);
unset($this->config->build->dtable->fieldList['execution']);
return array_values($buildList);
}
}