- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/controller/activity/gotochat.php
- Класс: Bitrix\Crm\Controller\Activity\GoToChat
- Вызов: GoToChat::getCommunications
private function getCommunications(int $entityTypeId, int $entityId): array
{
$communications = SmsManager::getEntityPhoneCommunications($entityTypeId, $entityId);
if (empty($communications))
{
$factory = Container::getInstance()->getFactory($entityTypeId);
$item = $factory->getItem($entityId);
if ($item && $item->hasField(Item::FIELD_NAME_CONTACT_BINDINGS))
{
$contacts = $item->getContacts();
foreach ($contacts as $contact)
{
$communications[] = [
'entityId' => $contact->getId(),
'entityTypeId' => \CCrmOwnerType::Contact,
'caption' => $contact->getFormattedName(),
];
}
if ($item->hasField(Item::FIELD_NAME_COMPANY))
{
$company = $item->getCompany();
if ($company)
{
$communications[] = [
'entityId' => $company->getId(),
'entityTypeId' => \CCrmOwnerType::Company,
'caption' => $company->getTitle(),
];
}
}
}
}
return $communications;
}