Fixed edit of multi currency transaction, ##651

This commit is contained in:
James Cole 2017-06-02 07:05:42 +02:00
parent 01fedc0bf8
commit 2b1ab5c6ef
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E

View File

@ -259,18 +259,9 @@ class JournalRepository implements JournalRepositoryInterface
$journal->description = $data['description'];
$journal->date = $data['date'];
$accounts = $this->storeAccounts($journal->transactionType, $data);
$data = $this->verifyNativeAmount($data, $accounts);
$amount = strval($data['amount']);
if ($data['currency_id'] !== $journal->transaction_currency_id) {
// user has entered amount in foreign currency.
// amount in "our" currency is $data['exchanged_amount']:
$amount = strval($data['exchanged_amount']);
// other values must be stored as well:
$data['original_amount'] = $data['amount'];
$data['original_currency_id'] = $data['currency_id'];
}
// unlink all categories, recreate them:
$journal->categories()->detach();
$journal->budgets()->detach();