Index: branches/RC/core/kernel/utility/formatters/customfield_formatter.php =================================================================== diff -u --- branches/RC/core/kernel/utility/formatters/customfield_formatter.php (revision 0) +++ branches/RC/core/kernel/utility/formatters/customfield_formatter.php (revision 9234) @@ -0,0 +1,32 @@ +GetFieldOptions($field_name); + + $master_field = isset($options['master_field']) ? $options['master_field'] : false; + if (!$master_field) { + return $value; + } + + $format = isset($format) ? $format : ( isset($options['format']) ? $options['format'] : null); + + if ($value == '' && $format != 'no_default') { // try to get default language value + $def_lang_value = $object->GetDBField($master_field); + if ($def_lang_value == '') return NULL; + return $def_lang_value; //return value from default language + } + + return $value; + } + + } + +?> \ No newline at end of file Index: branches/RC/core/kernel/utility/formatters/formatters_config.php =================================================================== diff -u -r8929 -r9234 --- branches/RC/core/kernel/utility/formatters/formatters_config.php (.../formatters_config.php) (revision 8929) +++ branches/RC/core/kernel/utility/formatters/formatters_config.php (.../formatters_config.php) (revision 9234) @@ -2,9 +2,9 @@ $config = Array( 'Prefix' => 'formatters', - + 'EventHandlerClass' => Array('class' => 'kEventHandler', 'file' => '', 'build_event' => 'OnBuild'), - + 'RegisterClasses' => Array( Array('pseudo'=>'kFormatter','class'=>'kFormatter','file'=>'formatter.php','build_event'=>'','require_classes'=>''), Array('pseudo'=>'kOptionsFormatter','class'=>'kOptionsFormatter','file'=>'options_formatter.php','build_event'=>'','require_classes'=>'kFormatter'), @@ -18,5 +18,6 @@ Array('pseudo'=>'kUnitFormatter','class'=>'kUnitFormatter','file'=>'unit_formatter.php','build_event'=>'','require_classes'=>'kFormatter'), Array('pseudo'=>'kFilesizeFormatter','class'=>'kFilesizeFormatter','file'=>'filesize_formatter.php','build_event'=>'','require_classes'=>'kFormatter'), Array('pseudo'=>'kSerializedFormatter','class'=>'kSerializedFormatter','file'=>'serialized_formatter.php','build_event'=>'','require_classes'=>'kFormatter'), + Array('pseudo'=>'kCustomFieldFormatter','class'=>'kCustomFieldFormatter','file'=>'customfield_formatter.php','build_event'=>'','require_classes'=>'kFormatter'), ), ); Index: branches/RC/core/units/custom_data/custom_data_event_handler.php =================================================================== diff -u -r8929 -r9234 --- branches/RC/core/units/custom_data/custom_data_event_handler.php (.../custom_data_event_handler.php) (revision 8929) +++ branches/RC/core/units/custom_data/custom_data_event_handler.php (.../custom_data_event_handler.php) (revision 9234) @@ -94,11 +94,13 @@ $virtual_fields = $this->Application->getUnitOption($prefix, 'VirtualFields', Array()); $cf_helper =& $this->Application->recallObject('InpCustomFieldsHelper'); - $field_options = Array('type' => 'string', 'not_null' => 1, 'default' => ''); $ml_formatter =& $this->Application->recallObject('kMultiLanguage'); /* @var $ml_formatter kMultiLanguage */ foreach ($custom_fields as $custom_id => $custom_params) { + $custom_name = $custom_params['FieldName']; + $field_options = Array('type' => 'string', 'not_null' => 1, 'default' => ''); + switch ($custom_params['ElementType']) { case 'date': case 'datetime': @@ -116,11 +118,15 @@ break; default: - unset($field_options['options'], $field_options['formatter']); + 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'; + } break; } - $custom_name = $custom_params['FieldName']; $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(); Index: branches/RC/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -r9131 -r9234 --- branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 9131) +++ branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 9234) @@ -3,13 +3,13 @@ class kUnitConfigReader extends kBase { /** - * Configs readed - * - * @var Array - * @access private - */ - var $configData=Array(); - var $configFiles=Array(); + * Configs readed + * + * @var Array + * @access private + */ + var $configData = Array(); + var $configFiles = Array(); var $CacheExpired = false;