From 164f7630d393b954e11c9aa400a5cc8e000da51b Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Wed, 20 Apr 2016 11:21:17 +0800 Subject: [PATCH] * fix error for task #2559: not merge product module pairs when type is 'task'; --- module/tree/model.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/module/tree/model.php b/module/tree/model.php index 158734ff0b..b01910e094 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -129,8 +129,28 @@ class treeModel extends model */ public function getModulePairs($rootID, $viewType = 'story', $showModule = 'end') { - if($this->isMergeModule($rootID, $viewType)) $viewType .= ',story'; - $modules = $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->fetchAll('id'); + if($viewType == 'task') + { + $products = array_keys($this->loadModel('product')->getProductsByProject($rootID)); + if(!$this->isMergeModule($rootID, $viewType) or !$products) + { + $modules = $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->fetchAll('id'); + } + else + { + $modules = $this->dao->select('id,name,path,short')->from(TABLE_MODULE) + ->where("((root = $rootID and type = 'task')") + ->orWhere('(root')->in($products)->andWhere('type')->eq('story') + ->markRight(2) + ->fetchAll('id'); + } + } + else + { + if($this->isMergeModule($rootID, $viewType)) $viewType .= ',story'; + $modules = $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->fetchAll('id'); + } + $modulePairs = array(); foreach($modules as $moduleID => $module) {