mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix a bug where transfers would be stored reversed (ie. source and destination switched).
This commit is contained in:
parent
46482bdae1
commit
cd076cc069
@ -104,7 +104,7 @@ class TransactionJournalFactory
|
|||||||
// store date meta fields (if present):
|
// 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',
|
$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',
|
'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) {
|
foreach ($fields as $field) {
|
||||||
$this->storeMeta($journal, $data, $field);
|
$this->storeMeta($journal, $data, $field);
|
||||||
|
@ -203,13 +203,14 @@ class ImportTransaction
|
|||||||
case 'external-id':
|
case 'external-id':
|
||||||
$this->externalId = $columnValue->getValue();
|
$this->externalId = $columnValue->getValue();
|
||||||
break;
|
break;
|
||||||
case 'sepa-ct-id';
|
case 'sepa-ct-id':
|
||||||
case 'sepa-ct-op';
|
case 'sepa-ct-op':
|
||||||
case 'sepa-db';
|
case 'sepa-db':
|
||||||
case 'sepa-cc':
|
case 'sepa-cc':
|
||||||
case 'sepa-country';
|
case 'sepa-country':
|
||||||
case 'sepa-ep';
|
case 'sepa-batch-id':
|
||||||
case 'sepa-ci';
|
case 'sepa-ep':
|
||||||
|
case 'sepa-ci':
|
||||||
case 'internal-reference':
|
case 'internal-reference':
|
||||||
case 'date-interest':
|
case 'date-interest':
|
||||||
case 'date-invoice':
|
case 'date-invoice':
|
||||||
|
@ -183,8 +183,8 @@ class ImportableConverter
|
|||||||
$transactionType = 'transfer';
|
$transactionType = 'transfer';
|
||||||
}
|
}
|
||||||
|
|
||||||
// amount is positive and its not a transfer? Then switch:
|
// amount is positive? Then switch:
|
||||||
if ($transactionType !== 'transfer' && bccomp($amount, '0') === 1) {
|
if (1 === bccomp($amount, '0')) {
|
||||||
|
|
||||||
[$destination, $source] = [$source, $destination];
|
[$destination, $source] = [$source, $destination];
|
||||||
Log::debug(
|
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)
|
// get currency preference from source asset account (preferred)
|
||||||
// or destination asset account
|
// or destination asset account
|
||||||
@ -273,9 +262,10 @@ class ImportableConverter
|
|||||||
'sepa-ct-op' => $importable->meta['sepa-ct-op'] ?? null,
|
'sepa-ct-op' => $importable->meta['sepa-ct-op'] ?? null,
|
||||||
'sepa-ct-id' => $importable->meta['sepa-ct-id'] ?? null,
|
'sepa-ct-id' => $importable->meta['sepa-ct-id'] ?? null,
|
||||||
'sepa-db' => $importable->meta['sepa-db'] ?? 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-ep' => $importable->meta['sepa-ep'] ?? null,
|
||||||
'sepa-ci' => $importable->meta['sepa-ci'] ?? 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),
|
'interest_date' => $this->convertDateValue($importable->meta['date-interest'] ?? null),
|
||||||
'book_date' => $this->convertDateValue($importable->meta['date-book'] ?? null),
|
'book_date' => $this->convertDateValue($importable->meta['date-book'] ?? null),
|
||||||
'process_date' => $this->convertDateValue($importable->meta['date-process'] ?? null),
|
'process_date' => $this->convertDateValue($importable->meta['date-process'] ?? null),
|
||||||
|
@ -283,6 +283,12 @@ return [
|
|||||||
'converter' => 'AssetAccountNumber',
|
'converter' => 'AssetAccountNumber',
|
||||||
'mapper' => 'AssetAccounts',
|
'mapper' => 'AssetAccounts',
|
||||||
],
|
],
|
||||||
|
'account-bic' => [
|
||||||
|
'mappable' => false,
|
||||||
|
'pre-process-map' => false,
|
||||||
|
'field' => 'asset-account-bic',
|
||||||
|
'converter' => 'AccountBic',
|
||||||
|
],
|
||||||
'opposing-id' => [
|
'opposing-id' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
@ -391,6 +397,13 @@ return [
|
|||||||
'converter' => 'Description',
|
'converter' => 'Description',
|
||||||
'field' => 'sepa_ci',
|
'field' => 'sepa_ci',
|
||||||
],
|
],
|
||||||
|
// SEPA Batch ID
|
||||||
|
'sepa-batch-id' => [
|
||||||
|
'mappable' => false,
|
||||||
|
'pre-process-map' => false,
|
||||||
|
'converter' => 'Description',
|
||||||
|
'field' => 'sepa_batch',
|
||||||
|
],
|
||||||
// Internal reference
|
// Internal reference
|
||||||
'internal-reference' => [
|
'internal-reference' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
|
@ -219,6 +219,7 @@ return [
|
|||||||
'column_account-iban' => 'Asset account (IBAN)',
|
'column_account-iban' => 'Asset account (IBAN)',
|
||||||
'column_account-id' => 'Asset account ID (matching FF3)',
|
'column_account-id' => 'Asset account ID (matching FF3)',
|
||||||
'column_account-name' => 'Asset account (name)',
|
'column_account-name' => 'Asset account (name)',
|
||||||
|
'column_account-bic' => 'Asset account (BIC)',
|
||||||
'column_amount' => 'Amount',
|
'column_amount' => 'Amount',
|
||||||
'column_amount_foreign' => 'Amount (in foreign currency)',
|
'column_amount_foreign' => 'Amount (in foreign currency)',
|
||||||
'column_amount_debit' => 'Amount (debit column)',
|
'column_amount_debit' => 'Amount (debit column)',
|
||||||
|
@ -112,6 +112,7 @@ return [
|
|||||||
'sepa-cc' => 'SEPA Clearing Code',
|
'sepa-cc' => 'SEPA Clearing Code',
|
||||||
'sepa-ep' => 'SEPA External Purpose',
|
'sepa-ep' => 'SEPA External Purpose',
|
||||||
'sepa-ci' => 'SEPA Creditor Identifier',
|
'sepa-ci' => 'SEPA Creditor Identifier',
|
||||||
|
'sepa-batch-id' => 'SEPA Batch ID',
|
||||||
'external_id' => 'External ID',
|
'external_id' => 'External ID',
|
||||||
'account_at_bunq' => 'Account with bunq',
|
'account_at_bunq' => 'Account with bunq',
|
||||||
'file_name' => 'File name',
|
'file_name' => 'File name',
|
||||||
|
@ -210,7 +210,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{# all other meta values #}
|
{# 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) %}
|
{% if journalHasMeta(journal, metaField) %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ trans('list.'~metaField) }}</td>
|
<td>{{ trans('list.'~metaField) }}</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user