From ac9410c5a92c6856a8a3c5608d525d34fc445a6a Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Sat, 21 Nov 2009 02:37:45 +0000 Subject: [PATCH] * add status condition when get stories of product. --- module/product/control.php | 2 +- module/project/control.php | 2 +- module/story/model.php | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/product/control.php b/module/product/control.php index 2425692efa..70d05833b8 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -64,7 +64,7 @@ class product extends control /* 加载分页类,并查询stories列表。*/ $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $stories = $this->story->getProductStories($productID, $childModuleIds, $orderBy, $pager); + $stories = $this->story->getProductStories($productID, $childModuleIds, 'all', $orderBy, $pager); $this->assign('header', $header); $this->assign('position', $position); diff --git a/module/project/control.php b/module/project/control.php index 43a59546c2..9e9f121b5f 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -410,7 +410,7 @@ class project extends control $position[] = html::a($browseLink, $project->name); $position[] = $this->lang->project->linkStory; - $allStories = $this->story->getProductStories(array_keys($products)); + $allStories = $this->story->getProductStories(array_keys($products), $moduleID = '0', $status = 'wait, doing'); $prjStories = $this->story->getProjectStoryPairs($projectID); $this->assign('header', $header); diff --git a/module/story/model.php b/module/story/model.php index 9f94064083..dc179087d1 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -75,22 +75,24 @@ class storyModel extends model } /* 获得某一个产品某一个模块下面的所有需求列表。*/ - function getProductStories($productID = 0, $moduleIds = 0, $orderBy = 'id|desc', $pager = null) + function getProductStories($productID = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id|desc', $pager = null) { $sql = $this->dao->select('*')->from(TABLE_STORY)->where('product')->in($productID); if(!empty($moduleIds)) $sql->andWhere('module')->in($moduleIds); + if($status != 'all') $sql->andWhere('status')->in($status); $stories = $sql->orderBy($orderBy)->page($pager)->fetchAll(); return $stories; } /* 获得某一个产品某一个模块下面的所有需求id=>title列表。*/ - function getProductStoryPairs($productID = 0, $moduleIds = 0, $order = 'id|desc') + function getProductStoryPairs($productID = 0, $moduleIds = 0, $status = 'all', $order = 'id|desc') { $sql = $this->dao->select('t1.id, t1.title, t1.module, t2.name AS product') ->from(TABLE_STORY)->alias('t1')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->where('1=1'); if($productID) $sql->andWhere('t1.product')->in($productID); if($moduleIds) $sql->andWhere('t1.module')->in($moduleIds); + if($status != 'all') $sql->andWhere('status')->in($status); $stories = $sql->orderBy($order)->fetchAll(); return $this->formatStories($stories); }