diff --git a/module/task/model.php b/module/task/model.php index d6798dfde7..beff8bd80f 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1218,6 +1218,7 @@ class taskModel extends model ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account') ->leftJoin(TABLE_TEAM)->alias('t4')->on('t1.id = t4.task') + ->leftJoin(TABLE_MODULE)->alias('t5')->on('t1.module = t5.id') ->where('t1.project')->eq((int)$projectID) ->beginIF(!in_array($type, array('assignedtome', 'myinvolved')))->andWhere('t1.parent')->eq(0)->fi() ->beginIF($type == 'myinvolved') @@ -1225,7 +1226,7 @@ class taskModel extends model ->orWhere('t1.assignedTo')->eq($this->app->user->account) ->orWhere('t1.finishedby')->eq($this->app->user->account) ->markRight(1)->fi() - ->beginIF($productID)->andWhere('t2.product')->eq((int)$productID)->fi() + ->beginIF($productID)->andWhere("((t5.root=" . (int)$productID . " and t5.type='story') OR t2.product=" . (int)$productID . ")")->fi() ->beginIF($type == 'undone')->andWhere("(t1.status = 'wait' or t1.status ='doing')")->fi() ->beginIF($type == 'needconfirm')->andWhere('t2.version > t1.storyVersion')->andWhere("t2.status = 'active'")->fi() ->beginIF($type == 'assignedtome')->andWhere('t1.assignedTo')->eq($this->app->user->account)->fi() @@ -1254,10 +1255,11 @@ class taskModel extends model ->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->leftJoin(TABLE_USER)->alias('t3')->on('t1.assignedTo = t3.account') + ->leftJoin(TABLE_MODULE)->alias('t4')->on('t1.module = t4.id') ->where('t1.project')->eq((int)$projectID) ->andWhere('t1.parent')->in($taskList) ->andWhere('t1.deleted')->eq(0) - ->beginIF($productID)->andWhere('t2.product')->eq((int)$productID)->fi() + ->beginIF($productID)->andWhere("((t4.root=" . (int)$productID . " and t4.type='story') OR t2.product=" . (int)$productID . ")")->fi() ->beginIF($type == 'undone')->andWhere("(t1.status = 'wait' or t1.status ='doing')")->fi() ->beginIF($type == 'needconfirm')->andWhere('t2.version > t1.storyVersion')->andWhere("t2.status = 'active'")->fi() ->beginIF($type == 'assignedtome')->andWhere('t1.assignedTo')->eq($this->app->user->account)->fi()