diff --git a/module/execution/control.php b/module/execution/control.php index 23996478a0..dacd3fe109 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -673,7 +673,6 @@ class execution extends control $type = strtolower($type); $param = $param; $productID = 0; - $branchID = 0; setcookie('storyPreExecutionID', $executionID, $this->config->cookieLife, $this->config->webRoot, '', false, true); if($this->cookie->storyPreExecutionID != $executionID) { @@ -729,20 +728,11 @@ class execution extends control $execution = $this->commonAction($executionID); $executionID = $execution->id; - if($this->cookie->storyModuleParam) $this->view->module = $this->loadModel('tree')->getById($this->cookie->storyModuleParam); - if($this->cookie->storyProductParam) $this->view->product = $this->loadModel('product')->getById($this->cookie->storyProductParam); - if($this->cookie->storyBranchParam) - { - $branchID = $this->cookie->storyBranchParam; - if(strpos($branchID, ',') !== false) list($productID, $branchID) = explode(',', $branchID); - $this->view->branch = $this->loadModel('branch')->getById($branchID, $productID); - } - /* Load pager. */ $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $stories = $this->story->getExecutionStories($executionID, 0, $branchID, $sort, $type, $param, 'story', '', $pager); + $stories = $this->story->getExecutionStories($executionID, 0, 0, $sort, $type, $param, 'story', '', $pager); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story', false); $users = $this->user->getPairs('noletter'); @@ -782,6 +772,15 @@ class execution extends control foreach($plans as $plan) $allPlans += $plan; } + if($this->cookie->storyModuleParam) $this->view->module = $this->loadModel('tree')->getById($this->cookie->storyModuleParam); + if($this->cookie->storyProductParam) $this->view->product = $this->loadModel('product')->getById($this->cookie->storyProductParam); + if($this->cookie->storyBranchParam) + { + $branchID = $this->cookie->storyBranchParam; + if(strpos($branchID, ',') !== false) list($productID, $branchID) = explode(',', $branchID); + $this->view->branch = $this->loadModel('branch')->getById($branchID, $productID); + } + /* Get execution's product. */ $productPairs = $this->loadModel('product')->getProductPairsByProject($executionID); diff --git a/module/story/model.php b/module/story/model.php index 82c9d6b76a..d7eddc0848 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2367,7 +2367,7 @@ class storyModel extends model else { $productParam = ($type == 'byproduct' and $param) ? $param : $this->cookie->storyProductParam; - $branchParam = ($type == 'bybranch' and $param) ? $param : $this->cookie->storyBranchParam; + $branchParam = $branchID = ($type == 'bybranch' and $param) ? $param : $this->cookie->storyBranchParam; $moduleParam = ($type == 'bymodule' and $param) ? $param : $this->cookie->storyModuleParam; $modules = empty($moduleParam) ? array() : $this->dao->select('*')->from(TABLE_MODULE)->where('path')->like("%,$moduleParam,%")->andWhere('type')->eq('story')->andWhere('deleted')->eq(0)->fetchPairs('id', 'id'); if(strpos($branchParam, ',') !== false) list($productParam, $branchParam) = explode(',', $branchParam); @@ -2384,7 +2384,7 @@ class storyModel extends model ->beginIF($excludeStories)->andWhere('t2.id')->notIN($excludeStories)->fi() ->beginIF($execution->type == 'project') ->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID) - ->beginIF($type == 'bybranch')->andWhere('t2.branch')->eq($branch)->fi() + ->beginIF($type == 'bybranch' and strpos($branchID, ',') !== false)->andWhere('t2.branch')->eq($branchParam)->fi() ->beginIF(strpos('changed|closed', $type) !== false)->andWhere('t2.status')->eq($type)->fi() ->beginIF($type == 'unclosed')->andWhere('t2.status')->in(array_keys($unclosedStatus))->fi() ->fi()