...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_bizproc.php
- Класс: \CCrmBizProc
- Вызов: CCrmBizProc::CheckFields
public function CheckFields($ID = false, $bAutoExec = false, $CreatedBy = 0, $arEntityAttr = array()) { global $USER; $this->LAST_ERROR = ''; if(!CModule::IncludeModule('bizproc') || !CBPRuntime::isFeatureEnabled()) return true; $this->arDocumentStates = CBPDocument::GetDocumentStates( array('crm', $this->sDocument, $this->sEntityType), $ID == false ? null : array('crm', $this->sDocument, $this->sEntityType.'_'.$ID) ); $arCurrentUserGroups = $this->arCurrentUserGroups; if (is_object($USER)) { $params = array( 'UserIsAdmin' => $USER->IsAdmin(), 'DocumentStates' => $this->arDocumentStates ); if ($ID == false) { $arCurrentUserGroups[] = 'Author'; $params['AllUserGroups'] = $arCurrentUserGroups; if($this->sEntityType === CCrmOwnerType::DealName && $this->HasParam('DealCategoryId')) { $params['DealCategoryId'] = $this->GetParam('DealCategoryId'); } $bCanWrite = CBPDocument::CanUserOperateDocumentType( CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array('crm', $this->sDocument, $this->sEntityType), $params ); } else { if ($USER->GetID() == $CreatedBy) $arCurrentUserGroups[] = 'Author'; $params['AllUserGroups'] = $arCurrentUserGroups; $params['CreatedBy'] = $CreatedBy != 0 ? $CreatedBy : 0; $params['CRMEntityAttr'] = $arEntityAttr; $bCanWrite = CBPDocument::CanUserOperateDocument( CBPCanUserOperateOperation::WriteDocument, $USER->GetID(), array('crm', $this->sDocument, $this->sEntityType.'_'.$ID), $params ); } } else { $bCanWrite = true; } if (!$bCanWrite) { $this->LAST_ERROR = GetMessage('CRM_PERMISSION_DENIED'); return false; } $arBizProcParametersValues = array(); foreach ($this->arDocumentStates as $arDocumentState) { if ($arDocumentState['ID'] == '') { if ($bAutoExec) { foreach ($arDocumentState['TEMPLATE_PARAMETERS'] as $parameterKey => $arParam) { if ($arParam['Required'] && !isset($_REQUEST['bizproc'.$arDocumentState['TEMPLATE_ID'].'_'.$parameterKey]) && $arParam['Default'] <> '') $_REQUEST['bizproc'.$arDocumentState['TEMPLATE_ID'].'_'.$parameterKey] = $arParam['Default']; } } $arErrorsTmp = array(); $arBizProcParametersValues[$arDocumentState['TEMPLATE_ID']] = CBPDocument::StartWorkflowParametersValidate( $arDocumentState['TEMPLATE_ID'], $arDocumentState['TEMPLATE_PARAMETERS'], array('crm', $this->sDocument, $ID == false ? $this->sEntityType : $this->sEntityType.'_'.$ID), $arErrorsTmp ); if (count($arErrorsTmp) > 0) { $this->LAST_ERROR = ''; foreach ($arErrorsTmp as $e) $this->LAST_ERROR .= $e['message'].'
'; return false; } } } return $arBizProcParametersValues; }