• Модуль: location
  • Путь к файлу: ~/bitrix/modules/location/lib/infrastructure/service/disputedareaservice/dispute.php
  • Класс: BitrixLocationInfrastructureServiceDisputedAreaServiceDispute
  • Вызов: Dispute::adjustLocation
public function adjustLocation(Location $location): void
{
	$info = $this->getInfo();
	if (!$info)
	{
		return;
	}

	/**
	 * Location
	 */
	/** @var LocationFieldCollection $locationFieldCollection */
	$locationFieldCollection = $location->getFieldCollection();

	if (isset($info['country']))
	{
		$this->adjustLocationField($locationFieldCollection, Type::COUNTRY, $info['country']);
	}
	if (isset($info['state']))
	{
		$this->adjustLocationField($locationFieldCollection, Type::ADM_LEVEL_1, $info['state']);
	}

	/**
	 * Address
	 */
	$address = $location->getAddress();
	if ($address)
	{
		/** @var AddressFieldCollection $addressFieldCollection */
		$addressFieldCollection = $address->getFieldCollection();

		if (isset($info['country']))
		{
			$this->adjustAddressField(
				$addressFieldCollection,
				EntityAddressFieldType::COUNTRY,
				$info['country']
			);
		}

		if (isset($info['state']))
		{
			$this->adjustAddressField(
				$addressFieldCollection,
				EntityAddressFieldType::ADM_LEVEL_1,
				$info['state']
			);
		}

		/** @var EntityAddressField $item */
		$item = $addressFieldCollection->getItemByType(EntityAddressFieldType::POSTAL_CODE);
		if ($item)
		{
			$item->setValue('');
		}
	}
}