Cho view record nếu record được assign cho group có chứa subordinate của user

Sửa trong list view model hàm getQuery():

  1. function getQuery() {
  2. $currentUser = vglobal('current_user');
  3. $user_record = Users_Record_Model::getInstanceById($currentUser->id,"Users");
  4. $user_subordinates = array_keys ($user_record->getSubordinateUsers());
  5. $user_subordinates = implode( ',', $user_subordinates );
  6. $queryGenerator = $this->get('query_generator');
  7. $listQuery = $queryGenerator->getQuery();
  8.  
  9. $listQuery = str_replace( "INNER JOIN vt_tmp_u$currentUser->id","INNER JOIN (select distinct groupid as id from vtiger_users2group where userid in ($user_subordinates)
  10. union SELECT id from vt_tmp_u$currentUser->id) as ", $listQuery);
  11. return $listQuery;
  12. }

Leave a Reply

You must be logged in to post a comment.