Task::setOriginator

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Task
  4. setOriginator
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/dispatcher/publicaction/task.php
  • Класс: BitrixTasksDispatcherPublicActionTask
  • Вызов: Task::setOriginator
public function setOriginator($id, $originatorId)
{
	$result = [];

	$oldTask = TaskModel::createFromId($id);
	$newTask = clone $oldTask;

	$members = $newTask->getMembers();
	$members[RoleDictionary::ROLE_DIRECTOR] = [];
	$members[RoleDictionary::ROLE_DIRECTOR][] = (int)$originatorId;
	$newTask->setMembers($members);

	if (!(new TaskAccessController($this->userId))->check(ActionDictionary::ACTION_TASK_CHANGE_DIRECTOR, $oldTask, $newTask))
	{
		$this->addForbiddenError();
		return $result;
	}

	$task = CTaskItem::getInstance($id, UtilUser::getId());
	$task->update(array('CREATED_BY' => $originatorId));

	return $result;
}

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