- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/restservice.php
- Класс: \CCrmRequisiteLinkRestProxy
- Вызов: CCrmRequisiteLinkRestProxy::innerRegister
protected function innerRegister(&$fields, &$errors, array $params = null)
{
$entityTypeId = $this->resolveParam($fields, 'ENTITY_TYPE_ID');
$entityId = $this->resolveParam($fields, 'ENTITY_ID');
$requisiteId = $this->resolveParam($fields, 'REQUISITE_ID');
$bankDetailId = $this->resolveParam($fields, 'BANK_DETAIL_ID');
$mcRequisiteId = $this->resolveParam($fields, 'MC_REQUISITE_ID');
$mcBankDetailId = $this->resolveParam($fields, 'MC_BANK_DETAIL_ID');
if (!$this->checkRequisiteLinks($entityTypeId, $entityId,
$requisiteId, $bankDetailId, $mcRequisiteId, $mcBankDetailId, $errors))
{
return false;
}
$entityTypeId = (int)$entityTypeId;
$entityId = (int)$entityId;
$requisiteId = (int)$requisiteId;
$bankDetailId = (int)$bankDetailId;
$mcRequisiteId = (int)$mcRequisiteId;
$mcBankDetailId = (int)$mcBankDetailId;
if (!Requisite\EntityLink::checkUpdatePermissionOwnerEntity($entityTypeId, $entityId))
{
$errors[] = 'Access denied.';
return false;
}
try
{
Requisite\EntityLink::checkConsistence(
$entityTypeId, $entityId,
$requisiteId, $bankDetailId,
$mcRequisiteId, $mcBankDetailId
);
Requisite\EntityLink::register(
$entityTypeId, $entityId,
$requisiteId, $bankDetailId,
$mcRequisiteId, $mcBankDetailId
);
}
catch (Main\SystemException $e)
{
$errors[] = $e->getMessage();
return false;
}
return true;
}