• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/import/gmailcsvfileimport.php
  • Класс: Bitrix\Crm\Import\GMailCsvFileImport
  • Вызов: GMailCsvFileImport::getOrganizations
public function getOrganizations(&$data)
{
	$map = $this->headerMap;
	if($map === null)
	{
		throw new Main\SystemException("Invalid operation. HeaderMap is not assigned.");
	}

	$result = array();
	$i = 1;
	$nameKey = "Organization {$i} - Name";
	$typeKey = "Organization {$i} - Type";
	$titleKey = "Organization {$i} - Title";
	while(isset($map[$nameKey]))
	{
		$k = $map[$nameKey];
		$name = isset($data[$k]) ? $data[$k] : '';
		if($name !== '')
		{
			$k = isset($map[$titleKey]) ? $map[$titleKey] : '';
			$title = $k !== '' && isset($data[$k]) ? $data[$k] : '';

			$k = isset($map[$typeKey]) ? $map[$typeKey] : '';
			$type = $k !== '' && isset($data[$k]) ? $data[$k] : '';

			$result[] = array(
				'NAME' => $name,
				'TITLE' => $title,
				'TYPE' => $type
			);
		}

		$i++;
		$nameKey = "Organization {$i} - Name";
		$typeKey = "Organization {$i} - Type";
		$titleKey = "Organization {$i} - Title";
	}

	return $result;
}