* fix error and adjust build code.

This commit is contained in:
wangyidong
2015-11-13 11:12:41 +08:00
parent d12d84f950
commit e703770075
3 changed files with 10 additions and 3 deletions

View File

@@ -106,7 +106,8 @@ class build extends control
$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->product = isset($productGroups[$build->product]) ? $productGroups[$build->product] : '';
$this->view->branches = (isset($productGroups[$build->product]) and $productGroups[$build->product]->type == '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;

View File

@@ -28,7 +28,13 @@
<td class='w-p25-f'>
<div class='input-group'>
<?php echo html::select('product', $products, $build->product, "onchange='loadBranches(this.value);' class='form-control chosen'");?>
<?php if($build->productType != 'normal') echo html::select('branch', $branches, $build->branch, "class='form-control' style='width:100px'");?>
<?php
if($build->productType != 'normal')
{
if($product->branch) $branches = array($product->branch => $branches[$product->branch]);
echo html::select('branch', $branches, $build->branch, "class='form-control' style='width:100px'");
}
?>
</div>
</td><td></td>
</tr>

View File

@@ -1134,7 +1134,7 @@ class storyModel extends model
*/
public function getByField($productID, $branch, $fieldName, $fieldValue, $orderBy, $pager, $operator = 'equal')
{
if(!$this->loadModel('common')->checkField(TABLE_STORY, $type)) return array();
if(!$this->loadModel('common')->checkField(TABLE_STORY, $fieldName)) return array();
$stories = $this->dao->select('*')->from(TABLE_STORY)
->where('product')->in($productID)
->andWhere('deleted')->eq(0)