• Модуль: salescenter
  • Путь к файлу: ~/bitrix/modules/salescenter/lib/integration/imopenlinesmanager.php
  • Класс: BitrixSalesCenterIntegrationImOpenLinesManager
  • Вызов: ImOpenLinesManager::getClientInfo
public function getClientInfo()
{
	$clientInfo = [];

	if($this->isEnabled() && $this->sessionId > 0)
	{
		$crmInfo = $this->getCrmInfo();
		if($crmInfo)
		{
			if($crmInfo['DEAL'] > 0)
			{
				$clientInfo['OWNER_ID'] = (int)$crmInfo['DEAL'];
				$clientInfo['OWNER_TYPE_ID'] = CCrmOwnerType::Deal;
			}
			elseif($crmInfo['LEAD'] > 0)
			{
				$deal = CrmManager::getInstance()->getLeadActiveDeal($crmInfo['LEAD']);
				if ($deal)
				{
					$clientInfo['OWNER_ID'] = $deal->getId();
					$clientInfo['OWNER_TYPE_ID'] = CCrmOwnerType::Deal;
				}
			}

			if ((int)$crmInfo['COMPANY'] > 0)
			{
				$clientInfo['COMPANY_ID'] = (int)$crmInfo['COMPANY'];
			}

			if (!empty($crmInfo['CONTACT']))
			{
				if (is_array($crmInfo['CONTACT']))
				{
					$clientInfo['CONTACT_IDS'] = $crmInfo['CONTACT'];
				}
				else
				{
					$clientInfo['CONTACT_IDS'] = [(int)$crmInfo['CONTACT']];
				}
			}
		}
		$clientInfo['USER_ID'] = $this->getUserId();
	}

	return $clientInfo;
}