Index: branches/5.2.x/core/units/custom_data/custom_data_event_handler.php =================================================================== diff -u -N -r14572 -r14585 --- branches/5.2.x/core/units/custom_data/custom_data_event_handler.php (.../custom_data_event_handler.php) (revision 14572) +++ branches/5.2.x/core/units/custom_data/custom_data_event_handler.php (.../custom_data_event_handler.php) (revision 14585) @@ -1,6 +1,6 @@ Application->getUnitOption($prefix, 'VirtualFields', Array()); $cf_helper =& $this->Application->recallObject('InpCustomFieldsHelper'); - $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); - /* @var $ml_formatter kMultiLanguage */ + /* @var $cf_helper InpCustomFieldsHelper */ $is_install = defined('IS_INSTALL') && IS_INSTALL; @@ -157,10 +156,12 @@ $field_options = Array('type' => 'string', 'default' => $custom_params['DefaultValue']); // raises warnings during 4.3.9 -> 5.0.0 upgrade, no fatal sqls though - if ($custom_params['IsRequired']) { + if ( $custom_params['IsRequired'] ) { $field_options['required'] = 1; } + $calculated_fields['cust_' . $custom_name] = 'cust.l' . $this->Application->GetDefaultLanguageId() .'_cust_' . $custom_id; + switch ($custom_params['ElementType']) { case 'date': unset($field_options['options']); @@ -187,19 +188,16 @@ default: if ($custom_params['MultiLingual']) { - $calculated_fields['cust_'.$custom_name.'_Primary'] = 'cust.'.$ml_formatter->LangFieldName('cust_'.$custom_id, true); - $virtual_fields['cust_'.$custom_name.'_Primary'] = $field_options; - $field_options['master_field'] = 'cust_'.$custom_name.'_Primary'; - $field_options['formatter'] = 'kCustomFieldFormatter'; + $field_options['formatter'] = 'kMultiLanguage'; + $calculated_fields['cust_' . $custom_name] = 'cust.l%2$s_cust_' . $custom_id; } break; } - $calculated_fields['cust_'.$custom_name] = 'cust.'.$ml_formatter->LangFieldName('cust_'.$custom_id, !$custom_params['MultiLingual']); - if (!isset($virtual_fields['cust_'.$custom_name])) { - $virtual_fields['cust_'.$custom_name] = Array(); + if ( !isset($virtual_fields['cust_' . $custom_name]) ) { + $virtual_fields['cust_' . $custom_name] = Array (); } - $virtual_fields['cust_'.$custom_name] = kUtil::array_merge_recursive($field_options, $virtual_fields['cust_'.$custom_name]); + $virtual_fields['cust_' . $custom_name] = kUtil::array_merge_recursive($field_options, $virtual_fields['cust_' . $custom_name]); $custom_fields[$custom_id] = $custom_name; }