BaseMessage::addActivity

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. BaseMessage
  4. addActivity
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/activity/provider/basemessage.php
  • Класс: Bitrix\Crm\Activity\Provider\BaseMessage
  • Вызов: BaseMessage::addActivity
static function addActivity(array $fields, bool $checkPerms = true)
{
	$fields['PROVIDER_ID'] = static::getId();

	if (!isset($fields['PROVIDER_TYPE_ID']))
	{
		$fields['PROVIDER_TYPE_ID'] = static::getTypeId($fields);
	}

	if (!isset($fields['DIRECTION']))
	{
		$fields['DIRECTION'] = \CCrmActivityDirection::Outgoing;
	}

	if (empty($fields['SUBJECT']))
	{
		$fields['SUBJECT'] = static::generateSubject($fields['PROVIDER_TYPE_ID'], $fields['DIRECTION']);
	}

	if (!isset($fields['START_TIME']))
	{
		$fields['START_TIME'] = \ConvertTimeStamp(time() + \CTimeZone::GetOffset(), 'FULL');
	}

	if (!isset($fields['DESCRIPTION_TYPE']))
	{
		$fields['DESCRIPTION_TYPE'] = \CCrmContentType::PlainText;
	}

	if (!isset($fields['COMPLETED']))
	{
		$fields['COMPLETED'] = 'Y';
	}

	if (!isset($fields['RESPONSIBLE_ID']))
	{
		$fields['RESPONSIBLE_ID'] = $fields['AUTHOR_ID'];
	}

	return CCrmActivity::Add($fields, $checkPerms, true, ['REGISTER_SONET_EVENT' => true]);
}

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