Task::adjustDeadline

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

	if (!TaskAccessController::can($this->userId, ActionDictionary::ACTION_TASK_DEADLINE, (int)$id))
	{
		$this->addForbiddenError();
		return $result;
	}

	if ($id = $this->checkTaskId($id))
	{
		$result['ID' ] = $id;

		$task = CTaskItem::getInstance($id, UtilUser::getId());
		try
		{
			$arTask = $task->getData(false);
		}
		catch (TasksException $e)
		{
			return [];
		}

		if (empty($arTask['DEADLINE']))
		{
			return $result;
		}

		$deadline = UtilTypeDateTime::createFromUserTime($arTask['DEADLINE']);
		$deadline = $deadline->add(($num < 0 ? '-' : '').abs($num).' '.$type);

		$task->update(array('DEADLINE' => $deadline));
	}

	return $result;
}

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