* when left join the use table, add company condition.
This commit is contained in:
@@ -111,6 +111,7 @@ class groupModel extends model
|
||||
->from(TABLE_USERGROUP)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')
|
||||
->where('`group`')->eq((int)$groupID)
|
||||
->andWhere('t2.company')->eq($this->app->company->id)
|
||||
->fetchPairs();
|
||||
}
|
||||
|
||||
|
||||
@@ -318,7 +318,9 @@ class projectModel extends model
|
||||
{
|
||||
return $this->dao->select('t1.*, t2.realname')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')
|
||||
->where('t1.project')->eq((int)$projectID)->fetchAll();
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->andWHere('t2.company')->eq($this->app->company->id)
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
/* 获取团队成员account=>name列表。*/
|
||||
@@ -326,7 +328,9 @@ class projectModel extends model
|
||||
{
|
||||
$users = $this->dao->select('t1.account, t2.realname')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account')
|
||||
->where('t1.project')->eq((int)$projectID)->fetchPairs();
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->andWHere('t2.company')->eq($this->app->company->id)
|
||||
->fetchPairs();
|
||||
if(!$users) return array();
|
||||
foreach($users as $account => $realName)
|
||||
{
|
||||
|
||||
@@ -106,6 +106,7 @@ class taskModel extends model
|
||||
->leftJoin(TABLE_USER)->alias('t3')
|
||||
->on('t1.owner = t3.account')
|
||||
->where('t1.id')->eq((int)$taskID)
|
||||
->andWhere('t3.company')->eq($this->app->company->id)
|
||||
->fetch();
|
||||
if(!$task) return false;
|
||||
$task->files = $this->loadModel('file')->getByObject('task', $taskID);
|
||||
@@ -125,6 +126,7 @@ class taskModel extends model
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->onCaseOf($status == 'needConfirm')->andWhere('t2.version > t1.storyVersion')->andWhere("t2.status = 'active'")->endCase()
|
||||
->onCaseOf($status != 'all' and $status != 'needConfirm')->andWhere('t1.status')->in($status)->endCase()
|
||||
->andWhere('t3.company')->eq($this->app->company->id)
|
||||
->orderBy($orderBy)
|
||||
->page($pager)
|
||||
->fetchAll();
|
||||
@@ -142,6 +144,7 @@ class taskModel extends model
|
||||
->on('t1.owner = t2.account')
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->onCaseOf($status != 'all')->andWhere('t1.status')->in($status)->endCase()
|
||||
->andWhere('t2.company')->eq($this->app->company->id)
|
||||
->orderBy($orderBy)
|
||||
->query();
|
||||
while($task = $stmt->fetch()) $tasks[$task->id] = "$task->id:$task->ownerRealName:$task->name";
|
||||
|
||||
Reference in New Issue
Block a user