Skip to content

Firefly III: a personal finances manager

Fix a bug where transfers would be stored reversed (ie. source and destination switched).

James Colecd076cc069b7
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index 42061110f8..9096d8099d 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -104,7 +104,7 @@ class TransactionJournalFactory
// store date meta fields (if present):
$fields = ['sepa-cc', 'sepa-ct-op', 'sepa-ct-id', 'sepa-db', 'sepa-country', 'sepa-ep', 'sepa-ci', 'interest_date', 'book_date', 'process_date',
'due_date', 'recurrence_id', 'payment_date', 'invoice_date', 'internal_reference', 'bunq_payment_id', 'importHash', 'importHashV2',
- 'external_id'];
+ 'external_id','sepa-batch-id'];
foreach ($fields as $field) {
$this->storeMeta($journal, $data, $field);
diff --git a/app/Support/Import/Placeholder/ImportTransaction.php b/app/Support/Import/Placeholder/ImportTransaction.php
index ccc64a7a57..4d070a3393 100644
--- a/app/Support/Import/Placeholder/ImportTransaction.php
+++ b/app/Support/Import/Placeholder/ImportTransaction.php
@@ -203,13 +203,14 @@ class ImportTransaction
case 'external-id':
$this->externalId = $columnValue->getValue();
break;
- case 'sepa-ct-id';
- case 'sepa-ct-op';
- case 'sepa-db';
+ case 'sepa-ct-id':
+ case 'sepa-ct-op':
+ case 'sepa-db':
case 'sepa-cc':
- case 'sepa-country';
- case 'sepa-ep';
- case 'sepa-ci';
+ case 'sepa-country':
+ case 'sepa-batch-id':
+ case 'sepa-ep':
+ case 'sepa-ci':
case 'internal-reference':
case 'date-interest':
case 'date-invoice':
diff --git a/app/Support/Import/Routine/File/ImportableConverter.php b/app/Support/Import/Routine/File/ImportableConverter.php
index 00cc33d789..42ab262aa3 100644
--- a/app/Support/Import/Routine/File/ImportableConverter.php
+++ b/app/Support/Import/Routine/File/ImportableConverter.php
@@ -183,8 +183,8 @@ class ImportableConverter
$transactionType = 'transfer';
}
- // amount is positive and its not a transfer? Then switch:
- if ($transactionType !== 'transfer' && bccomp($amount, '0') === 1) {
+ // amount is positive? Then switch:
+ if (1 === bccomp($amount, '0')) {
[$destination, $source] = [$source, $destination];
Log::debug(
@@ -194,17 +194,6 @@ class ImportableConverter
)
);
}
- // amount is negative and type is transfer? then switch.
- if ($transactionType === 'transfer' && bccomp($amount, '0') === -1) {
- // amount is positive? Then switch:
- [$destination, $source] = [$source, $destination];
- Log::debug(
- sprintf(
- '%s is negative, so "%s" (#%d) is now source and "%s" (#%d) is now destination.',
- $amount, $source->name, $source->id, $destination->name, $destination->id
- )
- );
- }
// get currency preference from source asset account (preferred)
// or destination asset account
@@ -273,9 +262,10 @@ class ImportableConverter
'sepa-ct-op' => $importable->meta['sepa-ct-op'] ?? null,
'sepa-ct-id' => $importable->meta['sepa-ct-id'] ?? null,
'sepa-db' => $importable->meta['sepa-db'] ?? null,
- 'sepa-country' => $importable->meta['sepa-countru'] ?? null,
+ 'sepa-country' => $importable->meta['sepa-country'] ?? null,
'sepa-ep' => $importable->meta['sepa-ep'] ?? null,
'sepa-ci' => $importable->meta['sepa-ci'] ?? null,
+ 'sepa-batch-id' => $importable->meta['sepa-batch-id'] ?? null,
'interest_date' => $this->convertDateValue($importable->meta['date-interest'] ?? null),
'book_date' => $this->convertDateValue($importable->meta['date-book'] ?? null),
'process_date' => $this->convertDateValue($importable->meta['date-process'] ?? null),
diff --git a/config/csv.php b/config/csv.php
index 4af268d126..3e1d1a9d10 100644
--- a/config/csv.php
+++ b/config/csv.php
@@ -283,6 +283,12 @@ return [
'converter' => 'AssetAccountNumber',
'mapper' => 'AssetAccounts',
],
+ 'account-bic' => [
+ 'mappable' => false,
+ 'pre-process-map' => false,
+ 'field' => 'asset-account-bic',
+ 'converter' => 'AccountBic',
+ ],
'opposing-id' => [
'mappable' => true,
'pre-process-map' => false,
@@ -391,6 +397,13 @@ return [
'converter' => 'Description',
'field' => 'sepa_ci',
],
+ // SEPA Batch ID
+ 'sepa-batch-id' => [
+ 'mappable' => false,
+ 'pre-process-map' => false,
+ 'converter' => 'Description',
+ 'field' => 'sepa_batch',
+ ],
// Internal reference
'internal-reference' => [
'mappable' => false,
diff --git a/resources/lang/en_US/import.php b/resources/lang/en_US/import.php
index 824704689e..f6b93c10eb 100644
--- a/resources/lang/en_US/import.php
+++ b/resources/lang/en_US/import.php
@@ -219,6 +219,7 @@ return [
'column_account-iban' => 'Asset account (IBAN)',
'column_account-id' => 'Asset account ID (matching FF3)',
'column_account-name' => 'Asset account (name)',
+ 'column_account-bic' => 'Asset account (BIC)',
'column_amount' => 'Amount',
'column_amount_foreign' => 'Amount (in foreign currency)',
'column_amount_debit' => 'Amount (debit column)',
diff --git a/resources/lang/en_US/list.php b/resources/lang/en_US/list.php
index 171a7acf23..8932fdf83a 100644
--- a/resources/lang/en_US/list.php
+++ b/resources/lang/en_US/list.php
@@ -112,6 +112,7 @@ return [
'sepa-cc' => 'SEPA Clearing Code',
'sepa-ep' => 'SEPA External Purpose',
'sepa-ci' => 'SEPA Creditor Identifier',
+ 'sepa-batch-id' => 'SEPA Batch ID',
'external_id' => 'External ID',
'account_at_bunq' => 'Account with bunq',
'file_name' => 'File name',
diff --git a/resources/views/transactions/show.twig b/resources/views/transactions/show.twig
index f184c82dbe..099f163687 100644
--- a/resources/views/transactions/show.twig
+++ b/resources/views/transactions/show.twig
@@ -210,7 +210,7 @@
{% endif %}
{% endfor %}
{# all other meta values #}
- {% for metaField in ['external_id','bunq_payment_id','internal_reference','sepa-ct-id','sepa-ct-op','sepa-db','sepa-country','sepa-cc','sepa-ep','sepa-ci'] %}
+ {% for metaField in ['external_id','bunq_payment_id','internal_reference','sepa-batch-id','sepa-ct-id','sepa-ct-op','sepa-db','sepa-country','sepa-cc','sepa-ep','sepa-ci'] %}
{% if journalHasMeta(journal, metaField) %}
<tr>
<td>{{ trans('list.'~metaField) }}</td>