...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
- Класс: \CCrmDealRestProxy
- Вызов: CCrmDealRestProxy::innerAdd
protected function innerAdd(&$fields, &$errors, array $params = null) { $categoryID = isset($fields['CATEGORY_ID']) ? (int)$fields['CATEGORY_ID'] : 0; $fields['CATEGORY_ID'] = $categoryID = max($categoryID, 0); if(!CCrmDeal::CheckCreatePermission(\CCrmPerms::GetCurrentUserPermissions(), $categoryID)) { $errors[] = 'Access denied.'; return false; } $diskQuotaRestriction = \Bitrix\Crm\Restriction\RestrictionManager::getDiskQuotaRestriction(); if (!$diskQuotaRestriction->hasPermission()) { $errors[] = $diskQuotaRestriction->getErrorMessage(); return false; } $defaultRequisiteLinkParams = Requisite\EntityLink::determineRequisiteLinkBeforeSave( CCrmOwnerType::Deal, 0, Requisite\EntityLink::ENTITY_OPERATION_ADD, $fields ); $entity = self::getEntity(false); $options = array(); if(!$this->isRequiredUserFieldCheckEnabled()) { $options['DISABLE_REQUIRED_USER_FIELD_CHECK'] = true; } if(is_array($params) && isset($params['REGISTER_SONET_EVENT'])) { $options['REGISTER_SONET_EVENT'] = mb_strtoupper($params['REGISTER_SONET_EVENT']) === 'Y'; } $result = $entity->Add($fields, true, $options); if($result <= 0) { $errors[] = $entity->LAST_ERROR; } else { Requisite\EntityLink::register( CCrmOwnerType::Deal, (int)$result, $defaultRequisiteLinkParams['REQUISITE_ID'], $defaultRequisiteLinkParams['BANK_DETAIL_ID'] ); self::traceEntity(\CCrmOwnerType::Deal, $result, $fields); if (self::isBizProcEnabled()) { CCrmBizProcHelper::AutoStartWorkflows( CCrmOwnerType::Deal, $result, CCrmBizProcEventType::Create, $errors ); } //Region automation $starter = new \Bitrix\Crm\Automation\Starter(\CCrmOwnerType::Deal, $result); $starter->setContextToRest()->setUserId($this->getCurrentUserID())->runOnAdd(); //End region } return $result; }