mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Keep original field names when export definition is created from import definition
This commit is contained in:
parent
5c8bf4ec27
commit
bf9632b14a
@ -294,6 +294,9 @@ class importexport_definitions_bo {
|
||||
// Try to use heading from import file, if possible
|
||||
$e_options['mapping'][$field] = $i_options['csv_fields'][$col_num] ? $i_options['csv_fields'][$col_num] : $field;
|
||||
}
|
||||
// Keep field names
|
||||
$e_options['no_header_translation'] = true;
|
||||
|
||||
$export->plugin_options = $e_options;
|
||||
|
||||
// Permissions
|
||||
|
@ -155,20 +155,23 @@ class importexport_export_csv implements importexport_iface_export_record
|
||||
if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= $part2; // Handle apps with _ in the name
|
||||
|
||||
// Get translations from wizard, if possible
|
||||
$backtrace = debug_backtrace();
|
||||
$plugin = $backtrace[1]['class'];
|
||||
$wizard_name = $appname . '_wizard_' . str_replace($appname . '_', '', $plugin);
|
||||
try {
|
||||
$wizard = new $wizard_name;
|
||||
$fields = $wizard->get_export_fields();
|
||||
foreach($this->mapping as $field => &$label)
|
||||
{
|
||||
if($fields[$field]) $label = $fields[$field];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
translation::add_app($appname);
|
||||
foreach($this->mapping as $field => &$label) {
|
||||
$label = lang($label);
|
||||
if(!$this->csv_options['no_header_translation'])
|
||||
{
|
||||
$backtrace = debug_backtrace();
|
||||
$plugin = $backtrace[1]['class'];
|
||||
$wizard_name = $appname . '_wizard_' . str_replace($appname . '_', '', $plugin);
|
||||
try {
|
||||
$wizard = new $wizard_name;
|
||||
$fields = $wizard->get_export_fields();
|
||||
foreach($this->mapping as $field => &$label)
|
||||
{
|
||||
if($fields[$field]) $label = $fields[$field];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
translation::add_app($appname);
|
||||
foreach($this->mapping as $field => &$label) {
|
||||
$label = lang($label);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,18 @@ class importexport_wizard_basic_export_csv
|
||||
// return from step30
|
||||
if ($content['step'] == 'wizard_step30')
|
||||
{
|
||||
$content['mapping'] = array_combine($content['fields']['export'], $content['fields']['export']);
|
||||
foreach($content['fields']['export'] as $field_name)
|
||||
{
|
||||
// Preserve original field names, where available
|
||||
if($content['plugin_options']['no_header_translation'] && $content['plugin_options']['mapping'][$field_name])
|
||||
{
|
||||
$content['mapping'][$field_name] = $content['plugin_options']['mapping'][$field_name];
|
||||
}
|
||||
else
|
||||
{
|
||||
$content['mapping'][$field_name] = $field_name;
|
||||
}
|
||||
}
|
||||
if($content['mapping']['all_custom_fields']) {
|
||||
// Need the appname during actual export, to fetch the fields
|
||||
$parts = explode('_', get_class($this));
|
||||
|
Loading…
Reference in New Issue
Block a user