Attached Files |
misc_notice_fixes_core.patch [^] (6,518 bytes) 2012-09-14 10:36
[Show Content]
Index: admin_templates/incs/form_blocks.tpl
===================================================================
--- admin_templates/incs/form_blocks.tpl (revision 15446)
+++ admin_templates/incs/form_blocks.tpl (working copy)
@@ -513,7 +513,7 @@
</inp2:m_RenderElement>
</inp2:m_DefineElement>
-<inp2:m_DefineElement name="inp_edit_fck" class="" maxlength="" bgcolor="" body_class="" body_id="" onblur="" format="" size="" onkeyup="" style="" has_caption="0" control_options="false">
+<inp2:m_DefineElement name="inp_edit_fck" class="" title="la_fld_{$field}" maxlength="" bgcolor="" body_class="" body_id="" onblur="" format="" size="" onkeyup="" style="" has_caption="0" control_options="false">
<inp2:m_RenderElement design="form_row" pass_params="1">
<td class="control-cell" style="padding: 0px;" colspan="3" onmouseover="show_form_error('<inp2:m_Param name='prefix' js_escape='1'/>', '<inp2:m_Param name='field' js_escape='1'/>')" onmouseout="hide_form_error('<inp2:m_Param name='prefix' js_escape='1'/>')">
<inp2:FCKEditor field="$field" width="100%" height="200" bgcolor="$bgcolor" body_class="$body_class" body_id="$body_id" format="$format" late_load="1"/>
Index: kernel/db/cat_dbitem.php
===================================================================
--- kernel/db/cat_dbitem.php (revision 15454)
+++ kernel/db/cat_dbitem.php (working copy)
@@ -473,11 +473,13 @@
function ChangeStatus($new_status, $pending_editing = false)
{
- $status_field = array_shift( $this->Application->getUnitOption($this->Prefix,'StatusField') );
- if ($new_status != $this->GetDBField($status_field)) {
+ $status_field = $this->getStatusField();
+
+ if ( $new_status != $this->GetDBField($status_field) ) {
// status was changed
$this->sendEmailEvents($new_status, $pending_editing);
}
+
$this->SetDBField($status_field, $new_status);
return $this->Update();
Index: kernel/db/db_event_handler.php
===================================================================
--- kernel/db/db_event_handler.php (revision 15474)
+++ kernel/db/db_event_handler.php (working copy)
@@ -2250,7 +2250,7 @@
$ids = $this->StoreSelectedIDs($event);
if ( $ids ) {
- $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') );
+ $status_field = $object->getStatusField();
$order_field = $this->Application->getUnitOption($event->Prefix, 'OrderField');
if ( !$order_field ) {
@@ -2899,8 +2899,7 @@
$items_info = $this->Application->GetVar('u');
if ( $items_info ) {
- $user_id = array_shift(array_keys($items_info));
-
+ list ($user_id, ) = each($items_info);
$this->RemoveRequiredFields($object);
$is_new = !$object->isLoaded();
Index: kernel/db/dbitem.php
===================================================================
--- kernel/db/dbitem.php (revision 15474)
+++ kernel/db/dbitem.php (working copy)
@@ -1545,4 +1545,17 @@
$this->Loaded = $is_loaded;
}
+ /**
+ * Returns item's first status field
+ *
+ * @return string
+ * @access public
+ */
+ public function getStatusField()
+ {
+ $status_fields = $this->Application->getUnitOption($this->Prefix, 'StatusField');
+
+ return array_shift($status_fields);
+ }
+
}
\ No newline at end of file
Index: units/admin/admin_tag_processor.php
===================================================================
--- units/admin/admin_tag_processor.php (revision 15539)
+++ units/admin/admin_tag_processor.php (working copy)
@@ -203,10 +203,10 @@
$params['name'] = $this->SelectParam($params, 'name,render_as,block');
$params['section_name'] = $section_name;
- $template = $section_data['url']['t'];
- unset($section_data['url']['t']);
+ $url_params = $section_data['url'];
+ unset($url_params['t']);
- $section_data['section_url'] = $this->Application->HREF($template, '', $section_data['url']);
+ $section_data['section_url'] = $this->Application->HREF($section_data['url']['t'], '', $url_params);
$ret = $this->Application->ParseBlock( array_merge($params, $section_data) );
return $ret;
Index: units/categories/categories_event_handler.php
===================================================================
--- units/categories/categories_event_handler.php (revision 15445)
+++ units/categories/categories_event_handler.php (working copy)
@@ -1527,8 +1527,8 @@
$ids = $this->StoreSelectedIDs($event);
if ( $ids ) {
+ $status_field = $object->getStatusField();
$propagate_category_status = $this->Application->GetVar('propagate_category_status');
- $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') );
foreach ($ids as $id) {
$object->Load($id);
Index: units/users/users_event_handler.php
===================================================================
--- units/users/users_event_handler.php (revision 15437)
+++ units/users/users_event_handler.php (working copy)
@@ -186,7 +186,7 @@
}
$user_dummy->Load($id);
- $status_field = array_shift($this->Application->getUnitOption($event->Prefix, 'StatusField'));
+ $status_field = $user_dummy->getStatusField();
if ( $user_dummy->GetDBField($status_field) != STATUS_ACTIVE ) {
// not active user is not allowed to update his record (he could not activate himself manually)
@@ -1198,7 +1198,7 @@
/* @var $user_dummy kDBItem */
$user_dummy->Load($id);
- $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') );
+ $status_field = $user_dummy->getStatusField();
if ( $user_dummy->GetDBField($status_field) != STATUS_ACTIVE ) {
// not active user is not allowed to update his record (he could not activate himself manually)
@@ -1669,15 +1669,15 @@
$this->clearSelectedIDs($event);
$dst_field = $this->Application->RecallVar('dst_field');
- if ($dst_field != 'PrimaryGroupId') {
- return ;
+ if ( $dst_field != 'PrimaryGroupId' ) {
+ return;
}
- $group_ids = $this->Application->GetVar('g');
- $primary_group_id = $group_ids ? array_shift( array_keys($group_ids) ) : false;
+ $group_ids = array_keys($this->Application->GetVar('g'));
+ $primary_group_id = $group_ids ? array_shift($group_ids) : false;
- if (!$user_ids || !$primary_group_id) {
- return ;
+ if ( !$user_ids || !$primary_group_id ) {
+ return;
}
$table_name = $this->Application->getUnitOption('ug', 'TableName');
misc_notice_fixes_modules.patch [^] (13,751 bytes) 2012-09-14 10:36
[Show Content]
Index: in-commerce/units/affiliate_payment_types/affiliate_payment_types_event_handler.php
===================================================================
--- in-commerce/units/affiliate_payment_types/affiliate_payment_types_event_handler.php (revision 15437)
+++ in-commerce/units/affiliate_payment_types/affiliate_payment_types_event_handler.php (working copy)
@@ -93,8 +93,7 @@
SET IsPrimary = 0';
$this->Conn->Query($sql);
- $status_field = array_shift( $this->Application->getUnitOption($event->Prefix, 'StatusField') );
- $object->SetDBField($status_field, 1);
+ $object->SetDBField($object->getStatusField(), 1);
}
}
Index: in-commerce/units/affiliate_plans/affiliate_plans_event_handler.php
===================================================================
--- in-commerce/units/affiliate_plans/affiliate_plans_event_handler.php (revision 15437)
+++ in-commerce/units/affiliate_plans/affiliate_plans_event_handler.php (working copy)
@@ -96,8 +96,7 @@
SET IsPrimary = 0';
$this->Conn->Query($sql);
- $status_field = array_shift($this->Application->getUnitOption($event->Prefix, 'StatusField'));
- $object->SetDBField($status_field, 1);
+ $object->SetDBField($object->getStatusField(), 1);
}
}
Index: in-commerce/units/affiliates/affiliates_event_handler.php
===================================================================
--- in-commerce/units/affiliates/affiliates_event_handler.php (revision 15437)
+++ in-commerce/units/affiliates/affiliates_event_handler.php (working copy)
@@ -591,7 +591,7 @@
$ids = $this->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: in-commerce/units/brackets/brackets_tag_processor.php
===================================================================
--- in-commerce/units/brackets/brackets_tag_processor.php (revision 15437)
+++ in-commerce/units/brackets/brackets_tag_processor.php (working copy)
@@ -18,8 +18,9 @@
function Field($params)
{
$value = parent::Field($params);
+ $field = $this->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: in-commerce/units/destinations/dst_event_handler.php
===================================================================
--- in-commerce/units/destinations/dst_event_handler.php (revision 15437)
+++ in-commerce/units/destinations/dst_event_handler.php (working copy)
@@ -92,7 +92,9 @@
$object = $event->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: in-commerce/units/orders/orders_event_handler.php
===================================================================
--- in-commerce/units/orders/orders_event_handler.php (revision 15437)
+++ in-commerce/units/orders/orders_event_handler.php (working copy)
@@ -54,7 +54,8 @@
return false;
}
- $status_field = array_shift($this->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: in-commerce/units/payment_type/payment_type_event_handler.php
===================================================================
--- in-commerce/units/payment_type/payment_type_event_handler.php (revision 15437)
+++ in-commerce/units/payment_type/payment_type_event_handler.php (working copy)
@@ -84,7 +84,7 @@
$ids = $this->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: in-commerce/units/pricing/pricing_event_handler.php
===================================================================
--- in-commerce/units/pricing/pricing_event_handler.php (revision 15437)
+++ in-commerce/units/pricing/pricing_event_handler.php (working copy)
@@ -14,7 +14,7 @@
defined('FULL_PATH') or die('restricted access!');
// include globals.php from current folder
-kUtil::includeOnce(MODULES_PATH .'/in-commerce/units/pricing/globals.php');
+kUtil::includeOnce(MODULES_PATH . '/in-commerce/units/pricing/globals.php');
class PricingEventHandler extends kDBEventHandler {
Index: in-commerce/units/products/products_event_handler.php
===================================================================
--- in-commerce/units/products/products_event_handler.php (revision 15437)
+++ in-commerce/units/products/products_event_handler.php (working copy)
@@ -115,7 +115,8 @@
if ($object->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 */
+ foreach ($package_content_ids as $package_item_id) {
+ $object_field_values = array ();
- $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;
+ // 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: in-commerce/units/products/products_tag_processor.php
===================================================================
--- in-commerce/units/products/products_tag_processor.php (revision 15437)
+++ in-commerce/units/products/products_tag_processor.php (working copy)
@@ -177,7 +177,8 @@
function ListRelatedProducts($params)
{
-// $related = &$this->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);
}
Index: in-commerce/units/shipping/shipping_tag_processor.php
===================================================================
--- in-commerce/units/shipping/shipping_tag_processor.php (revision 15437)
+++ in-commerce/units/shipping/shipping_tag_processor.php (working copy)
@@ -13,6 +13,9 @@
defined('FULL_PATH') or die('restricted access!');
+// include globals.php from current folder
+kUtil::includeOnce(MODULES_PATH . '/in-commerce/units/pricing/globals.php');
+
class ShippingTagProcessor extends kDBTagProcessor {
function CostInputSize($params)
@@ -300,24 +303,35 @@
return $o;
}
- function ListGroups($params)
+ protected function ListGroups($params)
{
+ $object = $this->getObject($params);
+ /* @var $object kDBItem */
- $object = $this->getObject($params);
+ $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: in-commerce/units/taxes/taxes_event_handler.php
===================================================================
--- in-commerce/units/taxes/taxes_event_handler.php (revision 15437)
+++ in-commerce/units/taxes/taxes_event_handler.php (working copy)
@@ -239,7 +239,8 @@
function OnCountryChange($event)
{
- $destinations = &$this->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: in-commerce/units/taxesdestinations/taxes_dst_event_handler.php
===================================================================
--- in-commerce/units/taxesdestinations/taxes_dst_event_handler.php (revision 15437)
+++ in-commerce/units/taxesdestinations/taxes_dst_event_handler.php (working copy)
@@ -138,7 +138,9 @@
$object = $event->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: in-commerce/units/zones/zones_event_handler.php
===================================================================
--- in-commerce/units/zones/zones_event_handler.php (revision 15437)
+++ in-commerce/units/zones/zones_event_handler.php (working copy)
@@ -220,7 +220,8 @@
function OnCountryChange($event)
{
- $destinations = &$this->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 . '
|