- Модуль: sale
- Путь к файлу: ~/bitrix/modules/sale/lib/compatible/eventcompatibility.php
- Класс: BitrixSaleCompatibleEventCompatibility
- Вызов: EventCompatibility::onBeforeOrderDelete
static function onBeforeOrderDelete(MainEvent $event)
{
if (static::$disableEvent === true)
{
return new MainEventResult( MainEventResult::SUCCESS, null, 'sale');
}
$parameters = $event->getParameters();
/** @var SaleOrder $order */
$order = $parameters['ENTITY'];
if (!$order instanceof SaleOrder)
{
return new MainEventResult(
MainEventResult::ERROR,
new SaleResultError(MainLocalizationLoc::getMessage('SALE_EVENT_COMPATIBILITY_WRONG_ORDER'), 'SALE_EVENT_COMPATIBILITY_BEFORE_ORDER_DELETE_WRONG_ORDER'),
'sale'
);
}
$id = $order->getId();
static::setDisableEvent(true);
foreach(GetModuleEvents("sale", static::EVENT_COMPATIBILITY_ON_BEFORE_ORDER_DELETE, true) as $oldEvent)
{
if (ExecuteModuleEventEx($oldEvent, array($id)) === false)
{
return new MainEventResult(
MainEventResult::SUCCESS,
false,
'sale');
}
}
static::setDisableEvent(false);
return new MainEventResult( MainEventResult::SUCCESS, null, 'sale');
}