Index: branches/5.2.x/units/products/products_event_handler.php =================================================================== --- branches/5.2.x/units/products/products_event_handler.php +++ branches/5.2.x/units/products/products_event_handler.php @@ -291,21 +291,25 @@ $orders = $this->Conn->GetCol($query); - if (!$orders) return; + if ( !$orders ) { + return; + } + + /** @var OrdersItem $order */ + $order = $this->Application->recallObject('ord.-inv', null, array('skip_autoload' => true)); - $order = $this->Application->recallObject('ord.-inv', null, Array('skip_autoload' => true)); foreach ($orders as $ord_id) { $order->Load($ord_id); $this->Application->emailAdmin('BACKORDER.FULLFILL'); - //reserve what's possible in any case - $event = new kEvent('ord:OnReserveItems'); - $this->Application->HandleEvent($event); - - if ( $event->status == kEvent::erSUCCESS ) { // - //in case the order is ready to process - process it - $this->Application->HandleEvent($event, 'ord:OnOrderProcess'); + // Reserve what's possible in any case. + $reserve_event = new kEvent('ord:OnReserveItems'); + $this->Application->HandleEvent($reserve_event); + + // In case the order is ready to process - process it. + if ( $reserve_event->status == kEvent::erSUCCESS ) { + $this->Application->HandleEvent(new kEvent('ord:OnOrderProcess')); } } }