EventHandler::buildTimeLineEvent

  1. Bitrix24 API (v. 23.675.0)
  2. sender
  3. EventHandler
  4. buildTimeLineEvent
  • Модуль: sender
  • Путь к файлу: ~/bitrix/modules/sender/lib/integration/crm/eventhandler.php
  • Класс: Bitrix\Sender\Integration\Crm\EventHandler
  • Вызов: EventHandler::buildTimeLineEvent
static function buildTimeLineEvent(ActualEntitySelector $selector, Entity\Base $letter, $recipient)
{
	$isAd = $letter instanceof Entity\Ad;
	$createdBy = $letter->get('CREATED_BY');
	if (!$createdBy)
	{
		return [];
	}

	// convert format to time line
	$bindings = [];
	$activityBindings = BindingSelector::findBindings($selector);
	foreach ($activityBindings as $binding)
	{
		$binding['ENTITY_ID'] = $binding['OWNER_ID'];
		$binding['ENTITY_TYPE_ID'] = $binding['OWNER_TYPE_ID'];
		$bindings[] = [
			'ENTITY_TYPE_ID' => $binding['OWNER_TYPE_ID'],
			'ENTITY_ID' => $binding['OWNER_ID'],
		];
	}

	return [
		'ENTITY_TYPE_ID' => $selector->getPrimaryTypeId(),
		'ENTITY_ID' => $selector->getPrimaryId(),
		'TYPE_CATEGORY_ID' => $letter->getMessage()->getCode(),
		'AUTHOR_ID' => $createdBy,
		'SETTINGS' => [
			'letterId' => $letter->getId(),
			'isAds' => $isAd,
			'recipient' => [
				'id' => $recipient['ID'],
				'typeId' => $recipient['CONTACT_TYPE_ID'],
				'code' => $recipient['CONTACT_ID'],
			],
		],
		'BINDINGS' => $bindings
	];
}

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