New code for import routine.

This commit is contained in:
James Cole
2016-07-02 17:33:57 +02:00
parent cbe3fb73a8
commit a56a5fc228
11 changed files with 264 additions and 129 deletions

View File

@@ -10,35 +10,58 @@
declare(strict_types = 1);
return [
'csv_column__ignore' => '(ignore this column)',
'csv_column_account-iban' => 'Asset account (IBAN)',
'csv_column_account-id' => 'Asset account ID (matching Firefly)',
'csv_column_account-name' => 'Asset account (name)',
'csv_column_amount' => 'Amount',
'csv_column_amount-comma-separated' => 'Amount (comma as decimal separator)',
'csv_column_bill-id' => 'Bill ID (matching Firefly)',
'csv_column_bill-name' => 'Bill name',
'csv_column_budget-id' => 'Budget ID (matching Firefly)',
'csv_column_budget-name' => 'Budget name',
'csv_column_category-id' => 'Category ID (matching Firefly)',
'csv_column_category-name' => 'Category name',
'csv_column_currency-code' => 'Currency code (ISO 4217)',
'csv_column_currency-id' => 'Currency ID (matching Firefly)',
'csv_column_currency-name' => 'Currency name (matching Firefly)',
'csv_column_currency-symbol' => 'Currency symbol (matching Firefly)',
'csv_column_date-rent' => 'Rent calculation date',
'csv_column_date-transaction' => 'Date',
'csv_column_description' => 'Description',
'csv_column_opposing-iban' => 'Opposing account (IBAN)',
'csv_column_opposing-id' => 'Opposing account ID (matching Firefly)',
'csv_column_opposing-name' => 'Opposing account (name)',
'csv_column_rabo-debet-credit' => 'Rabobank specific debet/credit indicator',
'csv_column_ing-debet-credit' => 'ING specific debet/credit indicator',
'csv_column_sepa-ct-id' => 'SEPA Credit Transfer end-to-end ID',
'csv_column_sepa-ct-op' => 'SEPA Credit Transfer opposing account',
'csv_column_sepa-db' => 'SEPA Direct Debet',
'csv_column_tags-comma' => 'Tags (comma separated)',
'csv_column_tags-space' => 'Tags (space separated)',
'csv_column_account-number' => 'Asset account (account number)',
'csv_column_opposing-number' => 'Opposing account (account number)',
'import_configure_title' => 'Configure your import',
'import_configure_intro' => 'There are some options for your CSV import.',
'import_configure_form' => 'Form',
'header_help' => 'Check this if the first row of your CSV file are the column titles',
'date_help' => 'Date time format in your CSV. Follow the format like <a href="https://secure.php.net/manual/en/datetime.createfromformat.php#refsect1-datetime.createfromformat-parameters">this page</a> indicates. The default value will parse dates that look like this: :dateExample.',
'delimiter_help' => 'Choose the field delimiter that is used in your input file. If not sure, comma is the safest option.',
'config_file_help' => 'Select your CSV import configuration here. If you do not know what this is, ignore it. It will be explained later.',
'import_account_help' => 'If your CSV file does NOT contain information about your asset account(s), use this dropdown to select to which account the transactions in the CSV belong to.',
'upload_not_writeable' => 'The grey box contains a file path. It should be writeable. Please make sure it is.',
// roles
'column_roles_title' => 'Define column roles',
'column_roles_text' => 'Each column contains some data. What data?',
'column_roles_table' => 'Table',
'column_name' => 'Name of column',
'column_example' => 'Column example data',
'column_role' => 'Column data meaning',
'do_map_value' => 'Map these values',
'column' => 'Column',
'no_example_data' => 'No example data available',
'store_column_roles' => 'Continue import',
'column__ignore' => '(ignore this column)',
'column_account-iban' => 'Asset account (IBAN)',
'column_account-id' => 'Asset account ID (matching Firefly)',
'column_account-name' => 'Asset account (name)',
'column_amount' => 'Amount',
'column_amount-comma-separated' => 'Amount (comma as decimal separator)',
'column_bill-id' => 'Bill ID (matching Firefly)',
'column_bill-name' => 'Bill name',
'column_budget-id' => 'Budget ID (matching Firefly)',
'column_budget-name' => 'Budget name',
'column_category-id' => 'Category ID (matching Firefly)',
'column_category-name' => 'Category name',
'column_currency-code' => 'Currency code (ISO 4217)',
'column_currency-id' => 'Currency ID (matching Firefly)',
'column_currency-name' => 'Currency name (matching Firefly)',
'column_currency-symbol' => 'Currency symbol (matching Firefly)',
'column_date-rent' => 'Rent calculation date',
'column_date-transaction' => 'Date',
'column_description' => 'Description',
'column_opposing-iban' => 'Opposing account (IBAN)',
'column_opposing-id' => 'Opposing account ID (matching Firefly)',
'column_opposing-name' => 'Opposing account (name)',
'column_rabo-debet-credit' => 'Rabobank specific debet/credit indicator',
'column_ing-debet-credit' => 'ING specific debet/credit indicator',
'column_sepa-ct-id' => 'SEPA Credit Transfer end-to-end ID',
'column_sepa-ct-op' => 'SEPA Credit Transfer opposing account',
'column_sepa-db' => 'SEPA Direct Debet',
'column_tags-comma' => 'Tags (comma separated)',
'column_tags-space' => 'Tags (space separated)',
'column_account-number' => 'Asset account (account number)',
'column_opposing-number' => 'Opposing account (account number)',
];

