- Модуль: im
- Путь к файлу: ~/bitrix/modules/im/lib/Configuration/Notification.php
- Класс: BitrixImConfigurationNotification
- Вызов: Notification::filterChunk
private function filterChunk(array $userListChunk, $encodedSettingName, $value): array
{
$query =
OptionUserTable::query()
->addSelect('USER_ID')
->registerRuntimeField(
'USER',
new Reference(
'USER',
UserTable::class,
Join::on('this.USER_ID', 'ref.ID'),
['join_type' => Join::TYPE_INNER]
)
)
->registerRuntimeField(
'OPTION_STATE',
new Reference(
'OPTION_STATE',
OptionStateTable::class,
Join::on('this.NOTIFY_GROUP_ID', 'ref.GROUP_ID')
->where('ref.NAME', $encodedSettingName),
['join_type' => Join::TYPE_LEFT]
)
)
->whereExpr("IFNULL(%s, '$value') = 'Y'", ['OPTION_STATE.VALUE'])
->whereIn('USER_ID', $userListChunk)
->where('USER.ACTIVE', 'Y')
->where('USER.IS_REAL_USER', 'Y');
$filteredUsers = [];
foreach ($query->exec() as $user)
{
$filteredUsers[] = (int)$user['USER_ID'];
}
return $filteredUsers;
}