• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/task.php
  • Класс: CTasks
  • Вызов: CTasks::OnBeforeUserDelete
static function OnBeforeUserDelete($userId)
{
	global $APPLICATION;

	$userId = (int)$userId;
	if (!$userId)
	{
		$APPLICATION->ThrowException(GetMessage('TASKS_BAD_USER_ID'));
		return false;
	}

	$tasks = static::getTasksForUser($userId);
	$templates = static::getTemplatesForUser($userId);
	$errorMessages = static::getErrorMessagesOnBeforeUserDelete($tasks, $templates);

	if ($errorMessages != '')
	{
		$APPLICATION->ThrowException(
			GetMessage('TASKS_ERR_USER_IN_USE_TASKS_PREFIX', ['#ENTITIES#' => $errorMessages])
		);
	}

	return (empty($tasks) && empty($templates));
}