View File

@@ -749,18 +749,12 @@ return [
'split_this_transfer' => 'Split this transfer',
// import
'configuration_file_help' => 'If you have previously imported data into Firefly III, you may have a configuration file, which will pre-set configuration values for you.',
'import_data_index' => 'Index',
'import_file_type_csv' => 'CSV (comma separated values)',
'import_file_type_help' => 'Select the type of file you will upload',
'import_start' => 'Start the import',
'import_csv_configure_title' => 'Configure your import',
'import_csv_configure_intro' => 'There are some options for your CSV import.',
'import_csv_configure_form' => 'Form',
'csv_header_help' => 'Check this if the first row of your CSV file are the column titles',
'csv_date_help' => 'Date time format in your CSV. Follow the format like <a href="https://secure.php.net/manual/en/datetime.createfromformat.php#refsect1-datetime.createfromformat-parameters">this page</a> indicates. The default value will parse dates that look like this: :dateExample.',
'csv_delimiter_help' => 'Choose the field delimiter that is used in your input file. If not sure, comma is the safest option.',
'csv_csv_config_file_help' => 'Select your CSV import configuration here. If you do not know what this is, ignore it. It will be explained later.',
'csv_import_account_help' => 'If your CSV file does NOT contain information about your asset account(s), use this dropdown to select to which account the transactions in the CSV belong to.',
'csv_upload_not_writeable' => 'The grey box contains a file path. It should be writeable. Please make sure it is.',
'configure_import' => 'Further configure your import',
'import_finish_configuration' => 'Finish configuration',
'settings_for_import' => 'Settings',
];

View File

@@ -133,6 +133,7 @@ return [
// import
'import_file' => 'Import file',
'configuration_file' => 'Configuration file',
'import_file_type' => 'Import file type',
'csv_comma' => 'A comma (,)',
'csv_semicolon' => 'A semicolon (;)',
@@ -142,5 +143,4 @@ return [
'csv_config' => 'CSV import configuration',
];

View File

@@ -10,11 +10,11 @@
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'import_csv_configure_title'|_ }}</h3>
<h3 class="box-title">{{ trans('csv.import_configure_title') }}</h3>
</div>
<div class="box-body">
<p>
{{ 'import_csv_configure_intro'|_ }}
{{ trans('csv.import_configure_intro') }}
</p>
</div>
</div>
@@ -29,17 +29,14 @@
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'import_csv_configure_form'|_ }}</h3>
<h3 class="box-title">{{ trans('csv.import_configure_form') }}</h3>
</div>
<div class="box-body">
{{ ExpandedForm.checkbox('has_headers',1,null,{helpText: 'csv_header_help'|_}) }}
{{ ExpandedForm.text('date_format','Ymd',{helpText: trans('firefly.csv_date_help', {dateExample: phpdate('Ymd')}) }) }}
{{ ExpandedForm.select('csv_delimiter', data.delimiters, 0, {helpText: 'csv_delimiter_help'|_} ) }}
{{ ExpandedForm.file('csv_config',{helpText: 'csv_csv_config_file_help'|_}) }}
{{ ExpandedForm.select('csv_import_account', data.accounts, 0, {helpText: 'csv_import_account_help'|_} ) }}
{{ ExpandedForm.checkbox('has_headers',1,job.configuration['has-headers'],{helpText: trans('csv.header_help')}) }}
{{ ExpandedForm.text('date_format',job.configuration['date-format'],{helpText: trans('csv.date_help', {dateExample: phpdate('Ymd')}) }) }}
{{ ExpandedForm.select('csv_delimiter', data.delimiters, job.configuration['delimiter'], {helpText: trans('csv.delimiter_help') } ) }}
{{ ExpandedForm.select('csv_import_account', data.accounts, 0, {helpText: trans('csv.import_account_help')} ) }}
{% for type, specific in data.specifics %}
<div class="form-group">
@@ -49,7 +46,8 @@
<div class="col-sm-8">
<div class="radio"><label>
{{ Form.checkbox('specifics['~type~']', '1', Input.old('specifics')[type] == '1', {'id': type ~ '_label'}) }}
{{ Form.checkbox('specifics['~type~']', '1',
job.configuration.specifics[type] == '1', {'id': type ~ '_label'}) }}
{{ specific.description }}
</label>
</div>
@@ -66,7 +64,7 @@
<div class="col-sm-8">
<pre>{{ data.upload_path }}</pre>
<p class="text-danger">
{{ 'csv_upload_not_writeable'|_ }}
{{ trans('csv.upload_not_writeable') }}
</p>
</div>
</div>
@@ -82,7 +80,7 @@
<div class="box">
<div class="box-body">
<button type="submit" class="pull-right btn btn-success">
{{ 'csv_upload_button'|_ }}
{{ 'import_finish_configuration'|_ }}
</button>
</div>
</div>

