From 2e0a49750f9038f0ca1fa1f4354628fb87019b04 Mon Sep 17 00:00:00 2001 From: "chencongzhi520@gmail.com" Date: Sat, 17 Sep 2011 03:33:14 +0000 Subject: [PATCH] * fix bug#230 --- module/bug/control.php | 2 +- module/project/model.php | 22 ++++++++++++++++++++++ module/testtask/control.php | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 1a1c8e23b7..74cbfccda4 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -377,7 +377,7 @@ class bug extends control $this->view->productName = $this->products[$productID]; $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0); $this->view->stories = $stories; - $this->view->projects = $this->product->getProjectPairs($productID); + $this->view->projects = $this->loadModel('project')->filterDeleted($this->product->getProjectPairs($productID)); $this->view->builds = $builds; $this->view->tasks = $this->loadModel('task')->getProjectTaskPairs($projectID); $this->view->moduleID = $moduleID; diff --git a/module/project/model.php b/module/project/model.php index 4c4bef13f0..0ac6469cd2 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -769,4 +769,26 @@ class projectModel extends model ->fetchAll(); return $tasks; } + + /** + * Filter deleted projects + * + * @param array $projects + * @access public + * @return void + */ + public function filterDeleted($projects) + { + $unDeletedProjects = array(); + foreach($projects as $projectID => $project) + { + if($projectID == '') $unDeletedProjects[''] = ''; + else + { + $isDeleted = $this->dao->select('deleted')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch(false); + if($isDeleted->deleted == '0') $unDeletedProjects[$projectID] = $project; + } + } + return $unDeletedProjects; + } } diff --git a/module/testtask/control.php b/module/testtask/control.php index 26e8da60aa..8514493ec0 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -99,7 +99,7 @@ class testtask extends control $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->testtask->create; - $this->view->projects = $this->product->getProjectPairs($productID); + $this->view->projects = $this->loadModel('project')->filterDeleted($this->product->getProjectPairs($productID)); $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted');