mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 00:27:30 +00:00
Fix #10824
This commit is contained in:
@@ -114,6 +114,7 @@ class AccountController extends Controller
|
|||||||
'id' => (string) $account->id,
|
'id' => (string) $account->id,
|
||||||
'name' => $account->name,
|
'name' => $account->name,
|
||||||
'name_with_balance' => $nameWithBalance,
|
'name_with_balance' => $nameWithBalance,
|
||||||
|
'active' => $account->active,
|
||||||
'type' => $account->accountType->type,
|
'type' => $account->accountType->type,
|
||||||
'currency_id' => (string) $useCurrency->id,
|
'currency_id' => (string) $useCurrency->id,
|
||||||
'currency_name' => $useCurrency->name,
|
'currency_name' => $useCurrency->name,
|
||||||
|
@@ -69,6 +69,7 @@ class BudgetController extends Controller
|
|||||||
static fn (Budget $item) => [
|
static fn (Budget $item) => [
|
||||||
'id' => (string) $item->id,
|
'id' => (string) $item->id,
|
||||||
'name' => $item->name,
|
'name' => $item->name,
|
||||||
|
'active' => $item->active,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -337,6 +337,9 @@ class ConvertController extends Controller
|
|||||||
'type' => $transactionType->type,
|
'type' => $transactionType->type,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$sourceTransaction = $journal->transactions()->where('amount', '<', 0)->first();
|
||||||
|
$amount = $sourceTransaction?->amount ?? '0';
|
||||||
|
|
||||||
// also set the currency to the currency of the source account, in case you're converting a deposit into a transfer.
|
// also set the currency to the currency of the source account, in case you're converting a deposit into a transfer.
|
||||||
if (TransactionTypeEnum::TRANSFER->value === $transactionType->type && TransactionTypeEnum::DEPOSIT->value === $journal->transactionType->type) {
|
if (TransactionTypeEnum::TRANSFER->value === $transactionType->type && TransactionTypeEnum::DEPOSIT->value === $journal->transactionType->type) {
|
||||||
$source = $this->accountRepository->find((int) $sourceId);
|
$source = $this->accountRepository->find((int) $sourceId);
|
||||||
@@ -346,7 +349,20 @@ class ConvertController extends Controller
|
|||||||
if ($sourceCurrency instanceof TransactionCurrency && $destCurrency instanceof TransactionCurrency && $sourceCurrency->code !== $destCurrency->code) {
|
if ($sourceCurrency instanceof TransactionCurrency && $destCurrency instanceof TransactionCurrency && $sourceCurrency->code !== $destCurrency->code) {
|
||||||
$update['currency_id'] = $sourceCurrency->id;
|
$update['currency_id'] = $sourceCurrency->id;
|
||||||
$update['foreign_currency_id'] = $destCurrency->id;
|
$update['foreign_currency_id'] = $destCurrency->id;
|
||||||
$update['foreign_amount'] = '1'; // not the best solution but at this point the amount is hard to get.
|
$update['foreign_amount'] = Steam::positive($amount); // not the best solution but at this point the amount is hard to get.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// same thing for converting a withdrawal into a transfer, but with the currency of the destination account.
|
||||||
|
if (TransactionTypeEnum::TRANSFER->value === $transactionType->type && TransactionTypeEnum::WITHDRAWAL->value === $journal->transactionType->type) {
|
||||||
|
$source = $this->accountRepository->find((int) $sourceId);
|
||||||
|
$sourceCurrency = $this->accountRepository->getAccountCurrency($source);
|
||||||
|
$dest = $this->accountRepository->find((int) $destinationId);
|
||||||
|
$destCurrency = $this->accountRepository->getAccountCurrency($dest);
|
||||||
|
if ($sourceCurrency instanceof TransactionCurrency && $destCurrency instanceof TransactionCurrency && $sourceCurrency->code !== $destCurrency->code) {
|
||||||
|
$update['currency_id'] = $sourceCurrency->id;
|
||||||
|
$update['foreign_currency_id'] = $destCurrency->id;
|
||||||
|
$update['foreign_amount'] = Steam::positive($amount); // not the best solution but at this point the amount is hard to get.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- [Issue 10813](https://github.com/firefly-iii/firefly-iii/issues/10813) (Error "Argument #2 ($symbol) must be of type string" while try open subscriptions section) reported by @mrResident
|
- [Issue 10813](https://github.com/firefly-iii/firefly-iii/issues/10813) (Error "Argument #2 ($symbol) must be of type string" while try open subscriptions section) reported by @mrResident
|
||||||
- #10819
|
- #10819
|
||||||
- #10820
|
- #10820
|
||||||
|
- #10824
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
|
||||||
|
@@ -48,6 +48,7 @@ Route::group(
|
|||||||
// Auto complete routes
|
// Auto complete routes
|
||||||
Route::get('accounts', ['uses' => 'AccountController@accounts', 'as' => 'accounts']);
|
Route::get('accounts', ['uses' => 'AccountController@accounts', 'as' => 'accounts']);
|
||||||
Route::get('bills', ['uses' => 'BillController@bills', 'as' => 'bills']);
|
Route::get('bills', ['uses' => 'BillController@bills', 'as' => 'bills']);
|
||||||
|
Route::get('subscriptions', ['uses' => 'BillController@bills', 'as' => 'subscriptions']);
|
||||||
Route::get('budgets', ['uses' => 'BudgetController@budgets', 'as' => 'budgets']);
|
Route::get('budgets', ['uses' => 'BudgetController@budgets', 'as' => 'budgets']);
|
||||||
Route::get('categories', ['uses' => 'CategoryController@categories', 'as' => 'categories']);
|
Route::get('categories', ['uses' => 'CategoryController@categories', 'as' => 'categories']);
|
||||||
Route::get('currencies', ['uses' => 'CurrencyController@currencies', 'as' => 'currencies']);
|
Route::get('currencies', ['uses' => 'CurrencyController@currencies', 'as' => 'currencies']);
|
||||||
|
Reference in New Issue
Block a user