• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/import/compiler/compiler.php
  • Класс: BitrixSaleLocationImportCompilerCompiler
  • Вызов: Compiler::walkFiasTreeAndKeepFollowing
private function walkFiasTreeAndKeepFollowing($node, &$toBeFound, $typesToSearch)
{
	$bundle = $this->getDataFromCSV('fias_tree', $node);

	if(is_array($bundle) && !empty($bundle))
	{
		//$this->output($bundle);
		foreach($bundle as $node)
		{
			$name = $this->makeNameIndexKey($node['NAME']);

			//$this->output($node);

			// check if we need this
			if(strlen($node['TYPE']) && isset($this->sysMaps['FIAS2BASETYPE'][$node['TYPE']]))
			{
				$type = $this->sysMaps['FIAS2BASETYPE'][$node['TYPE']];
				
				if(in_array($type, $typesToSearch)) // type fits
				{
					// check if name fits too
					foreach($toBeFound as &$keptNode)
					{
						if($keptNode['TYPE_CODE'] != $type)
							continue;

						if(!$this->checkAllowedState($node))
							continue;

						if($this->checkNamesEqual($name, $keptNode['NAME']['RU']['NAME']))
						{
							$keptNode['MATCH'][$node['AOGUID']] = $node;
						}
						elseif($this->checkNamesAlmostEqual($name, $keptNode['NAME']['RU']['NAME']))
						{
							$keptNode['POSSIBLE'][$node['AOGUID']] = $node;
						}
					}
				}
			}

			$this->walkFiasTreeAndKeepFollowing($node['ID'], $toBeFound, $typesToSearch);
		}
	}
}