YahooCsvFileImport::checkHeaders

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. YahooCsvFileImport
  4. checkHeaders
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/import/yahoocsvfileimport.php
  • Класс: Bitrix\Crm\Import\YahooCsvFileImport
  • Вызов: YahooCsvFileImport::checkHeaders
public function checkHeaders(array &$messages)
{
	IncludeModuleLangFile(__FILE__);

	$map = $this->headerMap !== null ? $this->headerMap : array();
	if($map === null)
	{
		throw new Main\SystemException("Invalid operation. HeaderMap is not assigned.");
	}

	$hasName = isset($map['First'])
		|| isset($map['Last']);

	if(!$hasName)
	{
		$messages[] = GetMessage(
			'CRM_IMPORT_YAHOO_ERROR_FIELDS_NOT_FOUND',
			array('#FIELD_LIST#' => "'First', 'Last'")
		);
	}

	$hasEmail = isset($map['Email'])
		|| isset($map['Alternate Email 1']);

	$hasPhone = isset($map['Home'])
		|| isset($map['Work'])
		|| isset($map['Mobile'])
		|| isset($map['Other']);

	if(!$hasName && !$hasEmail && !$hasPhone)
	{
		$messages[] = GetMessage('CRM_IMPORT_YAHOO_REQUIREMENTS');
	}

	return $hasName || $hasEmail || $hasPhone;
}

Добавить комментарий