• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/rest/externalchannelimportpreset.php
  • Класс: Bitrix\Crm\Rest\CCrmExternalChannelImportPreset
  • Вызов: CCrmExternalChannelImportPreset::getPresetIdByOption
private function getPresetIdByOption()
{
	/** @var \CCrmCompanyRestProxy|\CCrmContactRestProxy $ownerEntity */
	$ownerEntity = $this->getOwnerEntity();

	static $presetIdByOption = null;

	if($presetIdByOption === null)
	{
		$typeId = $ownerEntity->getOwnerTypeID();

		$preset = self::getList();
		if(count($preset)>0)
		{
			if($typeId === \CCrmOwnerType::Company)
				$personType = self::PRESET_PERSON_TYPE_COMPANY;
			else
				$personType = self::PRESET_PERSON_TYPE_PERSON;

			if(isset($preset[$personType]))
			{
				$presetIdByOption = (int)$preset[$personType];
			}
		}
	}
	return $presetIdByOption;
}