diff --git a/module/productplan/control.php b/module/productplan/control.php index 7ab604895f..d8d8f76643 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -194,15 +194,21 @@ class productplan extends control $this->commonAction($productID, $branch); - $plans = $this->productplan->getByIDList($this->post->planIDList); - $oldBranch = array(); + $plans = $this->productplan->getByIDList($this->post->planIDList); + $oldBranch = array(); + $parentIdList = array(); - foreach($plans as $plan) $oldBranch[$plan->id] = $plan->branch; + foreach($plans as $plan) + { + $oldBranch[$plan->id] = $plan->branch; + $parentIdList[$plan->parent] = $plan->parent; + } - $this->view->title = $this->lang->productplan->batchEdit; - $this->view->plans = $plans; - $this->view->oldBranch = $oldBranch; - $this->view->product = $this->loadModel('product')->getById($productID);; + $this->view->title = $this->lang->productplan->batchEdit; + $this->view->plans = $plans; + $this->view->oldBranch = $oldBranch; + $this->view->product = $this->loadModel('product')->getById($productID);; + $this->view->parentList = $this->productplan->getByIDList($parentIdList); $this->display(); } diff --git a/module/productplan/view/batchedit.html.php b/module/productplan/view/batchedit.html.php index 61021133eb..d3099683f3 100644 --- a/module/productplan/view/batchedit.html.php +++ b/module/productplan/view/batchedit.html.php @@ -43,8 +43,18 @@ id . html::hidden("id[$plan->id]", $plan->id);?> type != 'normal'):?> - parent == -1 ? "disabled='disabled'" : '';?> - id][]", $branchTagOption, $plan->branch, "onchange='getConflictStories($plan->id); 'class='form-control chosen' multiple $disabled");?> + parent == -1 ? "disabled='disabled'" : ''; + $parentBranches = array(); + if($plan->parent > 0 and isset($parentList[$plan->parent])) + { + foreach($branchTagOption as $branchID => $branchName) + { + if(strpos(",{$parentList[$plan->parent]->branch},", ",$branchID,") !== false) $parentBranches[$branchID] = $branchName; + } + } + echo html::select("branch[$plan->id][]", ($plan->parent > 0 and !empty($parentBranches)) ? $parentBranches : $branchTagOption, $plan->branch, "onchange='getConflictStories($plan->id); 'class='form-control chosen' multiple $disabled"); + ?> id]", $plan->title, "class='form-control'")?>