Fix missing field mapping if editing an existing definition

This commit is contained in:
Nathan Gray 2014-05-12 22:31:15 +00:00
parent 777e1bec1e
commit bf50886798

View File

@ -282,10 +282,6 @@ class importexport_wizard_basic_import_csv
} }
} }
} }
foreach($content['csv_fields'] as $index => $title)
{
error_log("$index: $title => {$content['field_mapping'][$index]}");
}
unset($content['mapping']); unset($content['mapping']);
switch (array_search('pressed', $content['button'])) switch (array_search('pressed', $content['button']))
{ {
@ -306,12 +302,20 @@ class importexport_wizard_basic_import_csv
$content['step'] = 'wizard_step50'; $content['step'] = 'wizard_step50';
$content['mapping'] = array(false); $content['mapping'] = array(false);
if(array_key_exists('field_mapping', $content))
{
$field = $content['field_mapping'];
}
else
{
$field = $content['plugin_options']['field_mapping'];
}
foreach($content['csv_fields'] as $index => $title) foreach($content['csv_fields'] as $index => $title)
{ {
$content['mapping'][] = array( $content['mapping'][] = array(
'index' => $index, 'index' => $index,
'title' => $title, 'title' => $title,
'field' => $content['field_mapping'][$index], 'field' => $field[$index],
'conversion' => $content['field_conversion'][$index] 'conversion' => $content['field_conversion'][$index]
); );
} }