diff --git a/module/block/model.php b/module/block/model.php index 6c2acd1c37..f232e407f8 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -167,8 +167,8 @@ class blockModel extends model $data = array(); $tasks = $this->dao->select('t1.id')->from(TABLE_TASK)->alias('t1') - ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') - ->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.execution=t3.id') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on("t1.project = t2.id and t2.type = 'project'") + ->leftJoin(TABLE_PROJECT)->alias('t3')->on("t1.execution = t3.id and (t3.type = 'sprint' or t3.type = 'stage')") ->where('t1.assignedTo')->eq($this->app->user->account) ->andWhere('t2.status')->ne('suspended') ->andWhere('t3.status')->ne('suspended') diff --git a/module/task/model.php b/module/task/model.php index 9ae997afcf..11d9a49871 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2146,9 +2146,9 @@ class taskModel extends model if(!$this->loadModel('common')->checkField(TABLE_TASK, $type)) return array(); $tasks = $this->dao->select('t1.*, t2.id as executionID, t2.name as executionName, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion') ->from(TABLE_TASK)->alias('t1') - ->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id') - ->leftjoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id') - ->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project = t4.id') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on("t1.execution = t2.id and (t2.type = 'stage' or t2.type = 'sprint')") + ->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id') + ->leftJoin(TABLE_PROJECT)->alias('t4')->on("t1.project = t4.id and t4.type = 'project'") ->where('t1.deleted')->eq(0) ->beginIF($type != 'closedBy' and $this->app->moduleName == 'block')->andWhere('t1.status')->ne('closed')->fi() ->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi() @@ -2220,8 +2220,8 @@ class taskModel extends model { $tasks = $this->dao->select('t1.*') ->from(TABLE_TASK)->alias('t1') - ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution=t2.id') - ->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.project=t3.id') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on("t1.execution = t2.id and (t2.type = 'sprint' or t2.type = 'stage')") + ->leftJoin(TABLE_PROJECT)->alias('t3')->on("t1.project = t3.id and t3.type = 'project'") ->where('t1.assignedTo')->eq($this->app->user->account) ->andWhere('(t2.status')->eq('suspended') ->orWhere('t3.status')->eq('suspended')