* Update the project main doc library users when manage the project team members.

This commit is contained in:
hufangzhou
2021-08-04 11:16:20 +08:00
parent 7afc2d8ebc
commit f33e081ad6
+7
View File
@@ -1307,6 +1307,13 @@ class projectModel extends model
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
}
/* Update the viewers of the project main doc library. */
$authorizedUsers = $this->dao->select('users')->from(TABLE_DOCLIB)->where('type')->eq('project')->andWhere('project')->eq($projectID)->andWhere('main')->eq(1)->fetch();
$authorizedUsers = empty($authorizedUsers) ? array() : explode(',', trim($authorizedUsers->users, ','));
$authorizedUsers = array_merge($authorizedUsers, array_filter($accounts));
$authorizedUsers = ',' . implode(',', array_unique($authorizedUsers)) . ',';
$this->dao->update(TABLE_DOCLIB)->set('users')->eq($authorizedUsers)->where('type')->eq('project')->andWhere('project')->eq($projectID)->andWhere('main')->eq(1)->exec();
/* Only changed account update userview. */
$oldAccounts = array_keys($oldJoin);
$changedAccounts = array_diff($accounts, $oldAccounts);