• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/connector/crm.php
  • Класс: BitrixLandingConnectorCrm
  • Вызов: Crm::setContacts
static function setContacts(int $siteId, array $data): void
{
	$shopStoredData = unserialize(Manager::getOption(self::OPTION_DATA_CODE, ''), ['allowed_classes' => false]);
	$shopStoredData = is_array($shopStoredData) ? $shopStoredData : [];
	if (isset($shopStoredData[$siteId]))
	{
		unset($shopStoredData[$siteId]);
	}
	$shopStoredData[$siteId] = [];

	$contacts = self::getContactsRaw();
	if (!$contacts)
	{
		self::addNewCompany(
			$data[self::COMPANY_KEY],
			$data[self::PHONE_KEY]
		);
	}

	foreach (self::DEFAULT_CONTACTS as $key => $value)
	{
		if (!($data[$key] ?? ''))
		{
			continue;
		}
		if ($data[$key] !== ($contacts[$key] ?? ''))
		{
			$shopStoredData[$siteId][$key] = $data[$key];
		}
	}

	Manager::setOption(self::OPTION_DATA_CODE, serialize($shopStoredData));
	self::clearContactsCache();
}