mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +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
|
// 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;
|
$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;
|
$export->plugin_options = $e_options;
|
||||||
|
|
||||||
// Permissions
|
// Permissions
|
||||||
|
@ -155,6 +155,8 @@ class importexport_export_csv implements importexport_iface_export_record
|
|||||||
if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= $part2; // Handle apps with _ in the name
|
if(!$GLOBALS['egw_info']['apps'][$appname]) $appname .= $part2; // Handle apps with _ in the name
|
||||||
|
|
||||||
// Get translations from wizard, if possible
|
// Get translations from wizard, if possible
|
||||||
|
if(!$this->csv_options['no_header_translation'])
|
||||||
|
{
|
||||||
$backtrace = debug_backtrace();
|
$backtrace = debug_backtrace();
|
||||||
$plugin = $backtrace[1]['class'];
|
$plugin = $backtrace[1]['class'];
|
||||||
$wizard_name = $appname . '_wizard_' . str_replace($appname . '_', '', $plugin);
|
$wizard_name = $appname . '_wizard_' . str_replace($appname . '_', '', $plugin);
|
||||||
@ -172,6 +174,7 @@ class importexport_export_csv implements importexport_iface_export_record
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$mapping = ! empty( $this->mapping ) ? $this->mapping : array_keys ( $this->record );
|
$mapping = ! empty( $this->mapping ) ? $this->mapping : array_keys ( $this->record );
|
||||||
$mapping = $this->translation->convert( $mapping, $this->translation->charset(), $this->csv_charset );
|
$mapping = $this->translation->convert( $mapping, $this->translation->charset(), $this->csv_charset );
|
||||||
self::fputcsv( $this->handle ,$mapping ,$this->csv_options['delimiter'], $this->csv_options['enclosure'] );
|
self::fputcsv( $this->handle ,$mapping ,$this->csv_options['delimiter'], $this->csv_options['enclosure'] );
|
||||||
|
@ -73,7 +73,18 @@ class importexport_wizard_basic_export_csv
|
|||||||
// return from step30
|
// return from step30
|
||||||
if ($content['step'] == 'wizard_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']) {
|
if($content['mapping']['all_custom_fields']) {
|
||||||
// Need the appname during actual export, to fetch the fields
|
// Need the appname during actual export, to fetch the fields
|
||||||
$parts = explode('_', get_class($this));
|
$parts = explode('_', get_class($this));
|
||||||
|
Loading…
Reference in New Issue
Block a user