• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/entityrequisite.php
  • Класс: Bitrix\Crm\EntityRequisite
  • Вызов: EntityRequisite::getAddresses
static function getAddresses($id)
{
	if(!is_int($id))
	{
		$id = (int)$id;
	}

	if($id <= 0)
	{
		return array();
	}

	$dbResult = AddressTable::getList(
		array('filter' => array('ENTITY_TYPE_ID' => CCrmOwnerType::Requisite, 'ENTITY_ID' => $id))
	);

	$results = array();
	while($ary = $dbResult->fetch())
	{
		$typeId = (int)$ary['TYPE_ID'];
		$results[$typeId] = array(
			'ADDRESS_1' => isset($ary['ADDRESS_1']) ? $ary['ADDRESS_1'] : '',
			'ADDRESS_2' => isset($ary['ADDRESS_2']) ? $ary['ADDRESS_2'] : '',
			'CITY' => isset($ary['CITY']) ? $ary['CITY'] : '',
			'POSTAL_CODE' => isset($ary['POSTAL_CODE']) ? $ary['POSTAL_CODE'] : '',
			'REGION' => isset($ary['REGION']) ? $ary['REGION'] : '',
			'PROVINCE' => isset($ary['PROVINCE']) ? $ary['PROVINCE'] : '',
			'COUNTRY' => isset($ary['COUNTRY']) ? $ary['COUNTRY'] : '',
			'COUNTRY_CODE' => isset($ary['COUNTRY_CODE']) ? $ary['COUNTRY_CODE'] : '',
			'LOC_ADDR_ID' => isset($ary['LOC_ADDR_ID']) ? (int)$ary['LOC_ADDR_ID'] : 0
		);
	}
	return $results;
}