Email::prepareEmailInfo

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Email
  4. prepareEmailInfo
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/email.php
  • Класс: Bitrix\Crm\Activity\Provider\Email
  • Вызов: Email::prepareEmailInfo
static function prepareEmailInfo(array $fields)
{
	$direction = isset($fields['DIRECTION']) ? (int)$fields['DIRECTION'] : \CCrmActivityDirection::Undefined;
	if ($direction !== \CCrmActivityDirection::Outgoing)
	{
		return null;
	}

	$settings = isset($fields['SETTINGS'])
		? (is_array($fields['SETTINGS']) ? $fields['SETTINGS'] : unserialize($fields['SETTINGS'], ['allowed_classes' => false]))
		: [];
	if (!(isset($settings['IS_BATCH_EMAIL']) && $settings['IS_BATCH_EMAIL'] === false))
	{
		return null;
	}


	if (isset($settings['READ_CONFIRMED']) && $settings['READ_CONFIRMED'] > 0)
	{
		return [
			"STATUS_ERROR" => false,
			"STATUS_TEXT" => Loc::getMessage('CRM_ACTIVITY_PROVIDER_EMAIL_STATUS_READ')
		];
	}

	switch (($settings["SENT_ERROR"] ?? null))
	{
		case self::ERROR_TYPE_FULL:
			return array(
				"STATUS_ERROR" => true,
				"STATUS_TEXT" => Loc::getMessage('CRM_ACTIVITY_PROVIDER_EMAIL_STATUS_ERROR')
			);
		case self::ERROR_TYPE_PARTIAL:
			return array(
				"STATUS_ERROR" => false,
				"STATUS_TEXT" => Loc::getMessage('CRM_ACTIVITY_PROVIDER_EMAIL_STATUS_SENT_WITH_ERROR')
			);
		default:
			return Config\Option::get('main', 'track_outgoing_emails_read', 'Y') != 'Y'? null : array(
				"STATUS_ERROR" => false,
				"STATUS_TEXT" => Loc::getMessage('CRM_ACTIVITY_PROVIDER_EMAIL_STATUS_SENT')
			);
	}
}

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