From a7136bca72d303f0996a100d8abc6980f56b0c85 Mon Sep 17 00:00:00 2001 From: megachriz <megachriz@654114.no-reply.drupal.org> Date: Tue, 4 Feb 2014 00:11:57 -0500 Subject: [PATCH] Issue #1996240 by msti, MegaChriz: Duplicate fields in CSV template. --- plugins/FeedsCSVParser.inc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/FeedsCSVParser.inc b/plugins/FeedsCSVParser.inc index 70444405..1f879d38 100644 --- a/plugins/FeedsCSVParser.inc +++ b/plugins/FeedsCSVParser.inc @@ -127,6 +127,7 @@ class FeedsCSVParser extends FeedsParser { $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))); $items = array(); @@ -208,6 +209,11 @@ class FeedsCSVParser extends FeedsParser { $mappings = feeds_importer($this->id)->processor->config['mappings']; $sources = $uniques = array(); 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'])) { $uniques[] = check_plain($mapping['source']); } -- GitLab