firefly-iii/config/csv.php

431 lines
16 KiB
PHP
Raw Normal View History

<?php
2018-04-02 07:43:06 -05:00
/**
* csv.php
2020-03-17 11:06:30 -05:00
* Copyright (c) 2019 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
2017-10-21 01:40:00 -05:00
*
* This program is distributed in the hope that it will be useful,
2017-10-21 01:40:00 -05:00
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
2017-10-21 01:40:00 -05:00
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
2018-05-11 03:08:34 -05:00
declare(strict_types=1);
use FireflyIII\Import\Specifics\AbnAmroDescription;
2020-03-17 11:06:30 -05:00
use FireflyIII\Import\Specifics\Belfius;
use FireflyIII\Import\Specifics\IngBelgium;
2018-05-11 03:08:34 -05:00
use FireflyIII\Import\Specifics\IngDescription;
use FireflyIII\Import\Specifics\PresidentsChoice;
use FireflyIII\Import\Specifics\SnsDescription;
2016-05-20 01:57:45 -05:00
return [
2016-06-27 08:15:46 -05:00
/*
* Configuration for the CSV specifics.
*/
'import_specifics' => [
'IngDescription' => IngDescription::class,
'AbnAmroDescription' => AbnAmroDescription::class,
'SnsDescription' => SnsDescription::class,
'PresidentsChoice' => PresidentsChoice::class,
'Belfius' => Belfius::class,
2020-03-17 11:06:30 -05:00
'IngBelgium' => IngBelgium::class,
2016-06-27 08:15:46 -05:00
],
/*
* Configuration for possible column roles.
2016-07-23 14:37:06 -05:00
*
* The key is the short name for the column role. There are five values, which mean this:
*
* 'mappable'
* Whether or not the value in the CSV column can be linked to an existing value in your
* Firefly database. For example: account names can be linked to existing account names you have already
* so double entries cannot occur. This process is called "mapping". You have to make each unique value in your
* CSV file to an existing entry in your database. For example, map all account names in your CSV file to existing
* accounts. If you have an entry that does not exist in your database, you can set Firefly to ignore it, and it will
* create it.
*
* 'pre-process-map'
* In the case of tags, there are multiple values in one csv column (for example: "expense groceries snack" in one column).
* This means the content of the column must be "pre processed" aka split in parts so the importer can work with the data.
*
* 'pre-process-mapper'
* This is the class that will actually do the pre-processing.
*
* 'field'
* I don't believe this value is used any more, but I am not sure.
*
* 'converter'
* The converter is a class in app/Import/Converter that converts the given value into an object Firefly understands.
* The CategoryName converter can convert a category name into an actual category. This converter will take a mapping
* into account: if you mapped "Groceries" to category "Groceries" the converter will simply return "Groceries" instead of
* trying to make a new category also named Groceries.
*
* 'mapper'
* When you map data (see "mappable") you need a list of stuff you can map to. If you say a certain column is mappable
* and the column contains "category names", the mapper will be "Category" and it will give you a list of possible categories.
* This way the importer always presents you with a valid list of things to map to.
*
*
*
2016-06-27 08:15:46 -05:00
*/
2016-07-02 16:08:47 -05:00
'import_roles' => [
2018-01-10 12:59:40 -06:00
'_ignore' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
'field' => 'ignored',
'converter' => 'Ignore',
'mapper' => null,
2016-06-27 08:15:46 -05:00
],
2018-01-10 12:59:40 -06:00
'bill-id' => [
'mappable' => true,
2016-07-23 14:37:06 -05:00
'pre-process-map' => false,
'field' => 'bill',
'converter' => 'BillId',
'mapper' => 'Bills',
2016-06-27 08:15:46 -05:00
],
2018-01-10 12:59:40 -06:00
'note' => [
2017-12-21 12:18:53 -06:00
'mappable' => false,
'pre-process-map' => false,
'field' => 'note',
'converter' => 'Note',
],
2018-01-10 12:59:40 -06:00
'bill-name' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'bill',
'converter' => 'BillName',
'mapper' => 'Bills',
2016-06-27 08:15:46 -05:00
],
2018-01-10 12:59:40 -06:00
'currency-id' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'currency',
'converter' => 'CurrencyId',
'mapper' => 'TransactionCurrencies',
2016-06-27 08:15:46 -05:00
],
2018-01-10 12:59:40 -06:00
'currency-name' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'converter' => 'CurrencyName',
'field' => 'currency',
'mapper' => 'TransactionCurrencies',
2016-06-27 08:15:46 -05:00
],
2018-01-10 12:59:40 -06:00
'currency-code' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'converter' => 'CurrencyCode',
'field' => 'currency',
'mapper' => 'TransactionCurrencies',
2016-06-27 08:15:46 -05:00
],
2018-01-10 12:59:40 -06:00
'foreign-currency-code' => [
'mappable' => true,
'pre-process-map' => false,
'converter' => 'CurrencyCode',
'field' => 'foreign_currency',
'mapper' => 'TransactionCurrencies',
],
'external-id' => [
2016-08-05 23:21:46 -05:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'ExternalId',
'field' => 'external-id',
],
2019-01-27 14:23:18 -06:00
'currency-symbol' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'converter' => 'CurrencySymbol',
'field' => 'currency',
'mapper' => 'TransactionCurrencies',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'description' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'description',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'date-transaction' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',
'field' => 'date',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'date-interest' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',
'field' => 'date-interest',
],
2019-01-27 14:23:18 -06:00
'date-book' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',
'field' => 'date-book',
],
2019-01-27 14:23:18 -06:00
'date-process' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',
'field' => 'date-process',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'date-due' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',
'field' => 'date-due',
],
2019-01-27 14:23:18 -06:00
'date-payment' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',
'field' => 'date-payment',
],
2019-01-27 14:23:18 -06:00
'date-invoice' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',
'field' => 'date-invoice',
],
2019-01-27 14:23:18 -06:00
'budget-id' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'converter' => 'BudgetId',
'field' => 'budget',
'mapper' => 'Budgets',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'budget-name' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'converter' => 'BudgetName',
'field' => 'budget',
'mapper' => 'Budgets',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'rabo-debit-credit' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
2019-01-27 14:23:18 -06:00
'converter' => 'BankDebitCredit',
2016-07-23 14:37:06 -05:00
'field' => 'amount-modifier',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'ing-debit-credit' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
2019-01-27 14:23:18 -06:00
'converter' => 'BankDebitCredit',
2016-07-23 14:37:06 -05:00
'field' => 'amount-modifier',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'generic-debit-credit' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'BankDebitCredit',
'field' => 'amount-modifier',
],
'category-id' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'converter' => 'CategoryId',
'field' => 'category',
'mapper' => 'Categories',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'category-name' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'converter' => 'CategoryName',
'field' => 'category',
'mapper' => 'Categories',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'tags-comma' => [
2017-07-28 07:40:53 -05:00
'mappable' => false,
2016-07-23 14:37:06 -05:00
'pre-process-map' => true,
'pre-process-mapper' => 'TagsComma',
'field' => 'tags',
'converter' => 'TagsComma',
'mapper' => 'Tags',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'tags-space' => [
2017-07-28 07:40:53 -05:00
'mappable' => false,
2016-07-23 14:37:06 -05:00
'pre-process-map' => true,
'pre-process-mapper' => 'TagsSpace',
'field' => 'tags',
'converter' => 'TagsSpace',
'mapper' => 'Tags',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'account-id' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'asset-account-id',
'converter' => 'AccountId',
2016-07-23 14:37:06 -05:00
'mapper' => 'AssetAccounts',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'account-name' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'asset-account-name',
'converter' => 'AssetAccountName',
'mapper' => 'AssetAccounts',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'account-iban' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'asset-account-iban',
'converter' => 'AssetAccountIban',
'mapper' => 'AssetAccountIbans',
2016-07-02 16:08:47 -05:00
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'account-number' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'asset-account-number',
'converter' => 'AssetAccountNumber',
'mapper' => 'AssetAccounts',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'account-bic' => [
'mappable' => false,
'pre-process-map' => false,
'field' => 'asset-account-bic',
'converter' => 'AccountBic',
],
2019-01-27 14:23:18 -06:00
'opposing-id' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'opposing-account-id',
'converter' => 'AccountId',
2016-07-23 14:37:06 -05:00
'mapper' => 'OpposingAccounts',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'opposing-bic' => [
2018-03-19 04:03:08 -05:00
'mappable' => false,
'pre-process-map' => false,
'field' => 'opposing-account-bic',
'converter' => 'AccountBic',
],
2019-01-27 14:23:18 -06:00
'opposing-name' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'opposing-account-name',
'converter' => 'OpposingAccountName',
'mapper' => 'OpposingAccounts',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'opposing-iban' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'opposing-account-iban',
'converter' => 'OpposingAccountIban',
'mapper' => 'OpposingAccountIbans',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'opposing-number' => [
2016-07-23 14:37:06 -05:00
'mappable' => true,
'pre-process-map' => false,
'field' => 'opposing-account-number',
'converter' => 'OpposingAccountNumber',
'mapper' => 'OpposingAccounts',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'amount' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Amount',
'field' => 'amount',
2016-06-27 08:15:46 -05:00
],
2019-01-27 14:23:18 -06:00
'amount_debit' => [
2017-11-18 13:26:42 -06:00
'mappable' => false,
'pre-process-map' => false,
2017-12-19 11:53:50 -06:00
'converter' => 'AmountDebit',
'field' => 'amount_debit',
2017-11-18 13:26:42 -06:00
],
2019-01-27 14:23:18 -06:00
'amount_credit' => [
2017-11-18 13:26:42 -06:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'AmountCredit',
'field' => 'amount_credit',
],
2019-01-27 14:23:18 -06:00
'amount_negated' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'AmountNegated',
'field' => 'amount_negated',
],
2019-01-27 14:23:18 -06:00
'amount_foreign' => [
2018-01-10 12:59:40 -06:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Amount',
'field' => 'amount_foreign',
],
// SEPA end to end ID
'sepa_ct_id' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'sepa_ct_id',
2016-06-27 08:15:46 -05:00
],
// SEPA opposing account identifier
'sepa_ct_op' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'sepa_ct_op',
2016-06-27 08:15:46 -05:00
],
// SEPA Direct Debit Mandate Identifier
'sepa_db' => [
2016-07-23 14:37:06 -05:00
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'sepa_db',
],
// SEPA clearing code
'sepa_cc' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'sepa_cc',
],
// SEPA country
'sepa_country' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'sepa_country',
],
// SEPA external purpose
'sepa_ep' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'sepa_ep',
],
// SEPA creditor identifier
'sepa_ci' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'sepa_ci',
],
// SEPA Batch ID
'sepa_batch_id' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'sepa_batch',
],
// Internal reference
2019-01-27 14:23:18 -06:00
'internal-reference' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Description',
'field' => 'internal_reference',
2016-06-27 08:15:46 -05:00
],
],
2016-09-25 01:32:53 -05:00
// number of example rows:
'example_rows' => 5,
2015-07-09 14:26:40 -05:00
];