mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix for #1349, thanks to @NyKoF
This commit is contained in:
parent
900e8202e6
commit
7cc8539298
@ -210,9 +210,14 @@ class ImportStorage
|
|||||||
$source = $assetAccount;
|
$source = $assetAccount;
|
||||||
$destination = $opposingAccount;
|
$destination = $opposingAccount;
|
||||||
|
|
||||||
|
// switch account arounds when the transaction type is a deposit.
|
||||||
if ($transactionType === TransactionType::DEPOSIT) {
|
if ($transactionType === TransactionType::DEPOSIT) {
|
||||||
$destination = $assetAccount;
|
[$destination, $source] = [$source, $destination];
|
||||||
$source = $opposingAccount;
|
}
|
||||||
|
// switch accounts around when the amount is negative and it's a transfer.
|
||||||
|
// credits to @NyKoF
|
||||||
|
if($transactionType === TransactionType::TRANSFER && -1 === bccomp($amount, '0')) {
|
||||||
|
[$destination, $source] = [$source, $destination];
|
||||||
}
|
}
|
||||||
Log::debug(
|
Log::debug(
|
||||||
sprintf('Will make #%s (%s) the source and #%s (%s) the destination.', $source->id, $source->name, $destination->id, $destination->name)
|
sprintf('Will make #%s (%s) the source and #%s (%s) the destination.', $source->id, $source->name, $destination->id, $destination->name)
|
||||||
@ -248,7 +253,7 @@ class ImportStorage
|
|||||||
[
|
[
|
||||||
'description' => null,
|
'description' => null,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
'currency_id' => (int)$currencyId,
|
'currency_id' => $currencyId,
|
||||||
'currency_code' => null,
|
'currency_code' => null,
|
||||||
'foreign_amount' => $foreignAmount,
|
'foreign_amount' => $foreignAmount,
|
||||||
'foreign_currency_id' => $foreignCurrencyId,
|
'foreign_currency_id' => $foreignCurrencyId,
|
||||||
|
Loading…
Reference in New Issue
Block a user