View File

@@ -10,10 +10,10 @@
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'csv_column_roles_title'|_ }}</h3>
<h3 class="box-title">{{ trans('csv.column_roles_title') }}</h3>
</div>
<div class="box-body">
<p>{{ 'csv_column_roles_text'|_ }}</p>
<p>{{ trans('csv.column_roles_text') }}</p>
</div>
</div>
@@ -21,30 +21,32 @@
</div>
<form action="{{ route('import.postSettings', job.key) }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}"/>
<input type="hidden" name="settings" value="roles"/>
<div class="row">
<div class="col-lg-12">
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ 'csv_column_roles_table'|_ }}</h3>
<h3 class="box-title">{{ trans('csv.column_roles_table') }}</h3>
</div>
<div class="box-body">
<table class="table">
<thead>
<tr>
<th style="width:20%;">{{ 'csv_column_name'|_ }}</th>
<th style="width:40%;">{{ 'csv_column_example'|_ }}</th>
<th style="width:30%;">{{ 'csv_column_role'|_ }}</th>
<th style="width:10%;">{{ 'csv_do_map_value'|_ }}</th>
<th style="width:20%;">{{ trans('csv.column_name') }}</th>
<th style="width:40%;">{{ trans('csv.column_example') }}</th>
<th style="width:30%;">{{ trans('csv.column_role') }}</th>
<th style="width:10%;">{{ trans('csv.do_map_value') }}</th>
</tr>
</thead>
{% for i in 0..data.columnCount %}
{% for i in 0..(data.columnCount-1) %}
<tr>
<td>Column #{{ loop.index }}</td>
<td>{{ trans('csv.column') }} #{{ loop.index }}</td>
<td>
{% if data.columns[i]|length == 0 %}
<em>No example data available</em>
<em>{{ trans('csv.no_example_data') }}</em>
{% else %}
{% for example in data.columns[i] %}
<code>{{ example }}</code><br />
@@ -52,10 +54,10 @@
{% endif %}
<td>
{{ Form.select(('role['~index~']'), data.available_roles,data.set_roles[index],{class: 'form-control'}) }}
{{ Form.select(('role['~loop.index0~']'), data.available_roles,data.set_roles[index],{class: 'form-control'}) }}
</td>
<td>
{# Form.checkbox(('map['~index~']'),1,map[index]) #}
{{ Form.checkbox(('map['~loop.index0~']'),1,map[index]) }}
</td>
</tr>
@@ -74,9 +76,8 @@
<div class="col-lg-12">
<div class="box">
<div class="box-body">
<a href="{{ route('import.index') }}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> {{ 'csv_go_back'|_ }}</a>
<button type="submit" class="btn btn-success pull-right">
{{ 'csv_continue'|_ }} <i class="fa fa-arrow-right"></i>
{{ trans('csv.store_column_roles') }} <i class="fa fa-arrow-right"></i>
</button>
</div>
</div>

View File

@@ -26,6 +26,7 @@
<div class="col-lg-6 col-md-8 col-sm-12 col-xs-12">
{{ ExpandedForm.file('import_file', {helpText: 'import_file_help'|_}) }}
{{ ExpandedForm.file('configuration_file', {helpText: 'configuration_file_help'|_}) }}
{{ ExpandedForm.select('import_file_type', importFileTypes, defaultImportType, {'helpText' : 'import_file_type_help'|_}) }}

View File

@@ -59,7 +59,7 @@
{% for data in transactions %}
<div class="box">
<div class="box-header with-border">
<h3 class="box-title">{{ data[1].name }}</h3>
<h3 class="box-title"><a href="{{ route('accounts.show', data[1].id) }}">{{ data[1].name }}</a></h3>
<!-- ACTIONS MENU -->
<div class="box-tools pull-right">