* code for task #2353.
This commit is contained in:
@@ -11,6 +11,12 @@
|
||||
*/
|
||||
class branchModel extends model
|
||||
{
|
||||
public function getById($branchID)
|
||||
{
|
||||
if(empty($branchID)) return $this->lang->branch->all;
|
||||
return $this->dao->select('*')->from(TABLE_BRANCH)->where('id')->eq($branchID)->fetch('name');
|
||||
}
|
||||
|
||||
public function getPairs($productID, $params = '')
|
||||
{
|
||||
$branches = $this->dao->select('*')->from(TABLE_BRANCH)->where('product')->eq($productID)->andWhere('deleted')->eq(0)->orderBy('id_desc')->fetchPairs('id', 'name');
|
||||
|
||||
+31
-23
@@ -39,20 +39,24 @@ class build extends control
|
||||
$orderBy = 'status_asc, stage_asc, id_desc';
|
||||
|
||||
/* Assign. */
|
||||
$project = $this->loadModel('project')->getById($projectID);
|
||||
$products = $this->project->getProducts($projectID, false);
|
||||
$product = $this->loadModel('product')->getById(key($products));
|
||||
$project = $this->loadModel('project')->getById($projectID);
|
||||
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->build->create;
|
||||
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$projectID"), $project->name);
|
||||
$this->view->position[] = $this->lang->build->create;
|
||||
$this->view->products = $products;
|
||||
$this->view->product = $product;
|
||||
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->lastBuild = $this->build->getLast($projectID);
|
||||
$this->view->users = $this->user->getPairs('nodeleted');
|
||||
$this->view->orderBy = $orderBy;
|
||||
$productGroups = $this->project->getProducts($projectID);
|
||||
$productID = key($productGroups);
|
||||
$products = array();
|
||||
foreach($productGroups as $product) $products[$product->id] = $product->name;
|
||||
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->build->create;
|
||||
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$projectID"), $project->name);
|
||||
$this->view->position[] = $this->lang->build->create;
|
||||
$this->view->productGroups = $productGroups;
|
||||
$this->view->products = $products;
|
||||
$this->view->product = $productGroups[$productID];
|
||||
$this->view->branches = $productGroups[$productID]->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->lastBuild = $this->build->getLast($projectID);
|
||||
$this->view->users = $this->user->getPairs('nodeleted');
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -91,17 +95,21 @@ class build extends control
|
||||
$orderBy = 'status_asc, stage_asc, id_desc';
|
||||
|
||||
/* Assign. */
|
||||
$project = $this->loadModel('project')->getById($build->project);
|
||||
$products = $this->project->getProducts($build->project, false);
|
||||
$project = $this->loadModel('project')->getById($build->project);
|
||||
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->build->edit;
|
||||
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$build->project"), $project->name);
|
||||
$this->view->position[] = $this->lang->build->edit;
|
||||
$this->view->products = $products;
|
||||
$this->view->branches = $build->productType == 'normal' ? array() : $this->loadModel('branch')->getPairs($build->product);
|
||||
$this->view->build = $build;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', $build->builder);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$productGroups = $this->project->getProducts($build->project);
|
||||
$products = array();
|
||||
foreach($productGroups as $product) $products[$product->id] = $product->name;
|
||||
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->build->edit;
|
||||
$this->view->position[] = html::a($this->createLink('project', 'task', "projectID=$build->project"), $project->name);
|
||||
$this->view->position[] = $this->lang->build->edit;
|
||||
$this->view->productGroups = $productGroups;
|
||||
$this->view->products = $products;
|
||||
$this->view->branches = $build->productType == 'normal' ? array() : $this->loadModel('branch')->getPairs($build->product);
|
||||
$this->view->build = $build;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', $build->builder);
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,11 @@ function loadBranches(productID)
|
||||
{
|
||||
$('#product').closest('.input-group').append(data);
|
||||
$('#branch').css('width', '100px');
|
||||
for(i in productGroups[productID]['branches'])
|
||||
{
|
||||
$('#branch').val(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<?php if($products):?>
|
||||
<div class='input-group'>
|
||||
<?php echo html::select('product', $products, $product->id, "onchange='loadBranches(this.value);' class='form-control chosen'");?>
|
||||
<?php if($product->type != 'normal') echo html::select('branch', $branches, '', "class='form-control' style='width:100px'");?>
|
||||
<?php if($product->type != 'normal') echo html::select('branch', $branches, key($product->branches), "class='form-control' style='width:100px'");?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
@@ -73,4 +73,5 @@
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php js::set('productGroups', $productGroups)?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
@@ -64,4 +64,5 @@
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<?php js::set('productGroups', $productGroups)?>
|
||||
<?php include '../../common/view/footer.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user