* put getDeptUserPairs method from group model to dept model.

This commit is contained in:
chenfeiCF
2016-03-13 08:02:35 +08:00
parent bf33b5f108
commit 6b055c87fe
3 changed files with 17 additions and 17 deletions
+16
View File
@@ -333,6 +333,22 @@ class deptModel extends model
->page($pager)
->fetchAll();
}
/**
* Get user pairs of a department.
*
* @param int $deptID
* @access public
* @return array
*/
public function getDeptUserPairs($deptID = 0)
{
return $this->dao->select('account, realname')->from(TABLE_USER)
->where('deleted')->eq(0)
->beginIF($deptID)->andWhere('dept')->eq((int)$deptID)->fi()
->orderBy('account')
->fetchPairs();
}
/**
* Delete a department.
+1 -1
View File
@@ -235,7 +235,7 @@ class group extends control
}
$group = $this->group->getById($groupID);
$groupUsers = $this->group->getUserPairs($groupID);
$allUsers = $this->group->getDeptUserPairs($deptID);
$allUsers = $this->loadModel('dept')->getDeptUserPairs($deptID);
$otherUsers = array_diff_assoc($allUsers, $groupUsers);
$title = $this->lang->company->common . $this->lang->colon . $group->name . $this->lang->colon . $this->lang->group->manageMember;
-16
View File
@@ -178,22 +178,6 @@ class groupModel extends model
->fetchPairs();
}
/**
* Get user pairs of a dept.
*
* @param int $deptID
* @access public
* @return array
*/
public function getDeptUserPairs($deptID = 0)
{
return $this->dao->select('account, realname')->from(TABLE_USER)
->where('deleted')->eq(0)
->beginIF($deptID)->andWhere('dept')->eq((int)$deptID)
->orderBy('account')
->fetchPairs();
}
/**
* Delete a group.
*