...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
- Класс: \CCrmLeadRestProxy
- Вызов: CCrmLeadRestProxy::innerUpdate
protected function innerUpdate($ID, &$fields, &$errors, array $params = null) { if(!CCrmLead::CheckUpdatePermission($ID)) { $errors[] = 'Access denied.'; return false; } if(!CCrmLead::Exists($ID)) { $errors[] = 'Lead is not found'; return false; } $diskQuotaRestriction = \Bitrix\Crm\Restriction\RestrictionManager::getDiskQuotaRestriction(); if (!$diskQuotaRestriction->hasPermission()) { $errors[] = $diskQuotaRestriction->getErrorMessage(); return false; } $entity = self::getEntity(); $compare = true; $options = array(); if(!$this->isRequiredUserFieldCheckEnabled()) { $options['DISABLE_REQUIRED_USER_FIELD_CHECK'] = true; } if(is_array($params)) { if(isset($params['REGISTER_HISTORY_EVENT'])) { $compare = mb_strtoupper($params['REGISTER_HISTORY_EVENT']) === 'Y'; } if(isset($params['REGISTER_SONET_EVENT'])) { $options['REGISTER_SONET_EVENT'] = mb_strtoupper($params['REGISTER_SONET_EVENT']) === 'Y'; } } //check STATUS_ID changes $arPresentFields = []; if (isset($fields['STATUS_ID'])) { $dbDocumentList = CCrmLead::GetListEx( array(), array('ID' => $ID, 'CHECK_PERMISSIONS' => 'N'), false, false, array('ID', 'STATUS_ID') ); $arPresentFields = $dbDocumentList->Fetch(); if (!is_array($arPresentFields)) { $arPresentFields = []; } } $result = $entity->Update($ID, $fields, $compare, true, $options); if($result !== true) { $errors[] = $entity->LAST_ERROR; } else { self::traceEntity(\CCrmOwnerType::Lead, $ID, $fields, true); if(self::isBizProcEnabled()) { CCrmBizProcHelper::AutoStartWorkflows( CCrmOwnerType::Lead, $ID, CCrmBizProcEventType::Edit, $errors ); } //Region automation $starter = new \Bitrix\Crm\Automation\Starter(\CCrmOwnerType::Lead, $ID); $starter->setContextToRest()->setUserId($this->getCurrentUserID()); $starter->runOnUpdate($fields, $arPresentFields); //End region } return $result; }