Deposit works as well.

This commit is contained in:
James Cole
2017-04-14 14:48:44 +02:00
parent c33dd1ecee
commit bd917f6484
4 changed files with 18 additions and 1 deletions

View File

@@ -187,6 +187,15 @@ class JournalRepository implements JournalRepositoryInterface
$amount = strval($data['exchanged_amount']);
}
break;
case TransactionType::DEPOSIT:
$accountCurrencyId = intval($accounts['destination']->getMeta('currency_id'));
if ($accountCurrencyId !== $currencyId) {
$data['original_amount'] = $data['amount'];
$data['original_currency_id'] = $currencyId;
$currencyId = $accountCurrencyId;
$amount = strval($data['exchanged_amount']);
}
break;
default:
throw new FireflyException(sprintf('Currency exchange routine cannot handle %s', $transactionType->type));
}