RecipientController::prepareHistoryDataModel

  1. Bitrix24 API (v. 23.675.0)
  2. sender
  3. RecipientController
  4. prepareHistoryDataModel
  • Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/integration/crm/timeline/recipientcontroller.php
  • Класс: Bitrix\Sender\Integration\Crm\Timeline\RecipientController
  • Вызов: RecipientController::prepareHistoryDataModel
public function prepareHistoryDataModel(array $data, array $options = null)
{
	$settings = (object) ((isset($data['SETTINGS']) && is_array($data['SETTINGS'])) ? $data['SETTINGS'] : array());
	$data = parent::prepareHistoryDataModel($data, $options);

	try
	{

		if ($settings->isAds)
		{
			$entity = new Entity\Ad($settings->letterId);
			$settings->path = '/marketing/ads/edit/' . $settings->letterId . '/';
			$settings->messageName = $entity->getMessage()->getName();
		}
		else
		{
			$entity = new Entity\Letter($settings->letterId);
			$settings->path = '/marketing/letter/edit/' . $settings->letterId . '/';
			$settings->messageName = $entity->getMessage()->getName();
		}
		$settings->letterTitle = $entity->get('TITLE');

		if ($settings->recipient)
		{
			$row = PostingRecipientTable::getRow([
				'select' => ['IS_READ', 'IS_CLICK', 'IS_UNSUB', 'STATUS'],
				'filter' => ['=ID' => $settings->recipient['id']]
			]);
			$settings->isRead = $row ? $row['IS_READ'] == 'Y' : false;
			$settings->isClick = $row ? $row['IS_CLICK'] == 'Y' : false;
			$settings->isUnsub = $row ? $row['IS_UNSUB'] == 'Y' : false;
			$settings->isError = $row ? $row['STATUS'] === PostingRecipientTable::SEND_RESULT_ERROR : false;
		}


		$data['SETTINGS'] = (array) $settings;
	}
	catch (ArgumentException $e)
	{
		return $data;
	}

	return $data;
}

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