- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
- Класс: \CCrmCompanyRestProxy
- Вызов: CCrmCompanyRestProxy::innerUpdate
protected function innerUpdate($ID, &$fields, &$errors, array $params = null)
{
if(!CCrmCompany::CheckUpdatePermission($ID))
{
$errors[] = 'Access denied.';
return false;
}
if(!CCrmCompany::Exists($ID))
{
$errors[] = 'Company is not found';
return false;
}
$diskQuotaRestriction = \Bitrix\Crm\Restriction\RestrictionManager::getDiskQuotaRestriction();
if (!$diskQuotaRestriction->hasPermission())
{
$errors[] = $diskQuotaRestriction->getErrorMessage();
return false;
}
if(isset($fields['LOGO']) )
{
$fields['LOGO_del'] = 'Y';
}
$arRow = array();
$this->prepareMultiFieldData($this->getOwnerTypeID(), $ID, $arRow);
if (isset($fields['FM']) && is_array($fields['FM']))
{
CCrmFieldMulti::CompareValuesFields($arRow['FM'], $fields['FM']);
}
$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';
}
}
$result = $entity->Update($ID, $fields, $compare, true, $options);
if($result !== true)
{
$errors[] = $entity->LAST_ERROR;
}
else
{
self::traceEntity(\CCrmOwnerType::Company, $ID, $fields, true);
if(self::isBizProcEnabled())
{
CCrmBizProcHelper::AutoStartWorkflows(
CCrmOwnerType::Company,
$ID,
CCrmBizProcEventType::Edit,
$errors
);
}
}
return $result;
}