From f33e081ad6e99b07ea7edc79b8f97fe1c6d9dcf3 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Wed, 4 Aug 2021 11:16:20 +0800 Subject: [PATCH] * Update the project main doc library users when manage the project team members. --- module/project/model.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/project/model.php b/module/project/model.php index 714be96150..6cff380fc7 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -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);