Fix some things in import routine.

This commit is contained in:
James Cole 2018-01-04 08:59:39 +01:00
parent 3ce5ccb98a
commit 6b59b6de6e
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
4 changed files with 13 additions and 0 deletions

View File

@ -170,6 +170,7 @@ class FileConfigurator implements ConfiguratorInterface
'column-roles-complete' => false, // not yet configured roles for columns
'column-mapping-config' => [], // no mapping made yet.
'column-mapping-complete' => false, // so mapping is not complete.
'has-config-file' => true,
'apply-rules' => true,
'match-bills' => false,
'auto-start' => false,

View File

@ -106,6 +106,10 @@ class Map implements ConfigurationInterface
foreach ($setIndexes as $index) {
$this->data[$index]['values'] = array_unique($this->data[$index]['values']);
asort($this->data[$index]['values']);
// if the count of this array is zero, there is nothing to map.
if(count($this->data[$index]['values']) === 0) {
unset($this->data[$index]);
}
}
unset($setIndexes);

View File

@ -103,6 +103,7 @@ return [
'file_map_field_mapped_to' => 'Mapped to',
'map_do_not_map' => '(do not map)',
'file_map_submit' => 'Start the import',
'file_nothing_to_map' => 'There is no data present in your file that you can map to existing values. Please press "Start the import" to continue.',
// map things.
'column__ignore' => '(ignore this column)',

View File

@ -17,6 +17,11 @@
<p>
{{ trans('import.file_map_text') }}
</p>
{% if data|length == 0 %}
<p class="text-danger">
{{ trans('import.file_nothing_to_map') }}
</p>
{% endif %}
</div>
</div>
@ -25,6 +30,8 @@
<form action="{{ route('import.configure.post', job.key) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
{% for field in data %}
<div class="row">
<div class="col-lg-12">