Dependence::add

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Dependence
  4. add
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/dispatcher/publicaction/task/dependence.php
  • Класс: Bitrix\Tasks\Dispatcher\PublicAction\Task\Dependence
  • Вызов: Dependence::add
public function add($taskIdFrom, $taskIdTo, $linkType)
{
	if (
		!TaskAccessController::can($this->userId, ActionDictionary::ACTION_TASK_READ, (int)$taskIdFrom)
		|| !TaskAccessController::can($this->userId, ActionDictionary::ACTION_TASK_READ, (int)$taskIdTo)
	)
	{
		$this->addForbiddenError();
		return [];
	}

	try
	{
		$task = new \CTaskItem($taskIdTo, $this->userId);
		$task->addDependOn($taskIdFrom, $linkType);
	}
	catch(Exception | \CTaskAssertException $e)
	{
		$this->errors->add('ILLEGAL_NEW_LINK', \Bitrix\Tasks\Dispatcher::proxyExceptionMessage($e));
	}

	return [];
}

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