Skip to content
Snippets Groups Projects
Commit a7136bca authored by megachriz's avatar megachriz Committed by Chris Leppanen
Browse files

Issue #1996240 by msti, MegaChriz: Duplicate fields in CSV template.

parent a44ecf60
No related branches found
No related tags found
No related merge requests found
...@@ -127,6 +127,7 @@ class FeedsCSVParser extends FeedsParser { ...@@ -127,6 +127,7 @@ class FeedsCSVParser extends FeedsParser {
$uniques[] = check_plain($mapping['source']); $uniques[] = check_plain($mapping['source']);
} }
} }
$sources = array_unique($sources);
$output = t('Import !csv_files with one or more of these columns: !columns.', array('!csv_files' => l(t('CSV files'), 'http://en.wikipedia.org/wiki/Comma-separated_values'), '!columns' => implode(', ', $sources))); $output = t('Import !csv_files with one or more of these columns: !columns.', array('!csv_files' => l(t('CSV files'), 'http://en.wikipedia.org/wiki/Comma-separated_values'), '!columns' => implode(', ', $sources)));
$items = array(); $items = array();
...@@ -208,6 +209,11 @@ class FeedsCSVParser extends FeedsParser { ...@@ -208,6 +209,11 @@ class FeedsCSVParser extends FeedsParser {
$mappings = feeds_importer($this->id)->processor->config['mappings']; $mappings = feeds_importer($this->id)->processor->config['mappings'];
$sources = $uniques = array(); $sources = $uniques = array();
foreach ($mappings as $mapping) { foreach ($mappings as $mapping) {
if (in_array(check_plain($mapping['source']), $uniques) || in_array(check_plain($mapping['source']), $sources)) {
// Skip columns we've already seen.
continue;
}
if (!empty($mapping['unique'])) { if (!empty($mapping['unique'])) {
$uniques[] = check_plain($mapping['source']); $uniques[] = check_plain($mapping['source']);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment