- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/sale_helper.php
- Класс: \CCrmSaleHelper
- Вызов: CCrmSaleHelper::getLocationPropertyId
static function getLocationPropertyId($personTypeId): ?int
{
if (!Loader::includeModule('sale'))
{
return null;
}
$dbRes = Invoice\Property::getList([
'select' => [
'ID',
'SORT',
],
'filter' => [
'=PERSON_TYPE_ID' => $personTypeId,
'=ACTIVE' => 'Y',
'=TYPE' => 'LOCATION',
'=IS_LOCATION' => 'Y',
'=IS_LOCATION4TAX' => 'Y'
],
'order' => [
'SORT' => 'ASC',
],
'limit' => 1,
]);
$arOrderProp = $dbRes->fetch();
unset($dbRes);
if (!$arOrderProp)
{
return null;
}
$locationPropertyId = (int)$arOrderProp['ID'];
return $locationPropertyId > 0 ? $locationPropertyId : null;
}