Index: in-commerce/install/upgrades.php =================================================================== --- in-commerce/install/upgrades.php (revision 15198) +++ in-commerce/install/upgrades.php (working copy) @@ -58,6 +58,7 @@ '5.1.3' => Array ('Core' => '5.1.3'), '5.2.0-B1' => Array ('Core' => '5.2.0-B1'), '5.2.0-B2' => Array ('Core' => '5.2.0-B2'), + '5.2.0-B3' => Array ('Core' => '5.2.0-B3'), ); } Index: in-commerce/install/upgrades.sql =================================================================== --- in-commerce/install/upgrades.sql (revision 15165) +++ in-commerce/install/upgrades.sql (working copy) @@ -263,3 +263,5 @@ # ===== v 5.2.0-B2 ===== UPDATE Products main_table SET main_table.CachedReviewsQty = (SELECT COUNT(*) FROM <%TABLE_PREFIX%>CatalogReviews review_table WHERE review_table.ItemId = main_table.ResourceId); + +# ===== v 5.2.0-B3 ===== Index: in-commerce/units/orders/orders_event_handler.php =================================================================== --- in-commerce/units/orders/orders_event_handler.php (revision 15172) +++ in-commerce/units/orders/orders_event_handler.php (working copy) @@ -2186,7 +2186,7 @@ $shipping_email = $object->GetDBField('ShippingEmail'); $email_params['to_email'] = $shipping_email ? $shipping_email : $email_params['_user_email']; - $email_event_user =& $this->Application->EmailEventUser('ORDER.SHIP', $object->GetDBField('PortalUserId'), $email_params); + $this->Application->EmailEventUser('ORDER.SHIP', $object->GetDBField('PortalUserId'), $email_params); // inform payment gateway that order was shipped $gw_data = $object->getGatewayData(); @@ -2210,7 +2210,7 @@ if ($this->ReadyToProcess($object->GetID())) { $event->CallSubEvent('OnReserveItems'); if ($event->status == kEvent::erSUCCESS) $set_new_status = true; - $email_event_user =& $this->Application->EmailEventUser('BACKORDER.PROCESS', $object->GetDBField('PortalUserId'), $email_params); + $this->Application->EmailEventUser('BACKORDER.PROCESS', $object->GetDBField('PortalUserId'), $email_params); } else { $event->status = kEvent::erFAIL; } @@ -2872,8 +2872,8 @@ $sub_order->SetDBField('Status', ORDER_STATUS_BACKORDERS); if ($event->Special != 'recurring') { // just in case if admin uses tangible backordered products in recurring orders - $email_event_user =& $this->Application->EmailEventUser('BACKORDER.ADD', $sub_order->GetDBField('PortalUserId'), $this->OrderEmailParams($sub_order)); - $email_event_admin =& $this->Application->EmailEventAdmin('BACKORDER.ADD'); + $this->Application->EmailEventUser('BACKORDER.ADD', $sub_order->GetDBField('PortalUserId'), $this->OrderEmailParams($sub_order)); + $this->Application->EmailEventAdmin('BACKORDER.ADD'); } } else { @@ -3511,15 +3511,15 @@ if ($complete_event->status == kEvent::erSUCCESS) { //send recurring ok email - $email_event_user =& $this->Application->EmailEventUser('ORDER.RECURRING.PROCESSED', $order->GetDBField('PortalUserId'), $this->OrderEmailParams($order)); - $email_event_admin =& $this->Application->EmailEventAdmin('ORDER.RECURRING.PROCESSED'); + $this->Application->EmailEventUser('ORDER.RECURRING.PROCESSED', $order->GetDBField('PortalUserId'), $this->OrderEmailParams($order)); + $this->Application->EmailEventAdmin('ORDER.RECURRING.PROCESSED'); } else { //send Recurring failed event $order->SetDBField('Status', ORDER_STATUS_DENIED); $order->Update(); - $email_event_user =& $this->Application->EmailEventUser('ORDER.RECURRING.DENIED', $order->GetDBField('PortalUserId'), $this->OrderEmailParams($order)); - $email_event_admin =& $this->Application->EmailEventAdmin('ORDER.RECURRING.DENIED'); + $this->Application->EmailEventUser('ORDER.RECURRING.DENIED', $order->GetDBField('PortalUserId'), $this->OrderEmailParams($order)); + $this->Application->EmailEventAdmin('ORDER.RECURRING.DENIED'); } } Index: in-commerce/units/products/products_event_handler.php =================================================================== --- in-commerce/units/products/products_event_handler.php (revision 15165) +++ in-commerce/units/products/products_event_handler.php (working copy) @@ -295,13 +295,15 @@ foreach ($orders as $ord_id) { $order->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; - } + } } /** Index: in-link/install/upgrades.php =================================================================== --- in-link/install/upgrades.php (revision 15199) +++ in-link/install/upgrades.php (working copy) @@ -57,6 +57,7 @@ '5.1.3' => Array ('Core' => '5.1.3'), '5.2.0-B1' => Array ('Core' => '5.2.0-B1'), '5.2.0-B2' => Array ('Core' => '5.2.0-B2'), + '5.2.0-B3' => Array ('Core' => '5.2.0-B3'), ); } Index: in-link/install/upgrades.sql =================================================================== --- in-link/install/upgrades.sql (revision 15165) +++ in-link/install/upgrades.sql (working copy) @@ -187,3 +187,5 @@ # ===== v 5.2.0-B2 ===== UPDATE Link main_table SET main_table.CachedReviewsQty = (SELECT COUNT(*) FROM <%TABLE_PREFIX%>CatalogReviews review_table WHERE review_table.ItemId = main_table.ResourceId); + +# ===== v 5.2.0-B3 ===== Index: in-link/units/links/links_event_handler.php =================================================================== --- in-link/units/links/links_event_handler.php (revision 15165) +++ in-link/units/links/links_event_handler.php (working copy) @@ -328,9 +328,9 @@ 'to_linkname' => $object->GetField('Name'), ); - $email_event =& $this->Application->EmailEventUser('LINK.CONTACTFORM', $object->GetDBField('CreatedById'), $send_params); + $email_sent = $this->Application->EmailEventUser('LINK.CONTACTFORM', $object->GetDBField('CreatedById'), $send_params); - if ($email_event->status == kEvent::erSUCCESS) { + if ( $email_sent ) { $event->redirect = $this->Application->GetVar('success_template'); $redirect_params = Array ( Index: in-link/units/listings/listings_event_handler.php =================================================================== --- in-link/units/listings/listings_event_handler.php (revision 15165) +++ in-link/units/listings/listings_event_handler.php (working copy) @@ -414,8 +414,8 @@ $sql = 'SELECT CreatedById FROM '.$this->Application->getUnitOption('l', 'TableName').' WHERE ResourceId = '.$object->GetDBField('ItemResourceId'); - $email_event_user =& $this->Application->EmailEventUser('LINK.ENHANCE', $this->Conn->GetOne($sql)); - $email_event_admin =& $this->Application->EmailEventAdmin('LINK.ENHANCE'); + $this->Application->EmailEventUser('LINK.ENHANCE', $this->Conn->GetOne($sql)); + $this->Application->EmailEventAdmin('LINK.ENHANCE'); break; } @@ -569,8 +569,8 @@ $sql = 'SELECT CreatedById FROM ' . $this->Application->getUnitOption('l', 'TableName') . ' WHERE ResourceId = ' . $object->GetDBField('ItemResourceId'); - $email_event_user =& $this->Application->EmailEventUser('LINK.ENHANCE.DENY', $this->Conn->GetOne($sql)); - $email_event_admin =& $this->Application->EmailEventAdmin('LINK.ENHANCE.DENY'); + $this->Application->EmailEventUser('LINK.ENHANCE.DENY', $this->Conn->GetOne($sql)); + $this->Application->EmailEventAdmin('LINK.ENHANCE.DENY'); } } } @@ -688,8 +688,8 @@ $sql = 'SELECT CreatedById FROM '.$this->Application->getUnitOption('l', 'TableName').' WHERE ResourceId = '.$object->GetDBField('ItemResourceId'); - $email_event_user =& $this->Application->EmailEventUser('LINK.ENHANCE.EXTEND', $this->Conn->GetOne($sql)); - $email_event_admin =& $this->Application->EmailEventAdmin('LINK.ENHANCE.EXTEND'); + $this->Application->EmailEventUser('LINK.ENHANCE.EXTEND', $this->Conn->GetOne($sql)); + $this->Application->EmailEventAdmin('LINK.ENHANCE.EXTEND'); } /** @@ -747,8 +747,8 @@ $sql = 'SELECT CreatedById FROM '.$this->Application->getUnitOption('l', 'TableName').' WHERE ResourceId = '.$object->GetDBField('ItemResourceId'); - $email_event_user =& $this->Application->EmailEventUser('LINK.ENHANCE.EXPIRE', $this->Conn->GetOne($sql)); - $email_event_admin =& $this->Application->EmailEventAdmin('LINK.ENHANCE.EXPIRE'); + $this->Application->EmailEventUser('LINK.ENHANCE.EXPIRE', $this->Conn->GetOne($sql)); + $this->Application->EmailEventAdmin('LINK.ENHANCE.EXPIRE'); } } @@ -766,8 +766,8 @@ $listing_ids = Array(); foreach($res as $record) { - $email_event_user =& $this->Application->EmailEventUser('LINK.ENHANCE.RENEWAL.NOTICE', $record['CreatedById']); - $email_event_admin =& $this->Application->EmailEventAdmin('LINK.ENHANCE.RENEWAL.NOTICE'); + $this->Application->EmailEventUser('LINK.ENHANCE.RENEWAL.NOTICE', $record['CreatedById']); + $this->Application->EmailEventAdmin('LINK.ENHANCE.RENEWAL.NOTICE'); $listing_ids[] = $record['ListingId']; } $sql = 'UPDATE '.$this->Application->getUnitOption($event->Prefix, 'TableName').'