• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/import/import.php
  • Класс: BitrixSaleLocationImportis
  • Вызов: is::buildTypeTable
protected function buildTypeTable()
{
	if($this->data['types_processed'])
		return;

	// read existed
	$existed = static::getExistedTypes();

	if($this->checkSource(self::SOURCE_REMOTE))
	{
		$rTypes = $this->getRemoteTypes();
		$this->getRemoteTypeGroups();

		$existed = static::createTypes($rTypes, $existed);

		if(intval($dl = $this->data['settings']['options']['DEPTH_LIMIT']))
		{
			// here we must find out what types we are allowed to read

			$typesGroupped = $this->getTypeLevels();

			if(!isset($typesGroupped[$dl]))
				throw new MainSystemException('Unknow type level to limit');

			$allowed = array();
			foreach($typesGroupped as $gId => $group)
			{
				if($gId > $dl)
					break;

				foreach($group['TYPES'] as $type)
					$allowed[] = $type;
			}

			$this->data['types']['allowed'] = $allowed;
		}
		else
		{
			foreach($rTypes as $type)
				$this->data['types']['allowed'][] = $type['CODE'];
		}
	}
	elseif($this->checkSource(self::SOURCE_FILE))
		$this->data['types']['allowed'] = array('COUNTRY', 'REGION', 'CITY');

	$this->data['types']['last'] = $this->data['types']['allowed'][count($this->data['types']['allowed']) - 1];
	$this->data['types']['allowed'] = array_flip($this->data['types']['allowed']);

	$this->data['types']['code2id'] = $existed;
	$this->data['types_processed'] = true;
}