could::save

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. could
  4. save
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/processor/task/autocloser/result/impact.php
  • Класс: Bitrix\Tasks\Processor\Task\AutoCloser\Result\could
  • Вызов: could::save
public function save()
{
	$result = new Result();

	// check if changed
	if($this->data['STATUS'] == $this->dataPristine['STATUS'] || $this->data['STATUS'] != 5)
	{
		return $result;
	}

	try
	{
		$prevUserId = User::getOccurAsId();
		User::setOccurAsId($this->userId);

		// todo: get rid of CTaskItem, use \Bitrix\Tasks\Item\Task when ready
		$t = new \CTaskItem($this->getId(), $this->userId);
		$t->update($this->getUpdatedData(), array(
			'THROTTLE_MESSAGES' => true,
			'AUTO_CLOSE' => false,
			'SKIP_ACCESS_CONTROL' => true
		));

		if($prevUserId)
		{
			User::setOccurAsId($prevUserId);
		}
	}
	catch(\TasksException | \CTaskAssertException $e)
	{
		$result->addException($e, Loc::getMessage('TASKS_WORKER_TASK_IMPACT_SAVE_ERROR'));
	}

	return $result;
}

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