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

	if (!$session)
	{
		return null;
	}

	[$documentId, $documentType] = $this->getActiveDocument($session);

	if (!$documentId)
	{
		return null;
	}

	$documentService = CBPRuntime::GetRuntime(true)->getDocumentService();
	/** @var AutomationTargetBaseTarget $target */
	$target = $documentService->createAutomationTarget($documentType);

	$target->setDocumentId($documentId);

	if ($target->getDocumentStatus() === $statusId)
	{
		return null;
	}

	$target->setDocumentStatus($statusId);
	$target->getRuntime()->onDocumentStatusChanged();

	$template = new Template($documentType, $statusId);

	return [
		'newStatus' => $statusId,
		'template' => AutomationComponentBase::getTemplateViewData($template->toArray(), $documentType),
	];
}