From c0e1f91e9a4cb720d6c145e46cc68e707b632fe2 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Thu, 23 Dec 2021 09:29:34 +0800 Subject: [PATCH] *Finish task #46100. --- module/build/control.php | 30 +++++++++++---------------- module/build/view/edit.html.php | 2 +- module/productplan/view/view.html.php | 2 +- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index 4dd0b32a2f..4433ef29cf 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -169,29 +169,23 @@ class build extends control $productGroups[$build->product] = $product; } - $branchGroups = $this->loadModel('project')->getBranchesByProject($build->execution); - $branchPairs = $this->loadModel('branch')->getPairs($build->product); - $products = array(); - $branches = array(); - - /* Set branches and products. */ - if($productGroups[$build->product]->type != 'normal' and isset($branchGroups[$build->product])) + /* Display status of branch. */ + $branches = $this->loadModel('branch')->getList($build->product, $build->execution, 'all'); + $branchTagOption = array(); + foreach($branches as $branchInfo) { - foreach($branchGroups[$build->product] as $branchID => $branch) - { - $branches[$branchID] = $branchPairs[$branchID]; - } + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); } foreach($productGroups as $product) $products[$product->id] = $product->name; - $this->view->title = $execution->name . $this->lang->colon . $this->lang->build->edit; - $this->view->position[] = html::a($this->createLink('execution', 'task', "executionID=$build->execution"), $execution->name); - $this->view->position[] = $this->lang->build->edit; - $this->view->product = isset($productGroups[$build->product]) ? $productGroups[$build->product] : ''; - $this->view->branches = $branches; - $this->view->executions = $executions; - $this->view->orderBy = $orderBy; + $this->view->title = $execution->name . $this->lang->colon . $this->lang->build->edit; + $this->view->position[] = html::a($this->createLink('execution', 'task', "executionID=$build->execution"), $execution->name); + $this->view->position[] = $this->lang->build->edit; + $this->view->product = isset($productGroups[$build->product]) ? $productGroups[$build->product] : ''; + $this->view->branchTagOption = $branchTagOption; + $this->view->executions = $executions; + $this->view->orderBy = $orderBy; $this->view->productGroups = $productGroups; $this->view->products = $products; diff --git a/module/build/view/edit.html.php b/module/build/view/edit.html.php index 1426cbe396..7745491568 100644 --- a/module/build/view/edit.html.php +++ b/module/build/view/edit.html.php @@ -35,7 +35,7 @@ productType != 'normal') { - echo "" . html::select('branch', $branches, $build->branch, "class='form-control chosen' $disabled"); + echo "" . html::select('branch', $branchTagOption, $build->branch, "class='form-control chosen' $disabled"); } ?> diff --git a/module/productplan/view/view.html.php b/module/productplan/view/view.html.php index 142eaa38fc..295a0f78e3 100644 --- a/module/productplan/view/view.html.php +++ b/module/productplan/view/view.html.php @@ -27,7 +27,7 @@
id;?> title;?> - type !== 'normal') echo "" . $branches[$branch] . '';?> + type !== 'normal') echo "" . $branchOption[$branch] . '';?> begin == '2030-01-01' || $plan->end == '2030-01-01') ? $lang->productplan->future : $plan->begin . '~' . $plan->end;?>