mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 01:42:32 +00:00
More PHP8.4 updates
This commit is contained in:
@@ -149,9 +149,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
public function getMetaValue(Account $account, string $field): ?string
|
||||
{
|
||||
$result = $account->accountMeta->filter(
|
||||
static function (AccountMeta $meta) use ($field) {
|
||||
return strtolower($meta->name) === strtolower($field);
|
||||
}
|
||||
static fn(AccountMeta $meta) => strtolower($meta->name) === strtolower($field)
|
||||
);
|
||||
if (0 === $result->count()) {
|
||||
return null;
|
||||
|
||||
@@ -117,8 +117,8 @@ class BillRepository implements BillRepositoryInterface
|
||||
// ignore conversion, use foreign amount
|
||||
$nativeAmount = (string) $sourceTransaction->foreign_amount;
|
||||
}
|
||||
$return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], $amount);
|
||||
$return[$currencyId]['native_sum'] = bcadd($return[$currencyId]['native_sum'], $nativeAmount);
|
||||
$return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], (string) $amount);
|
||||
$return[$currencyId]['native_sum'] = bcadd($return[$currencyId]['native_sum'], (string) $nativeAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
if ($total > 0) {
|
||||
$currency = $bill->transactionCurrency;
|
||||
$currencyId = $bill->transaction_currency_id;
|
||||
$average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2');
|
||||
$average = bcdiv(bcadd((string) $bill->amount_max, (string) $bill->amount_min), '2');
|
||||
$nativeAverage = $converter->convert($currency, $default, $start, $average);
|
||||
$return[$currencyId] ??= [
|
||||
'currency_id' => (string) $currency->id,
|
||||
|
||||
@@ -68,7 +68,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
||||
'native_amount' => '0',
|
||||
];
|
||||
$nativeAmount = $converter->convert($availableBudget->transactionCurrency, $default, $availableBudget->start_date, $availableBudget->amount);
|
||||
$return[$currencyId]['amount'] = bcadd($return[$currencyId]['amount'], $availableBudget->amount);
|
||||
$return[$currencyId]['amount'] = bcadd($return[$currencyId]['amount'], (string) $availableBudget->amount);
|
||||
$return[$currencyId]['native_amount'] = bcadd($return[$currencyId]['native_amount'], $nativeAmount);
|
||||
}
|
||||
$converter->summarize();
|
||||
|
||||
@@ -179,12 +179,8 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
$local = $this->get();
|
||||
|
||||
return $all->map(static function (TransactionCurrency $current) use ($local) {
|
||||
$hasId = $local->contains(static function (TransactionCurrency $entry) use ($current) {
|
||||
return $entry->id === $current->id;
|
||||
});
|
||||
$isNative = $local->contains(static function (TransactionCurrency $entry) use ($current) {
|
||||
return 1 === (int) $entry->pivot->group_default && $entry->id === $current->id;
|
||||
});
|
||||
$hasId = $local->contains(static fn(TransactionCurrency $entry) => $entry->id === $current->id);
|
||||
$isNative = $local->contains(static fn(TransactionCurrency $entry) => 1 === (int) $entry->pivot->group_default && $entry->id === $current->id);
|
||||
$current->userGroupEnabled = $hasId;
|
||||
$current->userGroupNative = $isNative;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user