• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_invoice.php
  • Класс: \CAllCrmInvoice
  • Вызов: CAllCrmInvoice::__fGetLocationPropertyId
static function __fGetLocationPropertyId($personTypeId)
{
	if(!CModule::IncludeModule('sale'))
	{
		return false;
	}

	$locationPropertyId = null;
	$dbRes = \Bitrix\Crm\Invoice\Property::getList([
		'select' => ["ID"],
		'filter' => [
			"=PERSON_TYPE_ID" => $personTypeId,
			"=ACTIVE" => "Y",
			"=TYPE" => "LOCATION",
			"=IS_LOCATION" => "Y",
			"=IS_LOCATION4TAX" => "Y"
		],
		'order' => ["SORT" => "ASC"]
	]);
	if ($arOrderProp = $dbRes->fetch())
	{
		$locationPropertyId = $arOrderProp['ID'];
	}
	else
	{
		return false;
	}
	$locationPropertyId = intval($locationPropertyId);
	if ($locationPropertyId <= 0)
		return false;
	return $locationPropertyId;
}