Index: branches/unlabeled/unlabeled-1.73.2/core/kernel/db/db_event_handler.php =================================================================== diff -u -r5875 -r5962 --- branches/unlabeled/unlabeled-1.73.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 5875) +++ branches/unlabeled/unlabeled-1.73.2/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 5962) @@ -392,7 +392,7 @@ { $actions =& $this->Application->recallObject('kActions'); $actions->Set($event->Prefix_Special.'_id', $object->GetID() ); - + $use_pending_editing = $this->Application->getUnitOption($event->Prefix, 'UsePendingEditing'); if ($use_pending_editing && $event->Special != 'original') { $this->Application->SetVar($event->Prefix.'.original_id', $object->GetDBField('OrgId')); @@ -427,7 +427,7 @@ $this->SetPagination($event); $this->SetSorting($event); - $object->CalculateTotals(); +// $object->CalculateTotals(); // Now called in getTotals to avoid extra query $actions =& $this->Application->recallObject('kActions'); $actions->Set('remove_specials['.$event->Prefix_Special.']', '0'); @@ -898,7 +898,7 @@ $table_info = $object->getLinkedInfo(); $object->SetDBField($table_info['ForeignKey'], $table_info['ParentId']); - + $event->redirect = false; } @@ -1061,7 +1061,7 @@ } return; } - + $object =& $event->getObject( Array('skip_autoload' => true) ); $items_info = $this->Application->GetVar( $event->getPrefixSpecial(true) ); @@ -1740,7 +1740,7 @@ // no main config of such type return false; } - + // 1. get custom field information $sql = 'SELECT * FROM '.TABLE_PREFIX.'CustomField @@ -1751,44 +1751,44 @@ // config doesn't have custom fields return false; } - + // 2. create fields (for customdata item) $fields = $this->Application->getUnitOption($event->Prefix, 'Fields', Array()); $field_options = Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'db_type' => 'text', 'default' => ''); foreach ($custom_fields as $custom_id => $custom_params) { $fields['cust_'.$custom_id] = $field_options; } $this->Application->setUnitOption($event->Prefix, 'Fields', $fields); - + // 3. create virtual & calculated fields (for main item) $calculated_fields = $this->Application->getUnitOption($main_prefix.'.', 'CalculatedFields', Array()); $virtual_fields = $this->Application->getUnitOption($main_prefix, 'VirtualFields', Array()); - + $cf_helper =& $this->Application->recallObject('InpCustomFieldsHelper'); $field_options = Array('type' => 'string', 'not_null' => 1, 'default' => ''); $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - + foreach ($custom_fields as $custom_id => $custom_params) { switch ($custom_params['ElementType']) { case 'date': case 'datetime': unset($field_options['options']); $field_options['formatter'] = 'kDateFormatter'; break; - + case 'select': case 'radio': if ($custom_params['ValueList']) { $field_options['options'] = $cf_helper->GetValuesHash($custom_params['ValueList']); $field_options['formatter'] = 'kOptionsFormatter'; } break; - + default: unset($field_options['options'], $field_options['formatter']); break; } - + $custom_name = $custom_params['FieldName']; $calculated_fields['cust_'.$custom_name] = 'cust.'.$ml_formatter->LangFieldName('cust_'.$custom_id); if (!isset($virtual_fields['cust_'.$custom_name])) {