- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/messagesender/channel/channelrepository.php
- Класс: Bitrix\Crm\MessageSender\Channel\ChannelRepository
- Вызов: ChannelRepository::getCommunicationsHolders
static function getCommunicationsHolders(ItemIdentifier $source): array { if ($source->getEntityTypeId() === \CCrmOwnerType::Order) { return self::getCommunicationsHoldersForOrder($source); } if (!\CCrmOwnerType::isUseFactoryBasedApproach($source->getEntityTypeId())) { return []; } $sourceItem = self::fetchItem($source->getEntityTypeId(), $source->getEntityId()); if (!$sourceItem) { return []; } $result = [ \CCrmOwnerType::Contact => [], \CCrmOwnerType::Company => [], \CCrmOwnerType::Lead => [], ]; if (isset($result[$source->getEntityTypeId()])) { $result[$source->getEntityTypeId()][$source->getEntityId()] = $source->getEntityId(); } if ($sourceItem->hasField(Item::FIELD_NAME_COMPANY_ID) && $sourceItem->getCompanyId() > 0) { $result[\CCrmOwnerType::Company][$sourceItem->getCompanyId()] = $sourceItem->getCompanyId(); } if ( $sourceItem->hasField(Item\Contact::FIELD_NAME_COMPANY_IDS) && !empty($sourceItem->get(Item\Contact::FIELD_NAME_COMPANY_IDS)) ) { foreach ($sourceItem->get(Item\Contact::FIELD_NAME_COMPANY_IDS) as $companyId) { if ((int)$companyId > 0) { $result[\CCrmOwnerType::Company][$companyId] = (int)$companyId; } } } if ($sourceItem->hasField(Item::FIELD_NAME_CONTACT_ID) && $sourceItem->getContactId() > 0) { $result[\CCrmOwnerType::Contact][$sourceItem->getContactId()] = $sourceItem->getContactId(); } if ($sourceItem->hasField(Item::FIELD_NAME_CONTACT_IDS) && !empty($sourceItem->getContactIds())) { foreach ($sourceItem->getContactIds() as $contactId) { if ((int)$contactId > 0) { $result[\CCrmOwnerType::Contact][$contactId] = (int)$contactId; } } } return $result; }