mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-20 11:19:16 +00:00
Deposit works as well.
This commit is contained in:
@@ -187,7 +187,7 @@ class TransactionController extends Controller
|
|||||||
if ($journal->hasMeta('original_currency_id')) {
|
if ($journal->hasMeta('original_currency_id')) {
|
||||||
/** @var CurrencyRepositoryInterface $repository */
|
/** @var CurrencyRepositoryInterface $repository */
|
||||||
$repository = app(CurrencyRepositoryInterface::class);
|
$repository = app(CurrencyRepositoryInterface::class);
|
||||||
$originalCurrency = $repository->find(intval($journal->hasMeta('original_currency_id')));
|
$originalCurrency = $repository->find(intval($journal->getMeta('original_currency_id')));
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'originalCurrency'));
|
return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'originalCurrency'));
|
||||||
|
@@ -187,6 +187,15 @@ class JournalRepository implements JournalRepositoryInterface
|
|||||||
$amount = strval($data['exchanged_amount']);
|
$amount = strval($data['exchanged_amount']);
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
throw new FireflyException(sprintf('Currency exchange routine cannot handle %s', $transactionType->type));
|
throw new FireflyException(sprintf('Currency exchange routine cannot handle %s', $transactionType->type));
|
||||||
}
|
}
|
||||||
|
@@ -261,5 +261,8 @@ function getAccountId() {
|
|||||||
if(what === "withdrawal") {
|
if(what === "withdrawal") {
|
||||||
return $('select[name="source_account_id"]').val();
|
return $('select[name="source_account_id"]').val();
|
||||||
}
|
}
|
||||||
|
if(what === "deposit") {
|
||||||
|
return $('select[name="destination_account_id"]').val();
|
||||||
|
}
|
||||||
alert('Cannot handle ' + what);
|
alert('Cannot handle ' + what);
|
||||||
}
|
}
|
@@ -60,6 +60,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('.currency-option').on('click', triggerCurrencyChange);
|
$('.currency-option').on('click', triggerCurrencyChange);
|
||||||
|
$('#ffInput_amount').on('change', getExchangeRate);
|
||||||
|
|
||||||
// always update the exchanged_amount to match the correct currency
|
// always update the exchanged_amount to match the correct currency
|
||||||
var journalCurrency = currencyInfo[journal.transaction_currency_id].symbol;
|
var journalCurrency = currencyInfo[journal.transaction_currency_id].symbol;
|
||||||
@@ -135,5 +136,9 @@ function getAccountId() {
|
|||||||
if(journal.transaction_type.type === "Withdrawal") {
|
if(journal.transaction_type.type === "Withdrawal") {
|
||||||
return $('select[name="source_account_id"]').val();
|
return $('select[name="source_account_id"]').val();
|
||||||
}
|
}
|
||||||
|
if(journal.transaction_type.type === "Deposit") {
|
||||||
|
return $('select[name="destination_account_id"]').val();
|
||||||
|
}
|
||||||
|
|
||||||
alert('Cannot handle ' + journal.transaction_type.type);
|
alert('Cannot handle ' + journal.transaction_type.type);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user