• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/Debugger/Session/Session.php
  • Класс: BitrixBizprocDebuggerSessionSession
  • Вызов: Session::addDocument
public function addDocument(string $documentId)
{
	if ($this->isFixed())
	{
		$result = new BitrixMainResult();
		$error = static::getErrorByCode(self::ERROR_DOCUMENT_ID_ALREADY_FIXED);
		$result->addError($error);

		return $result;
	}

	$document = DebuggerSessionDocumentTable::createObject();
	$document
		->setSessionId($this->getId())
		->setDocumentId($documentId)
	;

	if ($this->getMode() === Mode::EXPERIMENTAL)
	{
		$document->setDateExpire(null);
	}

	$this->addToDocuments($document);

	$result = $this->save();
	if ($result->isSuccess() && $this->getMode() === Mode::INTERCEPTION)
	{
		$documentService = CBPRuntime::GetRuntime(true)->getDocumentService();
		$parameterDocumentId = $this->getParameterDocumentType();
		$parameterDocumentId[2] = $documentId;

		$documentService->onDebugSessionDocumentStatusChanged(
			$parameterDocumentId,
			$this->getStartedBy(),
			DocumentStatus::INTERCEPTED
		);
	}

	return $result;
}