• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/controller/debugger.php
  • Класс: BitrixBizprocControllerDebugger
  • Вызов: Debugger::fixateSessionDocumentAction
public function fixateSessionDocumentAction(string $documentId): ?array
{
	$session = $this->getSession();
	if (!$session)
	{
		return null;
	}

	$result = $session->fixateDocument($documentId);
	if (!$result->isSuccess())
	{
		$this->addErrors($result->getErrorCollection()->toArray());

		return null;
	}

	$documentService = CBPRuntime::GetRuntime(true)->getDocumentService();
	/** @var AutomationTargetBaseTarget $target */
	$target = $documentService->createAutomationTarget($session->getParameterDocumentType());
	$target->setDocumentId($documentId);
	$target->getRuntime()->onDocumentAdd();

	/** @var Session $updatedSession */
	$updatedSession = $result->getObject();

	return [
		'documentSigned' => $updatedSession->getFixedDocument()->getSignedDocument(),
		'session' => $updatedSession->toArray(),
	];
}