• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/handler/taskfieldhandler.php
  • Класс: BitrixTasksControlHandlerTaskFieldHandler
  • Вызов: TaskFieldHandler::prepareGuid
public function prepareGuid(): self
{
	if ($this->taskId)
	{
		return $this;
	}

	$this->fields['GUID'] = Util::generateUUID();

	$res = TaskTable::getList([
		'select' => ['ID'],
		'filter' => [
			'=GUID' => $this->fields['GUID'],
		],
		'limit' => 1
	]);
	$task = $res->fetch();

	if ($task)
	{
		throw new TaskFieldValidateException(Loc::getMessage('ERROR_TASKS_GUID_NON_UNIQUE'));
	}

	return $this;
}