Index: branches/5.2.x/units/products/products_event_handler.php =================================================================== diff -u -N -r15386 -r15540 --- branches/5.2.x/units/products/products_event_handler.php (.../products_event_handler.php) (revision 15386) +++ branches/5.2.x/units/products/products_event_handler.php (.../products_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ GetDBField('InventoryStatus') == 2) { // inventory by options (use first selected combination in grid) - $combination_id = array_shift( array_keys( $this->Application->GetVar('poc_grid') ) ); + $combinations = $this->Application->GetVar('poc_grid'); + list ($combination_id, ) = each($combinations); } else { // inventory by product @@ -945,21 +946,25 @@ $this->Conn->Query($sql); } - function OnPackageApprove($event){ + protected function OnPackageApprove(kEvent $event) + { $field_values = $event->getEventParam('field_values'); $item_data = unserialize($field_values['ItemData']); $package_content_ids = $item_data['PackageContent']; + $object_item = $this->Application->recallObject('p.packageitem', null, array ('skip_autoload' => true)); + /* @var $object_item ProductsItem */ - - $object_item = &$this->Application->recallObject('p.packageitem', null, array('skip_autoload'=>true)); foreach ($package_content_ids as $package_item_id) { - $object_field_values = array(); - // query processing data from product and run approve event - $sql = 'SELECT ProcessingData FROM '.TABLE_PREFIX.'Products WHERE ProductId = '.$package_item_id; + $object_field_values = array (); + + // query processing data from product and run approve event + $sql = 'SELECT ProcessingData + FROM ' . TABLE_PREFIX . 'Products + WHERE ProductId = ' . $package_item_id; $processing_data = $this->Conn->GetOne($sql); - if($processing_data) - { + + if ( $processing_data ) { $processing_data = unserialize($processing_data); $approve_event = new kEvent($processing_data['ApproveEvent']); @@ -974,10 +979,7 @@ $approve_event->setEventParam('field_values', $object_field_values); $this->Application->HandleEvent($approve_event); } - - } - } /** @@ -1219,7 +1221,7 @@ } - function ProcessPackageItems($event) + function ProcessPackageItems(kEvent $event) { //$this->Application->SetVar('p_mode', 't'); @@ -1239,7 +1241,7 @@ /* $this->Application->SetVar('p_mode', false); - $list = &$this->Application->recallObject('p.content', 'p_List', array('types'=>'content')); + $list = $this->Application->recallObject('p.content', 'p_List', array('types'=>'content')); $this->Application->SetVar('p_mode', 't');