Task::onBeforeAdd

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. onBeforeAdd
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/task.php
  • Класс: BitrixTasksControlTask
  • Вызов: Task::onBeforeAdd
private function onBeforeAdd(array $fields): array
{
	$fields = array_merge($fields, $this->byPassParams);

	foreach (GetModuleEvents('tasks', 'OnBeforeTaskAdd', true) as $arEvent)
	{
		if (ExecuteModuleEventEx($arEvent, array(&$fields)) !== false)
		{
			continue;
		}

		$e = $this->application->GetException();
		if (!$e)
		{
			throw new TaskAddException(Loc::getMessage('TASKS_UNKNOWN_ADD_ERROR'));
		}

		if (
			$e instanceof CAdminException
			&& is_array($e->messages)
		)
		{
			$message = array_shift($e->messages);
			$message = $message['txt'];
			throw new TaskAddException($message);
		}
		else
		{
			$message = $this->getApplicationError(Loc::getMessage('TASKS_UNKNOWN_ADD_ERROR'));
			$this->_errors[] = array('text' => $message, 'id' => 'unknown');
			throw new TaskAddException($message);
		}
	}

	return $fields;
}

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