mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Merge branch 'develop' into fix-10265-addendum
# Conflicts: # app/Factory/TransactionJournalFactory.php
This commit is contained in:
@@ -170,6 +170,7 @@ class TransactionJournalFactory
|
||||
Log::debug('Find currency or return default.');
|
||||
$currency = $this->currencyRepository->findCurrency((int) $row['currency_id'], $row['currency_code']);
|
||||
Log::debug('Find foreign currency or return NULL.');
|
||||
|
||||
$foreignCurrency = $this->currencyRepository->findCurrencyNull($row['foreign_currency_id'], $row['foreign_currency_code']);
|
||||
$bill = $this->billRepository->findBill((int) $row['bill_id'], $row['bill_name']);
|
||||
$billId = TransactionTypeEnum::WITHDRAWAL->value === $type->type && null !== $bill ? $bill->id : null;
|
||||
@@ -218,6 +219,7 @@ class TransactionJournalFactory
|
||||
$destinationAccount = $this->getAccount($type->type, 'destination', $destInfo);
|
||||
Log::debug('Done with getAccount(2x)');
|
||||
|
||||
|
||||
// this is the moment for a reconciliation sanity check (again).
|
||||
if (TransactionTypeEnum::RECONCILIATION->value === $type->type) {
|
||||
[$sourceAccount, $destinationAccount] = $this->reconciliationSanityCheck($sourceAccount, $destinationAccount);
|
||||
@@ -282,8 +284,8 @@ class TransactionJournalFactory
|
||||
// see the currency they expect to see.
|
||||
$amount = (string) $row['amount'];
|
||||
$foreignAmount = (string) $row['foreign_amount'];
|
||||
if (null !== $foreignCurrency && $foreignCurrency->id !== $currency->id
|
||||
&& TransactionTypeEnum::TRANSFER->value === $type->type
|
||||
if (null !== $foreignCurrency && $foreignCurrency->id !== $currency->id &&
|
||||
(TransactionTypeEnum::TRANSFER->value === $type->type || $this->isBetweenAssetAndLiability($sourceAccount, $destinationAccount))
|
||||
) {
|
||||
$transactionFactory->setCurrency($foreignCurrency);
|
||||
$transactionFactory->setForeignCurrency($currency);
|
||||
@@ -623,22 +625,19 @@ class TransactionJournalFactory
|
||||
|
||||
private function isBetweenAssetAndLiability(Account $source, Account $destination): bool
|
||||
{
|
||||
if (null === $source || null === $destination) {
|
||||
Log::warning('Either is false, stop.');
|
||||
return false;
|
||||
}
|
||||
$sourceTypes = [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value];
|
||||
|
||||
// source is liability, destination is asset
|
||||
if (in_array($source->accountType->type, $sourceTypes, true) && AccountTypeEnum::ASSET->value === $destination->accountType->type) {
|
||||
if(in_array($source->accountType->type, $sourceTypes, true) && AccountTypeEnum::ASSET->value === $destination->accountType->type) {
|
||||
Log::debug('Source is a liability account, destination is an asset account, return TRUE.');
|
||||
return true;
|
||||
}
|
||||
// source is asset, destination is liability
|
||||
if (in_array($destination->accountType->type, $sourceTypes, true) && AccountTypeEnum::ASSET->value === $source->accountType->type) {
|
||||
if(in_array($destination->accountType->type, $sourceTypes, true) && AccountTypeEnum::ASSET->value === $source->accountType->type) {
|
||||
Log::debug('Destination is a liability account, source is an asset account, return TRUE.');
|
||||
return true;
|
||||
}
|
||||
Log::debug('Not between asset and liability, return FALSE');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -163,7 +163,9 @@ class IndexController extends Controller
|
||||
|
||||
/** @var Carbon $end */
|
||||
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
|
||||
$start->subDay();
|
||||
|
||||
// 2025-05-11 removed this so start is exactly the start of the month.
|
||||
// $start->subDay();
|
||||
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
Log::debug(sprintf('index start: finalAccountsBalance("%s")', $start->format('Y-m-d H:i:s')));
|
||||
|
@@ -55,9 +55,9 @@ var edit_selected_txt = "{{ trans('firefly.mass_edit')|escape('js') }}";
|
||||
var edit_bulk_selected_txt = "{{ trans('firefly.bulk_edit')|escape('js') }}";
|
||||
var delete_selected_txt = "{{ trans('firefly.mass_delete')|escape('js') }}";
|
||||
|
||||
var mass_edit_url = '{{ route('transactions.mass.edit', ['']) }}';
|
||||
var bulk_edit_url = '{{ route('transactions.bulk.edit', ['']) }}';
|
||||
var mass_delete_url = '{{ route('transactions.mass.delete', ['']) }}';
|
||||
var mass_edit_url = '{{ route('transactions.mass.edit', ['0']) }}';
|
||||
var bulk_edit_url = '{{ route('transactions.bulk.edit', ['0']) }}';
|
||||
var mass_delete_url = '{{ route('transactions.mass.delete', ['0']) }}';
|
||||
|
||||
// for demo:
|
||||
var nextLabel = "{{ trans('firefly.intro_next_label')|escape('js') }}";
|
||||
|
@@ -259,7 +259,17 @@
|
||||
{% if transaction.transaction_type_type == 'Deposit' %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% elseif transaction.transaction_type_type == 'Withdrawal' %}
|
||||
{{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% if 'Loan' == transaction.destination_account_type or 'Mortgage' == transaction.destination_account_type or 'Debt' == transaction.destination_account_type %}
|
||||
{% if currency.id == transaction.currency_id %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% endif %}
|
||||
{% if currency.id == transaction.foreign_currency_id %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }}
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
{% endif %}
|
||||
{% elseif transaction.transaction_type_type == 'Opening balance' %}
|
||||
{% if transaction.source_account_type == 'Initial balance account' %}
|
||||
{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
|
Reference in New Issue
Block a user