...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/integration/imopenlines/eventhandler.php
- Класс: Bitrix\Crm\Integration\ImOpenLines\EventHandler
- Вызов: EventHandler::OnChatFinish
static function OnChatFinish(Event $event): void { $parameters = $event->getParameters(); $session = $parameters['RUNTIME_SESSION']; if (!$session instanceof Session) { return; } $activityId = (int)($session->getData('CRM_ACTIVITY_ID') ?? 0); if ($activityId <= 0) { return; } $activity = CCrmActivity::GetByID($activityId); if (!$activity) { return; } if (isset($activity['COMPLETED']) && $activity['COMPLETED'] === 'Y') { return; } $bindings = CCrmActivity::GetBindings($activityId); if (!$bindings) { return; } $userPermissions = Container::getInstance()->getUserPermissions()->getCrmPermissions(); $isAtLeastOnePermissionEnabled = false; foreach ($bindings as $binding) { if ( CCrmActivity::CheckCompletePermission( $binding['OWNER_TYPE_ID'], $binding['OWNER_ID'], $userPermissions, ['FIELDS' => $activity] ) ) { $isAtLeastOnePermissionEnabled = true; break; } } if ($isAtLeastOnePermissionEnabled) { CCrmActivity::Complete( $activityId, true, [ 'REGISTER_SONET_EVENT' => true, 'SKIP_BEFORE_HANDLER' => true, ] ); } }