CCrmBizProc::StartWorkflow

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmBizProc
  4. StartWorkflow
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_bizproc.php
  • Класс: \CCrmBizProc
  • Вызов: CCrmBizProc::StartWorkflow
public function StartWorkflow($ID, $arBizProcParametersValues = false)
{
	if(!CModule::IncludeModule('bizproc') || !CBPRuntime::isFeatureEnabled())
		return true;

	global $USER;
	$arBizProcWorkflowId = array();
	$bresult = true;
	foreach ($this->arDocumentStates as $arDocumentState)
	{
		if ($arDocumentState['ID'] == '')
		{
			$arErrorsTmp = array();

			$arBizProcWorkflowId[$arDocumentState['TEMPLATE_ID']] = CBPDocument::StartWorkflow(
				$arDocumentState['TEMPLATE_ID'],
				array('crm', $this->sDocument, $this->sEntityType.'_'.$ID),
				$arBizProcParametersValues[$arDocumentState['TEMPLATE_ID']],
				$arErrorsTmp
			);

			if (count($arErrorsTmp) > 0)
			{
				$this->LAST_ERROR = '';
				foreach ($arErrorsTmp as $e)
					$this->LAST_ERROR .= $e['message'].'
'; $bresult = false; } } } if ($bresult) { $bizprocIndex = (int) $_REQUEST['bizproc_index']; if ($bizprocIndex > 0) { for ($i = 1; $i <= $bizprocIndex; $i++) { $bpId = trim($_REQUEST['bizproc_id_'.$i]); $bpTemplateId = intval($_REQUEST['bizproc_template_id_'.$i]); $bpEvent = trim($_REQUEST['bizproc_event_'.$i]); if ($bpEvent <> '') { if ($bpId <> '') { if (!array_key_exists($bpId, $this->arDocumentStates)) continue; } else { if (!array_key_exists($bpTemplateId, $this->arDocumentStates )) continue; $bpId = $arBizProcWorkflowId[$bpTemplateId]; } $arErrorTmp = array(); CBPDocument::SendExternalEvent( $bpId, $bpEvent, array('Groups' => $this->arCurrentUserGroups, 'User' => $USER->GetID()), $arErrorTmp ); if (count($arErrorsTmp) > 0) { foreach ($arErrorsTmp as $e) $this->LAST_ERROR .= $e['message'].'
'; $bresult = false; } } } } } return $bresult; }

Добавить комментарий