Révision 41cc1b08
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/modules/feeds/plugins/FeedsCSVParser.inc | ||
---|---|---|
28 | 28 |
// Get first line and use it for column names, convert them to lower case. |
29 | 29 |
$header = $this->parseHeader($parser, $iterator); |
30 | 30 |
if (!$header) { |
31 |
return; |
|
31 |
drupal_set_message(t('The CSV file is empty.'), 'warning', FALSE); |
|
32 |
return new FeedsParserResult(); |
|
32 | 33 |
} |
33 | 34 |
$parser->setColumnNames($header); |
34 | 35 |
} |
... | ... | |
127 | 128 |
$uniques[] = check_plain($mapping['source']); |
128 | 129 |
} |
129 | 130 |
} |
131 |
$sources = array_unique($sources); |
|
130 | 132 |
|
131 | 133 |
$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))); |
132 | 134 |
$items = array(); |
133 |
$items[] = format_plural(count($uniques), t('Column <strong>!column</strong> is mandatory and considered unique: only one item per !column value will be created.', array('!column' => implode(', ', $uniques))), t('Columns <strong>!columns</strong> are mandatory and values in these columns are considered unique: only one entry per value in one of these column will be created.', array('!columns' => implode(', ', $uniques))));
|
|
135 |
$items[] = format_plural(count($uniques), 'Column <strong>!columns</strong> is mandatory and considered unique: only one item per !columns value will be created.', 'Columns <strong>!columns</strong> are mandatory and values in these columns are considered unique: only one entry per value in one of these column will be created.', array('!columns' => implode(', ', $uniques)));
|
|
134 | 136 |
$items[] = l(t('Download a template'), 'import/' . $this->id . '/template'); |
135 | 137 |
$form['help'] = array( |
136 | 138 |
'#prefix' => '<div class="help">', |
... | ... | |
208 | 210 |
$mappings = feeds_importer($this->id)->processor->config['mappings']; |
209 | 211 |
$sources = $uniques = array(); |
210 | 212 |
foreach ($mappings as $mapping) { |
213 |
if (in_array(check_plain($mapping['source']), $uniques) || in_array(check_plain($mapping['source']), $sources)) { |
|
214 |
// Skip columns we've already seen. |
|
215 |
continue; |
|
216 |
} |
|
217 |
|
|
211 | 218 |
if (!empty($mapping['unique'])) { |
212 | 219 |
$uniques[] = check_plain($mapping['source']); |
213 | 220 |
} |
... | ... | |
215 | 222 |
$sources[] = check_plain($mapping['source']); |
216 | 223 |
} |
217 | 224 |
} |
218 |
$sep = ',';
|
|
225 |
$sep = $this->config['delimiter'];
|
|
219 | 226 |
$columns = array(); |
220 | 227 |
foreach (array_merge($uniques, $sources) as $col) { |
221 | 228 |
if (strpos($col, $sep) !== FALSE) { |
Formats disponibles : Unified diff
Update feeds 7.x-2.0-alpha9 -> 7.x-2.0-beta1
Install lib simplepie 1.3.1