• Модуль: salescenter
  • Путь к файлу: ~/bitrix/modules/salescenter/lib/integration/imconnectormanager.php
  • Класс: BitrixSalesCenterIntegrationImConnectorManager
  • Вызов: ImConnectorManager::getPrimaryContact
private function getPrimaryContact(CrmOrderOrder $order): ?CrmOrderContact
{
	$contactCompanyCollection = $order->getContactCompanyCollection();
	if ($contactCompanyCollection)
	{
		$contacts = $contactCompanyCollection->getContacts();
		/** @var CrmOrderContact $contact */
		foreach ($contacts as $contact)
		{
			if ($contact->isPrimary())
			{
				return $contact;
			}
		}

		return current($contacts) ?: null;
	}

	return null;
}