Merge branch 'feedback_1452' into 'master'

* Fix feedback#1452

See merge request easycorp/zentaopms!6172
This commit is contained in:
王怡栋
2022-11-16 02:21:33 +00:00
2 changed files with 9 additions and 4 deletions
+4 -2
View File
@@ -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');
}
+5 -2
View File
@@ -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();
}