9 public function getData($params = array())
15 'ITEMS_LAST' => array(),
16 'ITEMS_HIDDEN' => array(),
17 'ADDITIONAL_INFO' => array(
18 'SORT_SELECTED' => 200
22 if (!ModuleManager::isModuleInstalled(
'mail'))
27 $options = (!empty($params[
'options']) ? $params[
'options'] : array());
29 $lastItems = (!empty($params[
'lastItems']) ? $params[
'lastItems'] : array());
30 $selectedItems = (!empty($params[
'selectedItems']) ? $params[
'selectedItems'] : array());
32 $lastUserList = array();
37 $lastUserList[] = str_replace(
'U',
'', $value);
41 $selectedUserList = array();
46 $selectedUserList[] = str_replace(
'U',
'', $value);
52 || !empty($selectedUserList)
55 $usersList = \CSocNetLogDestination::getUsers(array(
56 'id' => array_merge($lastUserList, $selectedUserList),
57 'CRM_ENTITY' => ModuleManager::isModuleInstalled(
'crm')
60 $crmInstalled = ModuleManager::isModuleInstalled(
'crm');
62 foreach($usersList as $key => $user)
66 !empty($user[
'isEmail'])
67 && $user[
'isEmail'] ==
'Y'
70 empty($user[
'isCrmEmail'])
71 || $user[
'isCrmEmail'] !=
'Y'
72 || empty($options[
'allowSearchCrmEmailUsers'])
73 || $options[
'allowSearchCrmEmailUsers'] ==
'N'
78 $result[
'ITEMS'][$key] = $user;
79 $result[
"ITEMS_LAST"][] = $key;
84 !empty($selectedUserList)
85 && $USER->isAuthorized()
86 && !\CSocNetUser::isCurrentUserModuleAdmin(SITE_ID,
false)
89 $mySelectedEmailUserIdList = [];
90 $finderDestFilter = array(
91 "USER_ID" => $USER->getId(),
93 "=CODE_USER.EXTERNAL_AUTH_ID" =>
'email',
95 $finderDestSelect = array(
98 $res = \Bitrix\Main\FinderDestTable::getList(array(
100 'filter' => $finderDestFilter,
101 'group' => array(
"CODE_USER_ID"),
102 'select' => $finderDestSelect
104 while ($userFields = $res->fetch())
106 if (!empty($userFields))
108 $mySelectedEmailUserIdList[] =
'U'.$userFields[
'CODE_USER_ID'];
112 foreach($selectedUserList as $selectedUserId)
114 $code =
'U'.$selectedUserId;
116 isset($result[
'ITEMS'][$code][
'isEmail'])
117 && $result[
'ITEMS'][$code][
'isEmail'] ==
'Y'
118 && !in_array($code, $mySelectedEmailUserIdList)
121 $result[
'ITEMS_HIDDEN'][] = $code;
122 unset($result[
'ITEMS'][$code]);
125 $result[
"ITEMS_LAST"] = array_filter(
126 $result[
"ITEMS_LAST"],
127 function ($item) use ($mySelectedEmailUserIdList)
129 return in_array($item, $mySelectedEmailUserIdList);