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

	$result = array();
	$value = '';
	if($this->tryToGetValue('Email', $data, $value, $map, true) && $value !== '')
	{
		$result[] = array(
			'VALUE_TYPE' => 'P',
			'VALUE' => $value
		);
	}

	$i = 1;
	$valueKey = "Alternate Email {$i}";
	while($this->tryToGetValue($valueKey, $data, $value, $map, true))
	{
		if($value !== '')
		{
			$result[] = array(
				'VALUE_TYPE' => 'A',
				'VALUE' => $value
			);
		}

		$i++;
		$valueKey = "Alternate Email {$i}";
	}
	return $result;
}