mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix a bug where transfers would be stored reversed (ie. source and destination switched).
This commit is contained in:
@@ -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':
|
||||
|
@@ -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),
|
||||
|
Reference in New Issue
Block a user