Index: branches/5.2.x/units/products/products_event_handler.php =================================================================== diff -u -N -r16015 -r16197 --- branches/5.2.x/units/products/products_event_handler.php (.../products_event_handler.php) (revision 16015) +++ branches/5.2.x/units/products/products_event_handler.php (.../products_event_handler.php) (revision 16197) @@ -1,6 +1,6 @@ Conn->GetCol($query); - if (!$orders) return; + if ( !$orders ) { + return; + } - $order = $this->Application->recallObject('ord.-inv', null, Array('skip_autoload' => true)); + /** @var OrdersItem $order */ + $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); + // Reserve what's possible in any case. + $reserve_event = new kEvent('ord:OnReserveItems'); + $this->Application->HandleEvent($reserve_event); - if ( $event->status == kEvent::erSUCCESS ) { // - //in case the order is ready to process - process it - $this->Application->HandleEvent($event, 'ord:OnOrderProcess'); + // In case the order is ready to process - process it. + if ( $reserve_event->status == kEvent::erSUCCESS ) { + $this->Application->HandleEvent(new kEvent('ord:OnOrderProcess')); } } }