diff --git a/module/group/model.php b/module/group/model.php index 77a081350c..1de55a054b 100644 --- a/module/group/model.php +++ b/module/group/model.php @@ -154,17 +154,19 @@ class groupModel extends model * Get group by account. * * @param string $account + * @param string $visions * @access public * @return array */ - public function getByAccount($account) + public function getByAccount($account, $visions = '') { + $visions = empty($visions) ? $this->config->vision : $visions; return $this->dao->select('t2.*')->from(TABLE_USERGROUP)->alias('t1') ->leftJoin(TABLE_GROUP)->alias('t2') ->on('t1.`group` = t2.id') ->where('t1.account')->eq($account) ->andWhere('t2.project')->eq(0) - ->andWhere('t2.vision')->eq($this->config->vision) + ->andWhere('t2.vision')->in($visions) ->fetchAll('id'); } diff --git a/module/user/control.php b/module/user/control.php index 8639e943ec..1668ccade5 100755 --- a/module/user/control.php +++ b/module/user/control.php @@ -610,6 +610,7 @@ class user extends control $this->view->roleGroup = $roleGroup; $this->view->rand = $this->user->updateSessionRandom(); $this->view->visionList = $this->user->getVisionList(); + $this->view->companies = $this->loadModel('company')->getOutsideCompanies() + array('ditto' => $this->lang->user->ditto); $this->display(); } @@ -634,8 +635,10 @@ class user extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link)); } + $visionList = $this->user->getVisionList(); + $user = $this->user->getById($userID, 'id'); - $userGroups = $this->loadModel('group')->getByAccount($user->account); + $userGroups = $this->loadModel('group')->getByAccount($user->account, implode(',', array_keys($visionList))); $title = $this->lang->company->common . $this->lang->colon . $this->lang->user->edit; $position[] = $this->lang->user->edit; @@ -647,7 +650,7 @@ class user extends control $this->view->companies = $this->loadModel('company')->getOutsideCompanies(); $this->view->groups = $this->dao->select('id, name')->from(TABLE_GROUP)->where('project')->eq(0)->fetchPairs('id', 'name'); $this->view->rand = $this->user->updateSessionRandom(); - $this->view->visionList = $this->user->getVisionList(); + $this->view->visionList = $visionList; $this->display(); }