From 1521590f34b06836445f402fcb6c468ac7b968bf Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 3 May 2011 08:14:53 +0000 Subject: [PATCH] * adjust for report. --- module/product/control.php | 6 ++---- module/story/model.php | 9 +++++++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index d139553fb0..d369a0a178 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -133,12 +133,10 @@ class product extends control $stories = $this->story->getByQuery($queryProductID, $storyQuery, $orderBy, $pager); } - /* Set session for report Query*/ - $storyReport = $this->session->reportQuery == false ? $this->dao->get() : $this->session->reportQuery; - $sql = explode('WHERE', $storyReport); + /* Set session for report query. */ + $sql = explode('WHERE', $this->session->storyReport); $sql = explode('ORDER', $sql[1]); $this->session->set('storyReport', str_replace(array('t1.','t2.'), '', $sql[0])); - $this->session->set('reportQuery', ''); /* Build search form. */ $this->config->product->search['actionURL'] = $this->createLink('product', 'browse', "productID=$productID&browseType=bySearch&queryID=myQueryID"); diff --git a/module/story/model.php b/module/story/model.php index e41b3c840b..a9f175a9b8 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -436,7 +436,7 @@ class storyModel extends model */ public function getProductStories($productID = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id_desc', $pager = null) { - return $this->dao->select('t1.*, t2.title as planTitle') + $stories = $this->dao->select('t1.*, t2.title as planTitle') ->from(TABLE_STORY)->alias('t1') ->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id') ->where('t1.product')->in($productID) @@ -444,6 +444,11 @@ class storyModel extends model ->beginIF($status != 'all')->andWhere('status')->in($status)->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); + + /* Set session for report query. */ + $this->session->set('storyReport', $this->dao->get()); + + return $stories; } /** @@ -491,7 +496,7 @@ class storyModel extends model ->fetchGroup('plan'); /* Set session for report query. */ - $this->session->set('reportQuery', $this->dao->get()); + $this->session->set('storyReport', $this->dao->get()); if(!$tmpStories) return array(); $plans = $this->dao->select('id,title')->from(TABLE_PRODUCTPLAN)->where('id')->in(array_keys($tmpStories))->fetchPairs();