Index: branches/5.2.x/units/order_items/order_items_event_handler.php =================================================================== diff -u -N -r15047 -r15061 --- branches/5.2.x/units/order_items/order_items_event_handler.php (.../order_items_event_handler.php) (revision 15047) +++ branches/5.2.x/units/order_items/order_items_event_handler.php (.../order_items_event_handler.php) (revision 15061) @@ -1,6 +1,6 @@ Application->isAdmin ) { - return ; + return; } $object =& $event->getObject(); @@ -174,7 +176,7 @@ if ( $changed_fields ) { $table_info = $object->getLinkedInfo(); - $main_object =& $this->Application->recallObject( $table_info['ParentPrefix'] ); + $main_object =& $this->Application->recallObject($table_info['ParentPrefix']); /* @var $main_object OrdersItem */ $oi_string = $object->GetDBField('ProductId') . ':' . $object->GetDBField('OptionsSalt') . ':' . $object->GetDBField('BackOrderFlag'); @@ -183,8 +185,8 @@ $error_code = OrderCheckoutError::FIELD_UPDATE_SUCCESS; if ( $changed_field == 'ItemData' ) { - $item_data_old = unserialize( $change_info['old'] ); - $item_data_new = unserialize( $change_info['new'] ); + $item_data_old = unserialize($change_info['old']); + $item_data_new = unserialize($change_info['new']); if ( $item_data_old['DiscountId'] != $item_data_new['DiscountId'] || $item_data_old['DiscountType'] != $item_data_new['DiscountType'] ) { if ( $item_data_new['DiscountId'] > 0 ) { @@ -258,22 +260,31 @@ function OnSaveItems(&$event) { $event->CallSubEvent('OnUpdate'); + $event->redirect = false; - $event->setRedirectParams(Array('opener'=>'s','pass'=>'all'), true); + $event->SetRedirectParam('opener', 's'); + $event->SetRedirectParam('pass', 'all'); } /** - * Occures after an item has been cloned + * Occurs after an item has been cloned * Id of newly created item is passed as event' 'id' param * * @param kEvent $event + * @return void + * @access protected */ - function OnAfterClone(&$event) + protected function OnAfterClone(kEvent &$event) { + parent::OnAfterClone($event); + $id = $event->getEventParam('id'); - $table = $this->Application->getUnitOption($event->Prefix,'TableName'); - $id_field = $this->Application->getUnitOption($event->Prefix,'IDField'); - $sql = 'UPDATE '.$table.' SET QuantityReserved = NULL WHERE '.$id_field.' = '.$id; + $table = $this->Application->getUnitOption($event->Prefix, 'TableName'); + $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField'); + + $sql = 'UPDATE ' . $table . ' + SET QuantityReserved = NULL + WHERE ' . $id_field . ' = ' . $id; $this->Conn->Query($sql); } @@ -285,7 +296,7 @@ * @return void * @access protected */ - protected function OnAfterItemLoad(&$event) + protected function OnAfterItemLoad(kEvent &$event) { parent::OnAfterItemLoad($event);