18 parent::__construct();
19 if (Loader::includeModule(
'crm'))
28 if($this->crmType ===
'' || $this->crmId === 0 || !Loader::includeModule(
'crm'))
33 return \Bitrix\Im\Integration\Crm\Common::getLink($this->crmType, $this->crmId);
38 if ($this->isExpectedType($this->type))
48 $separatedEntityId = explode(
'|', $rawCrmData);
49 $this->crmType = $separatedEntityId[0] ??
'';
50 $this->crmId = (int)($separatedEntityId[1] ?? 0);
53 private function getExpectedType(): array
55 if (!Loader::includeModule(
'crm'))
61 \CCrmOwnerType::LeadName => \CCrmOwnerType::LeadName,
62 \CCrmOwnerType::DealName => \CCrmOwnerType::DealName,
63 \CCrmOwnerType::ContactName => \CCrmOwnerType::ContactName,
64 \CCrmOwnerType::CompanyName => \CCrmOwnerType::CompanyName,
68 private function isExpectedType(
string $type): bool
70 return isset($this->getExpectedType()[
$type]);