Activity::completeAction

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Activity
  4. completeAction
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/activity.php
  • Класс: Bitrix\Crm\Controller\Timeline\Activity
  • Вызов: Activity::completeAction
public function completeAction(int $activityId, int $ownerTypeId, int $ownerId): void
{
	$activity = $this->loadActivity($activityId, $ownerTypeId, $ownerId);
	if (!$activity)
	{
		return;
	}

	if(!\CCrmActivity::CheckCompletePermission(
		$ownerTypeId,
		$ownerId,
		Container::getInstance()->getUserPermissions()->getCrmPermissions(),
		['FIELDS' => $activity]
	))
	{
		$provider = \CCrmActivity::GetActivityProvider($activity);
		$error = is_null($provider) ? ErrorCode::getAccessDeniedError() : $provider::getCompletionDeniedError();
		$this->addError($error);

		return;
	}

	if (!\CCrmActivity::Complete($activityId, true, ['REGISTER_SONET_EVENT' => true]))
	{
		$this->addError(new Error(implode(', ', \CCrmActivity::GetErrorMessages()), 'CAN_NOT_COMPLETE'));
	}
}

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