From 921de5b4f1d22ec11a8e63c18e7a11dbedc5f9a3 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 16 Nov 2022 01:13:55 +0000 Subject: [PATCH 1/2] * Fix feedback#1452 --- module/group/model.php | 6 ++++-- module/user/control.php | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/module/group/model.php b/module/group/model.php index 77a081350c..b11bf6c2aa 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 $vision * @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(); } From 1c69f3079373b79412c00ee932eec3bf1433a314 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 16 Nov 2022 02:08:00 +0000 Subject: [PATCH 2/2] * Adjust code --- module/group/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/group/model.php b/module/group/model.php index b11bf6c2aa..1de55a054b 100644 --- a/module/group/model.php +++ b/module/group/model.php @@ -154,7 +154,7 @@ class groupModel extends model * Get group by account. * * @param string $account - * @param string $vision + * @param string $visions * @access public * @return array */