- Модуль: rest
- Путь к файлу: ~/bitrix/modules/rest/classes/general/restentity.php
- Класс: CBitrixRestEntity
- Вызов: CBitrixRestEntity::entitySectionUpdate
static function entitySectionUpdate($params, $n, $server)
{
if(self::checkSectionParams($params))
{
$params['ID'] = intval($params['ID']);
if($params['ID'] <= 0)
{
throw new BitrixMainArgumentNullException("ID");
}
else
{
$arIBlock = self::getIBlock(self::getEntityIBlockCode($params['ENTITY'], $server));
if($arIBlock)
{
if(CIBlockRights::UserHasRightTo($arIBlock['ID'], $arIBlock['ID'], 'section_edit'))
{
$dbRes = CIBlockSection::GetList(array(), array(
'ID' => $params['ID'],
'IBLOCK_ID' => $arIBlock['ID']
), false, array('ID'));
$arRes = $dbRes->Fetch();
if($arRes)
{
$arSectionFields = self::prepareSection($params, $arIBlock, $server);
if(count($arSectionFields) > 0)
{
$ib = new CIBlockSection();
$res = $ib->Update($arRes['ID'], $arSectionFields);
if(!$res)
{
throw new RestException($ib->LAST_ERROR, RestException::ERROR_CORE);
}
}
return true;
}
else
{
throw new RestException('Section not found', self::ERROR_SECTION_NOT_FOUND);
}
}
else
{
throw new AccessException();
}
}
else
{
throw new RestException('Entity not found', self::ERROR_ENTITY_NOT_FOUND);
}
}
}
}