- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/cashbox/rest/handlerservice.php
- Класс: BitrixSaleCashboxRestHandlerService
- Вызов: HandlerService::checkParamsBeforeDeleteHandler
static function checkParamsBeforeDeleteHandler($params)
{
if (empty($params['ID']))
{
throw new RestException('Parameter ID is not defined', self::ERROR_CHECK_FAILURE);
}
$handler = CashboxRestHandlerTable::getList([
'filter' => [
'ID' => $params['ID']
]
])->fetch();
if (!$handler)
{
throw new RestException('Handler not found', self::ERROR_HANDLER_NOT_FOUND);
}
if ($params['APP_ID'] && !empty($handler['APP_ID']) && $handler['APP_ID'] !== $params['APP_ID'])
{
throw new AccessException();
}
$cashboxListResult = Manager::getList([
'select' => ['ID', 'HANDLER', 'SETTINGS'],
'filter' => [
'=HANDLER' => '\'.CashboxRest::class,
],
]);
$cashboxIdList = [];
while ($cashbox = $cashboxListResult->fetch())
{
if ($cashbox['SETTINGS']['REST']['REST_CODE'] === $handler['CODE'])
{
$cashboxIdList[] = $cashbox['ID'];
}
}
if ($cashboxIdList)
{
throw new RestException(
'There are cashboxes with this handler: '.implode(', ', $cashboxIdList),
self::ERROR_CHECK_FAILURE
);
}
}