* fix error for task #2559: not merge product module pairs when type is 'task';

This commit is contained in:
chenfeiCF
2016-04-20 11:21:17 +08:00
parent c4c5f942e8
commit 164f7630d3
+22 -2
View File
@@ -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)
{