diff --git a/module/execution/model.php b/module/execution/model.php index 3f1f901f42..3209275fcf 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2319,7 +2319,7 @@ class executionModel extends model $planPairs = array('' => ''); foreach($products as $productID => $product) { - $plans = $this->productplan->getBranchPlanPairs($productID, array(BRANCH_MAIN) + $product->branches, true); + $plans = $this->productplan->getBranchPlanPairs($productID, array(BRANCH_MAIN) + $product->branches, 'unexpired', true); foreach($plans as $plan) $planPairs += $plan; } $this->config->product->search['params']['plan']['values'] = $planPairs; diff --git a/module/productplan/model.php b/module/productplan/model.php index 04bfe7f712..e182796538 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -460,16 +460,20 @@ class productplanModel extends model * * @param int $productID * @param array $branches + * @param string $param * @param bool $skipParent * @access public * @return array */ - public function getBranchPlanPairs($productID, $branches = '', $skipParent = false) + public function getBranchPlanPairs($productID, $branches = '', $param = '', $skipParent = false) { + $date = date('Y-m-d'); + $param = strtolower($param); $plans = $this->dao->select('parent,branch,id,title,begin,end')->from(TABLE_PRODUCTPLAN) ->where('product')->eq($productID) ->andWhere('deleted')->eq(0) ->beginIF($branches != '')->andWhere('branch')->in($branches)->fi() + ->beginIF(strpos($param, 'unexpired') !== false)->andWhere('end')->ge($date)->fi() ->orderBy('begin desc') ->fetchAll('id'); diff --git a/module/story/control.php b/module/story/control.php index 4e4dc56dcc..7179e888bb 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -1064,7 +1064,7 @@ class story extends control $moduleList = $branchProduct ? $modulePairs : array(0 => $modulePairs); $modules = array($productID => $moduleList); - $plans = array($productID => $this->productplan->getBranchPlanPairs($productID, '', true)); + $plans = array($productID => $this->productplan->getBranchPlanPairs($productID, '', 'unexpired', true)); $products = array($productID => $product); $branchTagOption = array($productID => $branchTagOption); } @@ -1096,7 +1096,7 @@ class story extends control $modulePairs = $this->tree->getOptionMenu($storyProduct->id, 'story', 0, $branches); $modules[$storyProduct->id] = $storyProduct->type != 'normal' ? $modulePairs : array(0 => $modulePairs); - $plans[$storyProduct->id] = $this->productplan->getBranchPlanPairs($storyProduct->id, $branches, true); + $plans[$storyProduct->id] = $this->productplan->getBranchPlanPairs($storyProduct->id, $branches, 'unexpired', true); if(empty($plans[$storyProduct->id])) $plans[$storyProduct->id][0] = $plans[$storyProduct->id]; if($storyProduct->type != 'normal') $branchProduct = true;