diff --git a/module/branch/css/manage.css b/module/branch/css/manage.css index 35334b5a45..171db9731a 100644 --- a/module/branch/css/manage.css +++ b/module/branch/css/manage.css @@ -2,6 +2,8 @@ .c-order {width: 70px;} .c-check {width: 40px} +a.setDefault {padding-left: 8px !important} + td.flex {display: flex; flex-flow: row nowrap; justify-content: flex-start; align-items: center;} td.flex .label-primary {min-width: 40px;} td.flex .setDefault {min-width: 120px;} diff --git a/module/branch/view/manage.html.php b/module/branch/view/manage.html.php index 4f90fae36a..16cc1bf75a 100644 --- a/module/branch/view/manage.html.php +++ b/module/branch/view/manage.html.php @@ -86,7 +86,7 @@ elseif($branch->status == 'active') { $setDefaultLink = helper::createLink('branch', 'setDefault', "productID=$productID&branchID=$branch->id", '', true); - $setDefaultHtml = html::a($setDefaultLink, " {$lang->branch->setDefault}", 'hiddenwin', "class='btn btn-icon-left btn-sm setDefault hidden'"); + $setDefaultHtml = html::a($setDefaultLink, " {$lang->branch->setDefault}", 'hiddenwin', "class='btn btn-icon-left btn-sm setDefault hidden'"); echo common::hasPriv('branch', 'setDefault') ? $setDefaultHtml : ''; } diff --git a/module/build/control.php b/module/build/control.php index 292221e7f0..84d090749c 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -66,25 +66,21 @@ class build extends control $productGroups = $this->execution->getProducts($executionID); $productID = $productID ? $productID : key($productGroups); $branchGroups = $this->loadModel('project')->getBranchesByProject($executionID); - $branchPairs = $this->loadModel('branch')->getPairs($productID, 'active'); + $branchPairs = $this->loadModel('branch')->getPairs($productID); $branches = array(); $products = array(); - foreach($productGroups as $product) + + /* Set branches and products. */ + if($productGroups[$productID]->type != 'normal' and isset($branchGroups[$productID])) { - $products[$product->id] = $product->name; - if(isset($productGroups[$productID]) and $productGroups[$productID]->type != 'normal') + foreach($branchGroups[$productID] as $branchID => $branch) { - $branches[$product->id] = array(); - if(isset($branchGroups[$product->id])) - { - foreach($branchGroups[$product->id] as $branchID => $branch) - { - $branches[$product->id][$branchID] = $branchPairs[$branchID]; - } - } + $branches[$branchID] = $branchPairs[$branchID]; } } + foreach($productGroups as $product) $products[$product->id] = $product->name; + $this->view->title = $this->lang->build->create; $this->view->position[] = $this->lang->build->create; @@ -165,27 +161,22 @@ class build extends control $productGroups[$build->product] = $product; } - $products = array(); $branchGroups = $this->loadModel('project')->getBranchesByProject($build->execution); - $branchPairs = $this->loadModel('branch')->getPairs($build->product, 'active'); + $branchPairs = $this->loadModel('branch')->getPairs($build->product); + $products = array(); $branches = array(); - foreach($productGroups as $product) + /* Set branches and products. */ + if($productGroups[$build->product]->type != 'normal' and isset($branchGroups[$build->product])) { - $products[$product->id] = $product->name; - if(isset($productGroups[$build->product]) and $productGroups[$build->product]->type != 'normal') + foreach($branchGroups[$build->product] as $branchID => $branch) { - $branches[$product->id] = array(); - if(isset($branchGroups[$product->id])) - { - foreach($branchGroups[$product->id] as $branchID => $branch) - { - $branches[$product->id][$branchID] = $branchPairs[$branchID]; - } - } + $branches[$branchID] = $branchPairs[$branchID]; } } + 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; diff --git a/module/build/model.php b/module/build/model.php index 8a556bf792..605d0f6200 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -379,7 +379,7 @@ class buildModel extends model $buildID = (int)$buildID; $oldBuild = $this->dao->select('*')->from(TABLE_BUILD)->where('id')->eq($buildID)->fetch(); $build = fixer::input('post')->stripTags($this->config->build->editor->edit['id'], $this->config->allowedTags) - ->setIF($this->post->branch === '', 'branch', $oldBuild->branch) + ->setIF(!isset($this->post->branch), 'branch', $oldBuild->branch) ->setDefault('product', $oldBuild->product) ->cleanInt('product,branch,execution') ->remove('allchecker,resolvedBy,files,labels,uid') diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index 0c1d6bb3cf..f724bac973 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -32,9 +32,8 @@