...Человеческий поиск в разработке...
- Модуль: bizproc
- Путь к файлу: ~/bitrix/modules/bizproc/classes/general/workflow.php
- Класс: CBPWorkflow
- Вызов: CBPWorkflow::initialize
public function initialize( CBPActivity $rootActivity, $documentId, $workflowParameters = [], $workflowVariablesTypes = [], $workflowParametersTypes = [], $workflowTemplateId = 0 ) { $this->rootActivity = $rootActivity; $rootActivity->SetWorkflow($this); if (method_exists($rootActivity, 'SetWorkflowTemplateId')) { $rootActivity->SetWorkflowTemplateId($workflowTemplateId); } if (method_exists($rootActivity, 'setTemplateUserId')) { $rootActivity->setTemplateUserId( CBPWorkflowTemplateLoader::getTemplateUserId($workflowTemplateId) ); } $arDocumentId = CBPHelper::ParseDocumentId($documentId); $rootActivity->SetDocumentId($arDocumentId); $documentService = $this->GetService("DocumentService"); $documentType = $workflowParameters[CBPDocument::PARAM_DOCUMENT_TYPE] ?? $documentService->GetDocumentType($arDocumentId) ; unset($workflowParameters[CBPDocument::PARAM_DOCUMENT_TYPE]); if ($documentType !== null) { $rootActivity->SetDocumentType($documentType); $rootActivity->SetFieldTypes($documentService->GetDocumentFieldTypes($documentType)); } $rootActivity->SetProperties($workflowParameters); $rootActivity->SetVariablesTypes($workflowVariablesTypes); if (is_array($workflowVariablesTypes)) { foreach ($workflowVariablesTypes as $k => $v) { $variableValue = $v["Default"] ?? null; if ($documentType && $fieldTypeObject = $documentService->getFieldTypeObject($documentType, $v)) { $fieldTypeObject->setDocumentId($arDocumentId); $variableValue = $fieldTypeObject->internalizeValue('Variable', $variableValue); } //set defaults on start $rootActivity->SetVariable($k, $variableValue); } } $rootActivity->SetPropertiesTypes($workflowParametersTypes); }