From e7037700751d0c200d461cc7800bce99de543240 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 13 Nov 2015 11:12:41 +0800 Subject: [PATCH] * fix error and adjust build code. --- module/build/control.php | 3 ++- module/build/view/edit.html.php | 8 +++++++- module/story/model.php | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index bbba8bca5e..93f0931ecf 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -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; diff --git a/module/build/view/edit.html.php b/module/build/view/edit.html.php index 531ac82da8..e2fa6e70dd 100644 --- a/module/build/view/edit.html.php +++ b/module/build/view/edit.html.php @@ -28,7 +28,13 @@
product, "onchange='loadBranches(this.value);' class='form-control chosen'");?> - productType != 'normal') echo html::select('branch', $branches, $build->branch, "class='form-control' style='width:100px'");?> + 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'"); + } + ?>
diff --git a/module/story/model.php b/module/story/model.php index 20440be21c..35e4e29423 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -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)