• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entityaddresstype.php
  • Класс: Bitrix\Crm\EntityAddressType
  • Вызов: EntityAddressType::getDefaultIdByEntityCategory
static function getDefaultIdByEntityCategory(int $entityTypeId, int $categoryId) : int
{
	$result = static::Undefined;

	if (CCrmOwnerType::IsDefined($entityTypeId) && $categoryId > 0)
	{
		$factory = Container::getInstance()->getFactory($entityTypeId);
		if ($factory && $factory->isCategoryAvailable($categoryId))
		{
			$category = $factory->getCategory($categoryId);
			if ($category instanceof ItemCategory)
			{
				$result = $category->getDefaultAddressType();
			}
		}
	}

	return $result;
}