mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-10 23:45:48 -06:00
This fixes #569
This commit is contained in:
parent
47aa996b6b
commit
cf2cd9680b
@ -439,8 +439,9 @@ class CsvSetup implements SetupInterface
|
||||
Log::debug('Now in getDataForColumnRoles()');
|
||||
$config = $this->job->configuration;
|
||||
$data = [
|
||||
'columns' => [],
|
||||
'columnCount' => 0,
|
||||
'columns' => [],
|
||||
'columnCount' => 0,
|
||||
'columnHeaders' => [],
|
||||
];
|
||||
|
||||
// show user column role configuration.
|
||||
@ -449,8 +450,13 @@ class CsvSetup implements SetupInterface
|
||||
// create CSV reader.
|
||||
$reader = Reader::createFromString($content);
|
||||
$reader->setDelimiter($config['delimiter']);
|
||||
$start = $config['has-headers'] ? 1 : 0;
|
||||
$end = $start + config('csv.example_rows');
|
||||
$start = $config['has-headers'] ? 1 : 0;
|
||||
$end = $start + config('csv.example_rows');
|
||||
$header = [];
|
||||
if ($config['has-headers']) {
|
||||
$header = $reader->fetchOne(0);
|
||||
}
|
||||
|
||||
|
||||
// collect example data in $data['columns']
|
||||
Log::debug(sprintf('While %s is smaller than %d', $start, $end));
|
||||
@ -468,7 +474,8 @@ class CsvSetup implements SetupInterface
|
||||
}
|
||||
|
||||
foreach ($row as $index => $value) {
|
||||
$value = trim($value);
|
||||
$value = trim($value);
|
||||
$data['columnHeaders'][$index] = $header[$index] ?? '';
|
||||
if (strlen($value) > 0) {
|
||||
$data['columns'][$index][] = $value;
|
||||
}
|
||||
|
@ -45,7 +45,13 @@
|
||||
{% for i in 0..(data.columnCount-1) %}
|
||||
|
||||
<tr>
|
||||
<td>{{ trans('csv.column') }} #{{ loop.index }}</td>
|
||||
<td>
|
||||
{% if data.columnHeaders[i] == '' %}
|
||||
{{ trans('csv.column') }} #{{ loop.index }}
|
||||
{% else %}
|
||||
{{ data.columnHeaders[i] }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{% if data.columns[i]|length == 0 %}
|
||||
<em>{{ trans('csv.no_example_data') }}</em>
|
||||
|
Loading…
Reference in New Issue
Block a user