CCrmLiveFeedEvent::PrepareEntityEventInfos

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmLiveFeedEvent
  4. PrepareEntityEventInfos
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/livefeed.php
  • Класс: \CCrmLiveFeedEvent
  • Вызов: CCrmLiveFeedEvent::PrepareEntityEventInfos
static function PrepareEntityEventInfos($entityTypeID)
{
	$result = array();

	$prefix = '';
	$events = null;
	switch($entityTypeID)
	{
		case CCrmLiveFeedEntity::Lead:
		{
			$prefix = self::LeadPrefix;
			$events = array(
				self::Add,
				self::Progress,
				self::Responsible,
				self::Denomination,
				self::Message
			);
		}
		break;
		case CCrmLiveFeedEntity::Deal:
		{
			$prefix = self::DealPrefix;
			$events = array(
				self::Add,
				self::Client,
				self::Progress,
				self::Responsible,
				self::Denomination,
				self::Message
			);
		}
		break;
		case CCrmLiveFeedEntity::Company:
		{
			$prefix = self::CompanyPrefix;
			$events = array(
				self::Add,
				self::Responsible,
				self::Denomination,
				self::Message
			);
		}
		break;
		case CCrmLiveFeedEntity::Contact:
		{
			$prefix = self::ContactPrefix;
			$events = array(
				self::Add,
				self::Owner,
				self::Responsible,
				self::Denomination,
				self::Message
			);
		}
		break;
		case CCrmLiveFeedEntity::Activity:
		{
			$prefix = self::ActivityPrefix;
			$events = array(self::Add);
		}
		break;
		case CCrmLiveFeedEntity::Invoice:
		{
			$prefix = self::InvoicePrefix;
			$events = array(self::Add);
		}
		break;
	}

	if(is_array($events))
	{
		foreach($events as &$event)
		{
			$eventID = "{$prefix}{$event}";
			$result[] = array(
				'EVENT_ID' => $eventID,
				'COMMENT_EVENT_ID' => $eventID.self::CommentSuffix,
				'COMMENT_ADD_CALLBACK' => (
					($prefix == self::ActivityPrefix && $event == self::Add)
						? array("CCrmLiveFeed", "AddCrmActivityComment")
						: false
				),
				'COMMENT_UPDATE_CALLBACK' => (
					($prefix == self::ActivityPrefix && $event == self::Add)
						? array("CCrmLiveFeed", "UpdateCrmActivityComment")
						: "NO_SOURCE"
				),
				'COMMENT_DELETE_CALLBACK' => (
					($prefix == self::ActivityPrefix && $event == self::Add)
						? array("CCrmLiveFeed", "DeleteCrmActivityComment")
						: "NO_SOURCE"
				)
			);
		}
		unset($event);
	}

	return $result;
}

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