Index: branches/5.2.x/units/destinations/dst_event_handler.php =================================================================== diff -u -N -r15149 -r15540 --- branches/5.2.x/units/destinations/dst_event_handler.php (.../dst_event_handler.php) (revision 15149) +++ branches/5.2.x/units/destinations/dst_event_handler.php (.../dst_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ getObject(); /* @var $object kDBItem */ - $zone_object = &$this->Application->recallObject('z'); + $zone_object = $this->Application->recallObject('z'); + /* @var $zone_object kDBItem */ + $zone_id = (int)$zone_object->GetID(); $zone_type = $zone_object->GetDBField('Type'); Index: branches/5.2.x/units/affiliate_payment_types/affiliate_payment_types_event_handler.php =================================================================== diff -u -N -r15149 -r15540 --- branches/5.2.x/units/affiliate_payment_types/affiliate_payment_types_event_handler.php (.../affiliate_payment_types_event_handler.php) (revision 15149) +++ branches/5.2.x/units/affiliate_payment_types/affiliate_payment_types_event_handler.php (.../affiliate_payment_types_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ Conn->Query($sql); - $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') ); - $object->SetDBField($status_field, 1); + $object->SetDBField($object->getStatusField(), 1); } } Index: branches/5.2.x/units/pricing/pricing_event_handler.php =================================================================== diff -u -N -r15149 -r15540 --- branches/5.2.x/units/pricing/pricing_event_handler.php (.../pricing_event_handler.php) (revision 15149) +++ branches/5.2.x/units/pricing/pricing_event_handler.php (.../pricing_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ getObject(); /* @var $object kDBItem */ - $zone_object = &$this->Application->recallObject('tax'); + $zone_object = $this->Application->recallObject('tax'); + /* @var $zone_object kDBItem */ + $zone_id = (int)$this->Application->GetVar('tax_id'); $zone_type = $zone_object->GetDBField('Type'); Index: branches/5.2.x/units/orders/orders_event_handler.php =================================================================== diff -u -N -r15213 -r15540 --- branches/5.2.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 15213) +++ branches/5.2.x/units/orders/orders_event_handler.php (.../orders_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ Application->getUnitOption($event->Prefix, 'StatusField')); + $status_field = $order_dummy->getStatusField(); + if ( isset($field_values[$status_field]) && $order_dummy->GetDBField($status_field) != $field_values[$status_field] ) { // user can't change status by himself return false; @@ -3389,7 +3390,7 @@ */ function OnGoToOrder($event) { - $id = array_shift( $this->StoreSelectedIDs($event) ); + $id = current($this->StoreSelectedIDs($event)); $id_field = $this->Application->getUnitOption($event->Prefix,'IDField'); $table = $this->Application->getUnitOption($event->Prefix,'TableName'); Index: branches/5.2.x/units/payment_type/payment_type_event_handler.php =================================================================== diff -u -N -r15149 -r15540 --- branches/5.2.x/units/payment_type/payment_type_event_handler.php (.../payment_type_event_handler.php) (revision 15149) +++ branches/5.2.x/units/payment_type/payment_type_event_handler.php (.../payment_type_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ getSelectedIDs($event); if ( $ids ) { - $status_field = array_shift($this->Application->getUnitOption($event->Prefix, 'StatusField')); + $status_field = $object->getStatusField(); foreach ($ids as $id) { $object->Load($id); @@ -120,7 +120,7 @@ $object = $event->getObject(); /* @var $object kDBItem */ - $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') ); + $status_field = $object->getStatusField(); if ( $object->GetDBField('IsPrimary') == 1 && $object->GetDBField($status_field) == 0 ) { $object->SetDBField($status_field, 1); Index: branches/5.2.x/units/zones/zones_event_handler.php =================================================================== diff -u -N -r15149 -r15540 --- branches/5.2.x/units/zones/zones_event_handler.php (.../zones_event_handler.php) (revision 15149) +++ branches/5.2.x/units/zones/zones_event_handler.php (.../zones_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ Application->recallObject('dst'); + $destinations = $this->Application->recallObject('dst'); + /* @var $destinations kDBItem */ $queryDel="DELETE FROM ".$destinations->TableName." WHERE ShippingZoneId=".$this->Application->GetVar($event->Prefix.'_id'); $this->Conn->Query($queryDel); @@ -242,7 +243,7 @@ { parent::OnCancel($event); - $dst_object = &$this->Application->recallObject('dst'); + $dst_object = $this->Application->recallObject('dst'); /* @var $dst_object kDBItem */ $sql = 'DELETE FROM ' . $dst_object->TableName . ' Index: branches/5.2.x/units/affiliates/affiliates_event_handler.php =================================================================== diff -u -N -r15149 -r15540 --- branches/5.2.x/units/affiliates/affiliates_event_handler.php (.../affiliates_event_handler.php) (revision 15149) +++ branches/5.2.x/units/affiliates/affiliates_event_handler.php (.../affiliates_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ StoreSelectedIDs($event); if ( $ids ) { - $status_field = array_shift($this->Application->getUnitOption($event->Prefix, 'StatusField')); + $status_field = $object->getStatusField(); foreach ($ids as $id) { $object->Load($id); 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'); Index: branches/5.2.x/units/affiliate_plans/affiliate_plans_event_handler.php =================================================================== diff -u -N -r15149 -r15540 --- branches/5.2.x/units/affiliate_plans/affiliate_plans_event_handler.php (.../affiliate_plans_event_handler.php) (revision 15149) +++ branches/5.2.x/units/affiliate_plans/affiliate_plans_event_handler.php (.../affiliate_plans_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ Conn->Query($sql); - $status_field = array_shift($this->Application->getUnitOption($event->Prefix, 'StatusField')); - $object->SetDBField($status_field, 1); + $object->SetDBField($object->getStatusField(), 1); } } Index: branches/5.2.x/units/taxes/taxes_event_handler.php =================================================================== diff -u -N -r15149 -r15540 --- branches/5.2.x/units/taxes/taxes_event_handler.php (.../taxes_event_handler.php) (revision 15149) +++ branches/5.2.x/units/taxes/taxes_event_handler.php (.../taxes_event_handler.php) (revision 15540) @@ -1,6 +1,6 @@ Application->recallObject('taxdst'); + $destinations = $this->Application->recallObject('taxdst'); + /* @var $destinations kDBItem */ $queryDel="DELETE FROM ".$destinations->TableName." WHERE TaxZoneId=".(int)$this->Application->GetVar('tax_id'); $this->Conn->Query($queryDel); Index: branches/5.2.x/units/brackets/brackets_tag_processor.php =================================================================== diff -u -N -r15141 -r15540 --- branches/5.2.x/units/brackets/brackets_tag_processor.php (.../brackets_tag_processor.php) (revision 15141) +++ branches/5.2.x/units/brackets/brackets_tag_processor.php (.../brackets_tag_processor.php) (revision 15540) @@ -1,6 +1,6 @@ SelectParam($params, 'name,field'); - if ( ($params['field'] == 'Start' || $params['name'] == 'End') && $value == -1) { + if ( ($field == 'Start' || $field == 'End') && $value == -1 ) { $value = '∞'; } @@ -29,6 +30,8 @@ function ShowBracketsForm($params) { $shipping_object = $this->Application->recallObject('s'); + /* @var $shipping_object kDBItem */ + $default_start = ($shipping_object->GetDBField('Type') == 1) ? 0 : 1; $brackets_helper = $this->Application->recallObject('BracketsHelper'); Index: branches/5.2.x/units/shipping/shipping_tag_processor.php =================================================================== diff -u -N -r15156 -r15540 --- branches/5.2.x/units/shipping/shipping_tag_processor.php (.../shipping_tag_processor.php) (revision 15156) +++ branches/5.2.x/units/shipping/shipping_tag_processor.php (.../shipping_tag_processor.php) (revision 15540) @@ -1,6 +1,6 @@ getObject($params); + /* @var $object kDBItem */ + + $o = ''; $selected = trim($object->GetDBField('PortalGroups'), ','); $selected_arr = explode(',', $selected); - $all_groups = $this->Conn->Query('SELECT GroupId, Name FROM '.TABLE_PREFIX.'UserGroups ORDER BY NAME', 'GroupId'); - $o = ''; - foreach ($all_groups as $a_group) - { + $sql = 'SELECT GroupId, Name + FROM ' . TABLE_PREFIX . 'UserGroups + ORDER BY Name'; + $all_groups = $this->Conn->Query($sql, 'GroupId'); + + $mode = array_key_exists('mode', $params) ? $params['mode'] : false; + + foreach ($all_groups as $a_group) { $is_selected = in_array($a_group['GroupId'], $selected_arr); - $continue = $params['mode'] == 'selected' ? !$is_selected : $is_selected; - if ($continue) continue; + $continue = $mode == 'selected' ? !$is_selected : $is_selected; + + if ( $continue ) { + continue; + } + $block_params = $a_group; - $block_params['name'] = $params['render_as']; + $block_params['name'] = $params['render_as']; $o .= $this->Application->ParseBlock($block_params); } + return $o; } } \ No newline at end of file Index: branches/5.2.x/units/products/products_tag_processor.php =================================================================== diff -u -N -r15156 -r15540 --- branches/5.2.x/units/products/products_tag_processor.php (.../products_tag_processor.php) (revision 15156) +++ branches/5.2.x/units/products/products_tag_processor.php (.../products_tag_processor.php) (revision 15540) @@ -1,6 +1,6 @@ Application->recallObject('rel'); +// $related = $this->Application->recallObject('rel'); + return $this->PrintList2($params); } @@ -536,13 +537,17 @@ function IsSubscription($params) { - $object = &$this->Application->recallObject($this->getPrefixSpecial()); + $object = $this->getObject($params); + /* @var $object kDBItem */ + return ($object->GetDBField('Type') == 2); } function IsTangible($params) { - $object = &$this->Application->recallObject($this->getPrefixSpecial()); + $object = $this->getObject($params); + /* @var $object kDBItem */ + return ($object->GetDBField('Type') == 1); }