Index: branches/5.2.x/units/products/products_event_handler.php =================================================================== diff -u -N -r15149 -r15213 --- branches/5.2.x/units/products/products_event_handler.php (.../products_event_handler.php) (revision 15149) +++ branches/5.2.x/units/products/products_event_handler.php (.../products_event_handler.php) (revision 15213) @@ -1,6 +1,6 @@ Load($ord_id); - $email_event_admin =& $this->Application->EmailEventAdmin('BACKORDER.FULLFILL'); + $this->Application->EmailEventAdmin('BACKORDER.FULLFILL'); //reserve what's possible in any case - $this->Application->HandleEvent( $event, 'ord:OnReserveItems' ); - if ($event->status == kEvent::erSUCCESS) { // + $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' ); + $this->Application->HandleEvent($event, 'ord:OnOrderProcess'); } } } @@ -769,13 +771,13 @@ $send_params['from_name']=$my_name; $send_params['message']=$my_message; - if (preg_match('/'.REGEX_EMAIL_USER.'@'.REGEX_EMAIL_DOMAIN.'/', $friend_email)) { + if ( preg_match('/' . REGEX_EMAIL_USER . '@' . REGEX_EMAIL_DOMAIN . '/', $friend_email) ) { $user_id = $this->Application->RecallVar('user_id'); - $email_event = &$this->Application->EmailEventUser('PRODUCT.SUGGEST', $user_id, $send_params); - $email_event = &$this->Application->EmailEventAdmin('PRODUCT.SUGGEST'); + $email_sent = $this->Application->EmailEventUser('PRODUCT.SUGGEST', $user_id, $send_params); + $this->Application->EmailEventAdmin('PRODUCT.SUGGEST'); - if ($email_event->status == kEvent::erSUCCESS){ - $event->setRedirectParams(Array('opener' => 's', 'pass' => 'all')); + if ( $email_sent ) { + $event->setRedirectParams(Array ('opener' => 's', 'pass' => 'all')); $event->redirect = $this->Application->GetVar('template_success'); } else { @@ -785,11 +787,11 @@ $object->SetError('Email', 'send_error', 'lu_email_send_error'); $event->status = kEvent::erFAIL; } - } - else { + } + else { $object->SetError('Email', 'invalid_email', 'lu_InvalidEmail'); $event->status = kEvent::erFAIL; - } + } } /**