🤖 Auto commit for release 'develop' on 2025-12-22

This commit is contained in:
JC5
2025-12-22 04:36:14 +01:00
parent 92a535c644
commit bc4018481f
45 changed files with 303 additions and 272 deletions

View File

@@ -36,6 +36,7 @@ use Illuminate\Console\Command;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Symfony\Component\Console\Command\Command as CommandAlias; use Symfony\Component\Console\Command\Command as CommandAlias;
use FireflyIII\Support\Facades\Amount;
class CorrectsCurrencies extends Command class CorrectsCurrencies extends Command
{ {
@@ -63,7 +64,7 @@ class CorrectsCurrencies extends Command
$repos = app(CurrencyRepositoryInterface::class); $repos = app(CurrencyRepositoryInterface::class);
// first check if the user has any default currency (not necessarily the case, so can be forced). // first check if the user has any default currency (not necessarily the case, so can be forced).
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($userGroup); $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($userGroup);
Log::debug(sprintf('Now correcting currencies for user group #%d', $userGroup->id)); Log::debug(sprintf('Now correcting currencies for user group #%d', $userGroup->id));
$found = [$primaryCurrency->id]; $found = [$primaryCurrency->id];

View File

@@ -35,6 +35,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use FireflyIII\Support\Facades\Amount;
class CorrectsOpeningBalanceCurrencies extends Command class CorrectsOpeningBalanceCurrencies extends Command
{ {
@@ -133,6 +134,6 @@ class CorrectsOpeningBalanceCurrencies extends Command
$repos = app(AccountRepositoryInterface::class); $repos = app(AccountRepositoryInterface::class);
$repos->setUser($account->user); $repos->setUser($account->user);
return $repos->getAccountCurrency($account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->userGroup); return $repos->getAccountCurrency($account) ?? Amount::getPrimaryCurrencyByUserGroup($account->userGroup);
} }
} }

View File

@@ -36,6 +36,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Facades\Amount;
class UpgradesAccountCurrencies extends Command class UpgradesAccountCurrencies extends Command
{ {
@@ -105,7 +106,7 @@ class UpgradesAccountCurrencies extends Command
$accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value]); $accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value]);
// get user's currency preference: // get user's currency preference:
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($user->userGroup);
/** @var Account $account */ /** @var Account $account */
foreach ($accounts as $account) { foreach ($accounts as $account) {

View File

@@ -31,6 +31,7 @@ use FireflyIII\Models\BudgetLimit;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Facades\Amount;
class UpgradesBudgetLimits extends Command class UpgradesBudgetLimits extends Command
{ {
@@ -67,7 +68,7 @@ class UpgradesBudgetLimits extends Command
/** @var null|User $user */ /** @var null|User $user */
$user = $budget->user; $user = $budget->user;
if (null !== $user) { if (null !== $user) {
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($user->userGroup);
$budgetLimit->transaction_currency_id = $currency->id; $budgetLimit->transaction_currency_id = $currency->id;
$budgetLimit->save(); $budgetLimit->save();
$this->friendlyInfo( $this->friendlyInfo(

View File

@@ -32,6 +32,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Facades\Amount;
class UpgradesMultiPiggyBanks extends Command class UpgradesMultiPiggyBanks extends Command
{ {
@@ -95,7 +96,7 @@ class UpgradesMultiPiggyBanks extends Command
$this->repository->setUser($piggyBank->account->user); $this->repository->setUser($piggyBank->account->user);
$this->accountRepository->setUser($piggyBank->account->user); $this->accountRepository->setUser($piggyBank->account->user);
$repetition = $this->repository->getRepetition($piggyBank, true); $repetition = $this->repository->getRepetition($piggyBank, true);
$currency = $this->accountRepository->getAccountCurrency($piggyBank->account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($piggyBank->account->user->userGroup); $currency = $this->accountRepository->getAccountCurrency($piggyBank->account) ?? Amount::getPrimaryCurrencyByUserGroup($piggyBank->account->user->userGroup);
// update piggy bank to have a currency. // update piggy bank to have a currency.
$piggyBank->transaction_currency_id = $currency->id; $piggyBank->transaction_currency_id = $currency->id;

View File

@@ -32,6 +32,7 @@ use FireflyIII\Services\Internal\Support\BillServiceTrait;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class BillFactory * Class BillFactory
@@ -51,7 +52,7 @@ class BillFactory
Log::debug(sprintf('Now in %s', __METHOD__), $data); Log::debug(sprintf('Now in %s', __METHOD__), $data);
$factory = app(TransactionCurrencyFactory::class); $factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null)) $currency = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null))
?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); ?? Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
try { try {
$skip = array_key_exists('skip', $data) ? $data['skip'] : 0; $skip = array_key_exists('skip', $data) ? $data['skip'] : 0;

View File

@@ -36,6 +36,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use FireflyIII\Support\Facades\Amount;
use function Safe\json_encode; use function Safe\json_encode;
@@ -126,7 +127,7 @@ class PiggyBankFactory
private function getCurrency(array $data): TransactionCurrency private function getCurrency(array $data): TransactionCurrency
{ {
// currency: // currency:
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $primaryCurrency = Amount::getPrimaryCurrency();
$currency = null; $currency = null;
if (array_key_exists('transaction_currency_code', $data)) { if (array_key_exists('transaction_currency_code', $data)) {
$currency = $this->currencyRepository->findByCode((string)($data['transaction_currency_code'] ?? '')); $currency = $this->currencyRepository->findByCode((string)($data['transaction_currency_code'] ?? ''));

View File

@@ -55,6 +55,7 @@ use FireflyIII\Validation\AccountValidator;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use JsonException; use JsonException;
use FireflyIII\Support\Facades\Amount;
use function Safe\json_encode; use function Safe\json_encode;
@@ -502,7 +503,7 @@ class TransactionJournalFactory
$preference = $this->accountRepository->getAccountCurrency($account); $preference = $this->accountRepository->getAccountCurrency($account);
if (null === $preference && !$currency instanceof TransactionCurrency) { if (null === $preference && !$currency instanceof TransactionCurrency) {
// return user's default: // return user's default:
return \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); return Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
} }
$result = $preference ?? $currency; $result = $preference ?? $currency;
Log::debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name)); Log::debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));

View File

@@ -35,6 +35,7 @@ use FireflyIII\Support\Facades\Steam;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Throwable; use Throwable;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class MonthReportGenerator. * Class MonthReportGenerator.
@@ -144,7 +145,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
$dayBeforeBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id]; $dayBeforeBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id];
$startBalance = $dayBeforeBalance['balance']; $startBalance = $dayBeforeBalance['balance'];
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
$currency = $accountRepository->getAccountCurrency($account) ?? $primaryCurrency; $currency = $accountRepository->getAccountCurrency($account) ?? $primaryCurrency;
foreach ($journals as $index => $journal) { foreach ($journals as $index => $journal) {

View File

@@ -52,7 +52,7 @@ class AccountObserver
if (!Amount::convertToPrimary($account->user)) { if (!Amount::convertToPrimary($account->user)) {
return; return;
} }
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
$repository = app(AccountRepositoryInterface::class); $repository = app(AccountRepositoryInterface::class);
$currency = $repository->getAccountCurrency($account); $currency = $repository->getAccountCurrency($account);
if (null !== $currency && $currency->id !== $userCurrency->id && '' !== (string) $account->virtual_balance && 0 !== bccomp($account->virtual_balance, '0')) { if (null !== $currency && $currency->id !== $userCurrency->id && '' !== (string) $account->virtual_balance && 0 !== bccomp($account->virtual_balance, '0')) {

View File

@@ -42,7 +42,7 @@ class AutoBudgetObserver
if (!Amount::convertToPrimary($autoBudget->budget->user)) { if (!Amount::convertToPrimary($autoBudget->budget->user)) {
return; return;
} }
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($autoBudget->budget->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($autoBudget->budget->user->userGroup);
$autoBudget->native_amount = null; $autoBudget->native_amount = null;
if ($autoBudget->transactionCurrency->id !== $userCurrency->id) { if ($autoBudget->transactionCurrency->id !== $userCurrency->id) {
$converter = new ExchangeRateConverter(); $converter = new ExchangeRateConverter();

View File

@@ -44,7 +44,7 @@ class AvailableBudgetObserver
return; return;
} }
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($availableBudget->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($availableBudget->user->userGroup);
$availableBudget->native_amount = null; $availableBudget->native_amount = null;
if ($availableBudget->transactionCurrency->id !== $userCurrency->id) { if ($availableBudget->transactionCurrency->id !== $userCurrency->id) {
$converter = new ExchangeRateConverter(); $converter = new ExchangeRateConverter();

View File

@@ -46,7 +46,7 @@ class BillObserver
if (!Amount::convertToPrimary($bill->user)) { if (!Amount::convertToPrimary($bill->user)) {
return; return;
} }
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup);
$bill->native_amount_min = null; $bill->native_amount_min = null;
$bill->native_amount_max = null; $bill->native_amount_max = null;
if ($bill->transactionCurrency->id !== $userCurrency->id) { if ($bill->transactionCurrency->id !== $userCurrency->id) {

View File

@@ -72,7 +72,7 @@ class BudgetLimitObserver
return; return;
} }
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($budgetLimit->budget->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($budgetLimit->budget->user->userGroup);
$budgetLimit->native_amount = null; $budgetLimit->native_amount = null;
if ($budgetLimit->transactionCurrency->id !== $userCurrency->id) { if ($budgetLimit->transactionCurrency->id !== $userCurrency->id) {
$converter = new ExchangeRateConverter(); $converter = new ExchangeRateConverter();

View File

@@ -48,7 +48,7 @@ class PiggyBankEventObserver
if (!Amount::convertToPrimary($user)) { if (!Amount::convertToPrimary($user)) {
return; return;
} }
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($event->piggyBank->accounts()->first()->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($event->piggyBank->accounts()->first()->user->userGroup);
$event->native_amount = null; $event->native_amount = null;
if ($event->piggyBank->transactionCurrency->id !== $userCurrency->id) { if ($event->piggyBank->transactionCurrency->id !== $userCurrency->id) {
$converter = new ExchangeRateConverter(); $converter = new ExchangeRateConverter();

View File

@@ -29,6 +29,7 @@ use FireflyIII\Models\PiggyBank;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Http\Api\ExchangeRateConverter;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class PiggyBankObserver * Class PiggyBankObserver
@@ -49,7 +50,7 @@ class PiggyBankObserver
return; return;
} }
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($group); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($group);
$piggyBank->native_target_amount = null; $piggyBank->native_target_amount = null;
if ($piggyBank->transactionCurrency->id !== $userCurrency->id) { if ($piggyBank->transactionCurrency->id !== $userCurrency->id) {
$converter = new ExchangeRateConverter(); $converter = new ExchangeRateConverter();

View File

@@ -52,7 +52,7 @@ class TransactionObserver
if (!Amount::convertToPrimary($transaction->transactionJournal->user)) { if (!Amount::convertToPrimary($transaction->transactionJournal->user)) {
return; return;
} }
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($transaction->transactionJournal->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($transaction->transactionJournal->user->userGroup);
$transaction->native_amount = null; $transaction->native_amount = null;
$transaction->native_foreign_amount = null; $transaction->native_foreign_amount = null;
// first normal amount // first normal amount

View File

@@ -45,6 +45,7 @@ use Illuminate\Routing\Redirector;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\View\View; use Illuminate\View\View;
use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class BudgetLimitController * Class BudgetLimitController
@@ -205,14 +206,14 @@ class BudgetLimitController extends Controller
// add some extra metadata: // add some extra metadata:
$spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection()->push($budget), $currency); $spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection()->push($budget), $currency);
$array['spent'] = $spentArr[$currency->id]['sum'] ?? '0'; $array['spent'] = $spentArr[$currency->id]['sum'] ?? '0';
$array['left_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount'])); $array['left_formatted'] = Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
$array['amount_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $limit['amount']); $array['amount_formatted'] = Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
$array['days_left'] = (string) $this->activeDaysLeft($start, $end); $array['days_left'] = (string) $this->activeDaysLeft($start, $end);
// left per day: // left per day:
$array['left_per_day'] = 0 === bccomp('0', $array['days_left']) ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']); $array['left_per_day'] = 0 === bccomp('0', $array['days_left']) ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']);
// left per day formatted. // left per day formatted.
$array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']); $array['left_per_day_formatted'] = Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']);
// notes: // notes:
$array['notes'] = $this->blRepository->getNoteText($limit); $array['notes'] = $this->blRepository->getNoteText($limit);
@@ -239,8 +240,8 @@ class BudgetLimitController extends Controller
$this->blRepository->destroyBudgetLimit($budgetLimit); $this->blRepository->destroyBudgetLimit($budgetLimit);
$array = [ $array = [
'budget_id' => $budgetId, 'budget_id' => $budgetId,
'left_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'), 'left_formatted' => Amount::formatAnything($currency, '0'),
'left_per_day_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'), 'left_per_day_formatted' => Amount::formatAnything($currency, '0'),
'transaction_currency_id' => $currency->id, 'transaction_currency_id' => $currency->id,
]; ];
@@ -269,14 +270,14 @@ class BudgetLimitController extends Controller
); );
$daysLeft = $this->activeDaysLeft($limit->start_date, $limit->end_date); $daysLeft = $this->activeDaysLeft($limit->start_date, $limit->end_date);
$array['spent'] = $spentArr[$budgetLimit->transactionCurrency->id]['sum'] ?? '0'; $array['spent'] = $spentArr[$budgetLimit->transactionCurrency->id]['sum'] ?? '0';
$array['left_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount'])); $array['left_formatted'] = Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount']));
$array['amount_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $limit['amount']); $array['amount_formatted'] = Amount::formatAnything($limit->transactionCurrency, $limit['amount']);
$array['days_left'] = (string) $daysLeft; $array['days_left'] = (string) $daysLeft;
$array['left_per_day'] = 0 === $daysLeft ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']); $array['left_per_day'] = 0 === $daysLeft ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']);
// left per day formatted. // left per day formatted.
$array['amount'] = Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places); $array['amount'] = Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places);
$array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']); $array['left_per_day_formatted'] = Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']);
if ('true' === $request->get('redirect')) { if ('true' === $request->get('redirect')) {
return redirect(route('budgets.index')); return redirect(route('budgets.index'));
} }

View File

@@ -37,6 +37,7 @@ use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class JavascriptController. * Class JavascriptController.
@@ -106,7 +107,7 @@ class JavascriptController extends Controller
$currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency; $currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency;
} }
$locale = Steam::getLocale(); $locale = Steam::getLocale();
$accounting = \FireflyIII\Support\Facades\Amount::getJsConfig(); $accounting = Amount::getJsConfig();
$accounting['frac_digits'] = $currency->decimal_places; $accounting['frac_digits'] = $currency->decimal_places;
$pref = Preferences::get('language', config('firefly.default_language', 'en_US')); $pref = Preferences::get('language', config('firefly.default_language', 'en_US'));
$lang = $pref->data; $lang = $pref->data;

View File

@@ -121,15 +121,15 @@ class BoxController extends Controller
$keys = array_keys($sums); $keys = array_keys($sums);
foreach ($keys as $currencyId) { foreach ($keys as $currencyId) {
$currency = $repository->find($currencyId); $currency = $repository->find($currencyId);
$sums[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $sums[$currencyId], false); $sums[$currencyId] = Amount::formatAnything($currency, $sums[$currencyId], false);
$incomes[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $incomes[$currencyId] ?? '0', false); $incomes[$currencyId] = Amount::formatAnything($currency, $incomes[$currencyId] ?? '0', false);
$expenses[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $expenses[$currencyId] ?? '0', false); $expenses[$currencyId] = Amount::formatAnything($currency, $expenses[$currencyId] ?? '0', false);
} }
if (0 === count($sums)) { if (0 === count($sums)) {
$currency = $this->primaryCurrency; $currency = $this->primaryCurrency;
$sums[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false); $sums[$this->primaryCurrency->id] = Amount::formatAnything($this->primaryCurrency, '0', false);
$incomes[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false); $incomes[$this->primaryCurrency->id] = Amount::formatAnything($this->primaryCurrency, '0', false);
$expenses[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false); $expenses[$this->primaryCurrency->id] = Amount::formatAnything($this->primaryCurrency, '0', false);
} }
$response = [ $response = [
@@ -187,7 +187,7 @@ class BoxController extends Controller
if ('primary' === $key) { if ('primary' === $key) {
continue; continue;
} }
$return[$data['currency_id']] = \FireflyIII\Support\Facades\Amount::formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false); $return[$data['currency_id']] = Amount::formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false);
} }
$return = [ $return = [
'net_worths' => array_values($return), 'net_worths' => array_values($return),

View File

@@ -33,6 +33,7 @@ use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Support\Http\Controllers\DateCalculation; use FireflyIII\Support\Http\Controllers\DateCalculation;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class BudgetController * Class BudgetController
@@ -84,9 +85,9 @@ class BudgetController extends Controller
return response()->json( return response()->json(
[ [
'budgeted' => $budgeted, 'budgeted' => $budgeted,
'budgeted_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, $budgeted, true), 'budgeted_formatted' => Amount::formatAnything($currency, $budgeted, true),
'available' => $available, 'available' => $available,
'available_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, $available, true), 'available_formatted' => Amount::formatAnything($currency, $available, true),
'percentage' => $percentage, 'percentage' => $percentage,
'currency_id' => $currency->id, 'currency_id' => $currency->id,
'currency_code' => $currency->code, 'currency_code' => $currency->code,

View File

@@ -35,6 +35,7 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\View\View; use Illuminate\View\View;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class AmountController * Class AmountController
@@ -167,7 +168,7 @@ class AmountController extends Controller
$piggyBank->refresh(); $piggyBank->refresh();
} }
if (0 !== bccomp($total, '0')) { if (0 !== bccomp($total, '0')) {
session()->flash('success', (string) trans('firefly.added_amount_to_piggy', ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name])); session()->flash('success', (string) trans('firefly.added_amount_to_piggy', ['amount' => Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name]));
Preferences::mark(); Preferences::mark();
return redirect(route('piggy-banks.index')); return redirect(route('piggy-banks.index'));
@@ -177,7 +178,7 @@ class AmountController extends Controller
'error', 'error',
(string) trans( (string) trans(
'firefly.cannot_add_amount_piggy', 'firefly.cannot_add_amount_piggy',
['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] ['amount' => Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)]
) )
); );
@@ -214,7 +215,7 @@ class AmountController extends Controller
'success', 'success',
(string) trans( (string) trans(
'firefly.removed_amount_from_piggy', 'firefly.removed_amount_from_piggy',
['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name] ['amount' => Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name]
) )
); );
Preferences::mark(); Preferences::mark();
@@ -226,7 +227,7 @@ class AmountController extends Controller
'error', 'error',
(string) trans( (string) trans(
'firefly.cannot_remove_from_piggy', 'firefly.cannot_remove_from_piggy',
['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] ['amount' => Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)]
) )
); );

View File

@@ -31,6 +31,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use FireflyIII\Support\Facades\Amount;
class TransactionCurrency extends Model class TransactionCurrency extends Model
{ {
@@ -65,7 +66,7 @@ class TransactionCurrency extends Model
public function refreshForUser(User $user): void public function refreshForUser(User $user): void
{ {
$current = $user->userGroup->currencies()->where('transaction_currencies.id', $this->id)->first(); $current = $user->userGroup->currencies()->where('transaction_currencies.id', $this->id)->first();
$native = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); $native = Amount::getPrimaryCurrencyByUserGroup($user->userGroup);
$this->userGroupNative = $native->id === $this->id; $this->userGroupNative = $native->id === $this->id;
$this->userGroupEnabled = null !== $current; $this->userGroupEnabled = null !== $current;
} }

View File

@@ -353,7 +353,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
if (AccountTypeEnum::ASSET->value !== $account->accountType->type) { if (AccountTypeEnum::ASSET->value !== $account->accountType->type) {
throw new FireflyException(sprintf('%s is not an asset account.', $account->name)); throw new FireflyException(sprintf('%s is not an asset account.', $account->name));
} }
$currency = $this->getAccountCurrency($account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $currency = $this->getAccountCurrency($account) ?? Amount::getPrimaryCurrency();
$name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]); $name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]);
/** @var AccountType $type */ /** @var AccountType $type */

View File

@@ -34,6 +34,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class AccountTasker. * Class AccountTasker.
@@ -59,7 +60,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
/** @var AccountRepositoryInterface $repository */ /** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class); $repository = app(AccountRepositoryInterface::class);
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
$return = [ $return = [
'accounts' => [], 'accounts' => [],
@@ -146,7 +147,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
private function groupExpenseByDestination(array $array): array private function groupExpenseByDestination(array $array): array
{ {
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
/** @var CurrencyRepositoryInterface $currencyRepos */ /** @var CurrencyRepositoryInterface $currencyRepos */
$currencyRepos = app(CurrencyRepositoryInterface::class); $currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -231,7 +232,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
private function groupIncomeBySource(array $array): array private function groupIncomeBySource(array $array): array
{ {
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
/** @var CurrencyRepositoryInterface $currencyRepos */ /** @var CurrencyRepositoryInterface $currencyRepos */
$currencyRepos = app(CurrencyRepositoryInterface::class); $currencyRepos = app(CurrencyRepositoryInterface::class);

View File

@@ -536,7 +536,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface
$bills = $this->getActiveBills(); $bills = $this->getActiveBills();
$return = []; $return = [];
$convertToPrimary = Amount::convertToPrimary($this->user); $convertToPrimary = Amount::convertToPrimary($this->user);
$primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $primary = Amount::getPrimaryCurrency();
/** @var Bill $bill */ /** @var Bill $bill */
foreach ($bills as $bill) { foreach ($bills as $bill) {
@@ -602,7 +602,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface
$bills = $this->getActiveBills(); $bills = $this->getActiveBills();
$return = []; $return = [];
$convertToPrimary = Amount::convertToPrimary($this->user); $convertToPrimary = Amount::convertToPrimary($this->user);
$primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $primary = Amount::getPrimaryCurrency();
/** @var Bill $bill */ /** @var Bill $bill */
foreach ($bills as $bill) { foreach ($bills as $bill) {

View File

@@ -51,6 +51,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class BudgetRepository. * Class BudgetRepository.
@@ -94,7 +95,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
$limitRepository = app(BudgetLimitRepository::class); $limitRepository = app(BudgetLimitRepository::class);
$limitRepository->setUser($this->user); $limitRepository->setUser($this->user);
$budgets = $this->getActiveBudgets(); $budgets = $this->getActiveBudgets();
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $primaryCurrency = Amount::getPrimaryCurrency();
$converter = new ExchangeRateConverter(); $converter = new ExchangeRateConverter();
/** @var Budget $budget */ /** @var Budget $budget */
@@ -393,7 +394,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
$autoBudget = $this->getAutoBudget($budget); $autoBudget = $this->getAutoBudget($budget);
// grab default currency: // grab default currency:
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
if (!$autoBudget instanceof AutoBudget) { if (!$autoBudget instanceof AutoBudget) {
// at this point it's a blind assumption auto_budget_type is 1 or 2. // at this point it's a blind assumption auto_budget_type is 1 or 2.
@@ -778,7 +779,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
$currency = $repos->findByCode((string) $data['currency_code']); $currency = $repos->findByCode((string) $data['currency_code']);
} }
if (null === $currency) { if (null === $currency) {
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
} }
$autoBudget = new AutoBudget(); $autoBudget = new AutoBudget();

View File

@@ -45,6 +45,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Override; use Override;
use Safe\Exceptions\JsonException; use Safe\Exceptions\JsonException;
use function Safe\json_encode; use function Safe\json_encode;
/** /**
@@ -70,7 +71,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
public function currencyInUseAt(TransactionCurrency $currency): ?string public function currencyInUseAt(TransactionCurrency $currency): ?string
{ {
Log::debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code)); Log::debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code));
$countJournals = $this->countJournals($currency); $countJournals = $this->countJournals($currency);
if ($countJournals > 0) { if ($countJournals > 0) {
Log::info(sprintf('Count journals is %d, return true.', $countJournals)); Log::info(sprintf('Count journals is %d, return true.', $countJournals));
@@ -85,7 +86,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
} }
// is being used in accounts: // is being used in accounts:
$meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string)$currency->id))->count(); $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string)$currency->id))->count();
if ($meta > 0) { if ($meta > 0) {
Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta));
@@ -93,7 +94,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
} }
// second search using integer check. // second search using integer check.
$meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int)$currency->id))->count(); $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int)$currency->id))->count();
if ($meta > 0) { if ($meta > 0) {
Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta));
@@ -101,7 +102,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
} }
// is being used in bills: // is being used in bills:
$bills = Bill::where('transaction_currency_id', $currency->id)->count(); $bills = Bill::where('transaction_currency_id', $currency->id)->count();
if ($bills > 0) { if ($bills > 0) {
Log::info(sprintf('Used in %d bills as currency, return true. ', $bills)); Log::info(sprintf('Used in %d bills as currency, return true. ', $bills));
@@ -119,9 +120,10 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
} }
// is being used in accounts (as integer) // is being used in accounts (as integer)
$meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id') $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
->whereNull('accounts.deleted_at') ->whereNull('accounts.deleted_at')
->where('account_meta.name', 'currency_id')->where('account_meta.data', json_encode($currency->id))->count(); ->where('account_meta.name', 'currency_id')->where('account_meta.data', json_encode($currency->id))->count()
;
if ($meta > 0) { if ($meta > 0) {
Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta));
@@ -137,7 +139,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
} }
// is being used in budget limits // is being used in budget limits
$budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count(); $budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count();
if ($budgetLimit > 0) { if ($budgetLimit > 0) {
Log::info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit)); Log::info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit));
@@ -145,7 +147,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
} }
// is the default currency for the user or the system // is the default currency for the user or the system
$count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count(); $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count();
if ($count > 0) { if ($count > 0) {
Log::info('Is the default currency of the user, return true.'); Log::info('Is the default currency of the user, return true.');
@@ -153,7 +155,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
} }
// is the default currency for the user or the system // is the default currency for the user or the system
$count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count(); $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count();
if ($count > 0) { if ($count > 0) {
Log::info('Is the default currency of the user group, return true.'); Log::info('Is the default currency of the user group, return true.');
@@ -182,8 +184,8 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
$local = $this->get(); $local = $this->get();
return $all->map(static function (TransactionCurrency $current) use ($local): TransactionCurrency { return $all->map(static function (TransactionCurrency $current) use ($local): TransactionCurrency {
$hasId = $local->contains(static fn(TransactionCurrency $entry): bool => $entry->id === $current->id); $hasId = $local->contains(static fn (TransactionCurrency $entry): bool => $entry->id === $current->id);
$isPrimary = $local->contains(static fn(TransactionCurrency $entry): bool => 1 === (int)$entry->pivot->group_default && $entry->id === $current->id); $isPrimary = $local->contains(static fn (TransactionCurrency $entry): bool => 1 === (int)$entry->pivot->group_default && $entry->id === $current->id);
$current->userGroupEnabled = $hasId; $current->userGroupEnabled = $hasId;
$current->userGroupNative = $isPrimary; $current->userGroupNative = $isPrimary;
@@ -240,7 +242,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
Log::debug('Grabbing default currency for this user...'); Log::debug('Grabbing default currency for this user...');
/** @var null|TransactionCurrency $result */ /** @var null|TransactionCurrency $result */
$result = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $result = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
} }
Log::debug(sprintf('Final result: %s', $result->code)); Log::debug(sprintf('Final result: %s', $result->code));
@@ -274,6 +276,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
Log::debug(sprintf('Also enabled currency %s', $result->code)); Log::debug(sprintf('Also enabled currency %s', $result->code));
$this->enable($result); $this->enable($result);
} }
return $result; return $result;
} }
Log::debug('Found no currency, returning NULL.'); Log::debug('Found no currency, returning NULL.');
@@ -338,9 +341,10 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
/** @var null|CurrencyExchangeRate $rate */ /** @var null|CurrencyExchangeRate $rate */
$rate = $this->user->currencyExchangeRates() $rate = $this->user->currencyExchangeRates()
->where('from_currency_id', $fromCurrency->id) ->where('from_currency_id', $fromCurrency->id)
->where('to_currency_id', $toCurrency->id) ->where('to_currency_id', $toCurrency->id)
->where('date', $date->format('Y-m-d'))->first(); ->where('date', $date->format('Y-m-d'))->first()
;
if (null !== $rate) { if (null !== $rate) {
Log::debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d'))); Log::debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));
@@ -440,7 +444,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
public function makePrimary(TransactionCurrency $currency): void public function makePrimary(TransactionCurrency $currency): void
{ {
$current = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->userGroup); $current = Amount::getPrimaryCurrencyByUserGroup($this->userGroup);
Log::debug(sprintf('Enabled + made default currency %s for user #%d', $currency->code, $this->userGroup->id)); Log::debug(sprintf('Enabled + made default currency %s for user #%d', $currency->code, $this->userGroup->id));
$this->userGroup->currencies()->detach($currency->id); $this->userGroup->currencies()->detach($currency->id);
foreach ($this->userGroup->currencies()->get() as $item) { foreach ($this->userGroup->currencies()->get() as $item) {

View File

@@ -72,7 +72,7 @@ trait ModifiesPiggyBanks
$pivot->native_current_amount = null; $pivot->native_current_amount = null;
// also update native_current_amount. // also update native_current_amount.
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
if ($userCurrency->id !== $piggyBank->transaction_currency_id) { if ($userCurrency->id !== $piggyBank->transaction_currency_id) {
$converter = new ExchangeRateConverter(); $converter = new ExchangeRateConverter();
$converter->setIgnoreSettings(true); $converter->setIgnoreSettings(true);
@@ -95,7 +95,7 @@ trait ModifiesPiggyBanks
$pivot->native_current_amount = null; $pivot->native_current_amount = null;
// also update native_current_amount. // also update native_current_amount.
$userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $userCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
if ($userCurrency->id !== $piggyBank->transaction_currency_id) { if ($userCurrency->id !== $piggyBank->transaction_currency_id) {
$converter = new ExchangeRateConverter(); $converter = new ExchangeRateConverter();
$converter->setIgnoreSettings(true); $converter->setIgnoreSettings(true);

View File

@@ -44,6 +44,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Override; use Override;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class PiggyBankRepository. * Class PiggyBankRepository.
@@ -171,7 +172,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
$accountRepos = app(AccountRepositoryInterface::class); $accountRepos = app(AccountRepositoryInterface::class);
$accountRepos->setUser($this->user); $accountRepos->setUser($this->user);
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
Log::debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code)); Log::debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code));
@@ -302,7 +303,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
/** @var PiggyBank $piggy */ /** @var PiggyBank $piggy */
foreach ($set as $piggy) { foreach ($set as $piggy) {
$currentAmount = $this->getCurrentAmount($piggy); $currentAmount = $this->getCurrentAmount($piggy);
$piggy->name = sprintf('%s (%s)', $piggy->name, \FireflyIII\Support\Facades\Amount::formatAnything($piggy->transactionCurrency, $currentAmount, false)); $piggy->name = sprintf('%s (%s)', $piggy->name, Amount::formatAnything($piggy->transactionCurrency, $currentAmount, false));
} }
return $set; return $set;

View File

@@ -44,6 +44,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService; use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Facades\Amount;
/** /**
* Trait AccountServiceTrait * Trait AccountServiceTrait
@@ -231,7 +232,7 @@ trait AccountServiceTrait
// get or grab currency: // get or grab currency:
$currency = $this->accountRepository->getAccountCurrency($account); $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) { if (null === $currency) {
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
} }
// submit to factory: // submit to factory:
@@ -348,7 +349,7 @@ trait AccountServiceTrait
if (null === $currency) { if (null === $currency) {
// use default currency: // use default currency:
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup);
} }
$currency->enabled = true; $currency->enabled = true;
$currency->save(); $currency->save();
@@ -388,7 +389,7 @@ trait AccountServiceTrait
// if exists, update: // if exists, update:
$currency = $this->accountRepository->getAccountCurrency($account); $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) { if (null === $currency) {
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
} }
// simply grab the first journal and change it: // simply grab the first journal and change it:
@@ -454,7 +455,7 @@ trait AccountServiceTrait
// get or grab currency: // get or grab currency:
$currency = $this->accountRepository->getAccountCurrency($account); $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) { if (null === $currency) {
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
} }
// submit to factory: // submit to factory:
$submission = [ $submission = [
@@ -571,7 +572,7 @@ trait AccountServiceTrait
// if exists, update: // if exists, update:
$currency = $this->accountRepository->getAccountCurrency($account); $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) { if (null === $currency) {
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
} }
// simply grab the first journal and change it: // simply grab the first journal and change it:
@@ -652,7 +653,7 @@ trait AccountServiceTrait
// get or grab currency: // get or grab currency:
$currency = $this->accountRepository->getAccountCurrency($account); $currency = $this->accountRepository->getAccountCurrency($account);
if (null === $currency) { if (null === $currency) {
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
} }
// submit to factory: // submit to factory:

View File

@@ -42,6 +42,7 @@ use FireflyIII\Models\RecurrenceTransactionMeta;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Validation\AccountValidator; use FireflyIII\Validation\AccountValidator;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use FireflyIII\Support\Facades\Amount;
use function Safe\json_encode; use function Safe\json_encode;
@@ -107,7 +108,7 @@ trait RecurringTransactionTrait
$currency = $factory->find($array['currency_id'] ?? null, $array['currency_code'] ?? null); $currency = $factory->find($array['currency_id'] ?? null, $array['currency_code'] ?? null);
$foreignCurrency = $factory->find($array['foreign_currency_id'] ?? null, $array['foreign_currency_code'] ?? null); $foreignCurrency = $factory->find($array['foreign_currency_id'] ?? null, $array['foreign_currency_code'] ?? null);
if (null === $currency) { if (null === $currency) {
$currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($recurrence->user->userGroup); $currency = Amount::getPrimaryCurrencyByUserGroup($recurrence->user->userGroup);
} }
Log::debug( Log::debug(

View File

@@ -35,6 +35,7 @@ use FireflyIII\Repositories\ObjectGroup\CreatesObjectGroups;
use FireflyIII\Services\Internal\Support\BillServiceTrait; use FireflyIII\Services\Internal\Support\BillServiceTrait;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class BillUpdateService * Class BillUpdateService
@@ -53,7 +54,7 @@ class BillUpdateService
if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) { if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) {
$factory = app(TransactionCurrencyFactory::class); $factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null) $currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null)
?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup); ?? Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup);
// enable the currency if it isn't. // enable the currency if it isn't.
$currency->enabled = true; $currency->enabled = true;

View File

@@ -69,7 +69,7 @@ class JournalUpdateService
private ?Transaction $destinationTransaction = null; private ?Transaction $destinationTransaction = null;
private array $metaDate private array $metaDate
= ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date',
'invoice_date',]; 'invoice_date', ];
private array $metaString private array $metaString
= [ = [
'sepa_cc', 'sepa_cc',
@@ -113,7 +113,7 @@ class JournalUpdateService
public function setTransactionGroup(TransactionGroup $transactionGroup): void public function setTransactionGroup(TransactionGroup $transactionGroup): void
{ {
$this->transactionGroup = $transactionGroup; $this->transactionGroup = $transactionGroup;
$this->billRepository->setUser($transactionGroup->user); $this->billRepository->setUser($transactionGroup->user);
$this->categoryRepository->setUser($transactionGroup->user); $this->categoryRepository->setUser($transactionGroup->user);
$this->budgetRepository->setUser($transactionGroup->user); $this->budgetRepository->setUser($transactionGroup->user);
@@ -184,8 +184,8 @@ class JournalUpdateService
private function hasValidSourceAccount(): bool private function hasValidSourceAccount(): bool
{ {
$sourceId = $this->data['source_id'] ?? null; $sourceId = $this->data['source_id'] ?? null;
$sourceName = $this->data['source_name'] ?? null; $sourceName = $this->data['source_name'] ?? null;
Log::debug(sprintf('Now in hasValidSourceAccount("%s","%s").', $sourceId, $sourceName)); Log::debug(sprintf('Now in hasValidSourceAccount("%s","%s").', $sourceId, $sourceName));
if (!$this->hasFields(['source_id', 'source_name'])) { if (!$this->hasFields(['source_id', 'source_name'])) {
@@ -200,11 +200,11 @@ class JournalUpdateService
// make a new validator. // make a new validator.
/** @var AccountValidator $validator */ /** @var AccountValidator $validator */
$validator = app(AccountValidator::class); $validator = app(AccountValidator::class);
$validator->setTransactionType($expectedType); $validator->setTransactionType($expectedType);
$validator->setUser($this->transactionJournal->user); $validator->setUser($this->transactionJournal->user);
$result = $validator->validateSource(['id' => $sourceId, 'name' => $sourceName]); $result = $validator->validateSource(['id' => $sourceId, 'name' => $sourceName]);
Log::debug( Log::debug(
sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true)) sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true))
); );
@@ -217,7 +217,7 @@ class JournalUpdateService
private function hasFields(array $fields): bool private function hasFields(array $fields): bool
{ {
return array_any($fields, fn($field): bool => array_key_exists($field, $this->data)); return array_any($fields, fn ($field): bool => array_key_exists($field, $this->data));
} }
private function getOriginalSourceAccount(): Account private function getOriginalSourceAccount(): Account
@@ -262,8 +262,8 @@ class JournalUpdateService
private function hasValidDestinationAccount(): bool private function hasValidDestinationAccount(): bool
{ {
Log::debug('Now in hasValidDestinationAccount().'); Log::debug('Now in hasValidDestinationAccount().');
$destId = $this->data['destination_id'] ?? null; $destId = $this->data['destination_id'] ?? null;
$destName = $this->data['destination_name'] ?? null; $destName = $this->data['destination_name'] ?? null;
if (!$this->hasFields(['destination_id', 'destination_name'])) { if (!$this->hasFields(['destination_id', 'destination_name'])) {
Log::debug('No destination info submitted, grab the original data.'); Log::debug('No destination info submitted, grab the original data.');
@@ -273,12 +273,12 @@ class JournalUpdateService
} }
// make new account validator. // make new account validator.
$expectedType = $this->getExpectedType(); $expectedType = $this->getExpectedType();
Log::debug(sprintf('(b) Expected type (new or unchanged) is %s', $expectedType)); Log::debug(sprintf('(b) Expected type (new or unchanged) is %s', $expectedType));
// make a new validator. // make a new validator.
/** @var AccountValidator $validator */ /** @var AccountValidator $validator */
$validator = app(AccountValidator::class); $validator = app(AccountValidator::class);
$validator->setTransactionType($expectedType); $validator->setTransactionType($expectedType);
$validator->setUser($this->transactionJournal->user); $validator->setUser($this->transactionJournal->user);
$validator->source = $this->getValidSourceAccount(); $validator->source = $this->getValidSourceAccount();
@@ -333,7 +333,7 @@ class JournalUpdateService
return $this->getOriginalSourceAccount(); return $this->getOriginalSourceAccount();
} }
$sourceInfo = [ $sourceInfo = [
'id' => (int)($this->data['source_id'] ?? null), 'id' => (int)($this->data['source_id'] ?? null),
'name' => $this->data['source_name'] ?? null, 'name' => $this->data['source_name'] ?? null,
'iban' => $this->data['source_iban'] ?? null, 'iban' => $this->data['source_iban'] ?? null,
@@ -361,8 +361,8 @@ class JournalUpdateService
*/ */
private function updateAccounts(): void private function updateAccounts(): void
{ {
$source = $this->getValidSourceAccount(); $source = $this->getValidSourceAccount();
$destination = $this->getValidDestinationAccount(); $destination = $this->getValidDestinationAccount();
// cowardly refuse to update if both accounts are the same. // cowardly refuse to update if both accounts are the same.
if ($source->id === $destination->id) { if ($source->id === $destination->id) {
@@ -375,7 +375,7 @@ class JournalUpdateService
$origSourceTransaction->account()->associate($source); $origSourceTransaction->account()->associate($source);
$origSourceTransaction->save(); $origSourceTransaction->save();
$destTransaction = $this->getDestinationTransaction(); $destTransaction = $this->getDestinationTransaction();
$destTransaction->account()->associate($destination); $destTransaction->account()->associate($destination);
$destTransaction->save(); $destTransaction->save();
@@ -397,7 +397,7 @@ class JournalUpdateService
return $this->getOriginalDestinationAccount(); return $this->getOriginalDestinationAccount();
} }
$destInfo = [ $destInfo = [
'id' => (int)($this->data['destination_id'] ?? null), 'id' => (int)($this->data['destination_id'] ?? null),
'name' => $this->data['destination_name'] ?? null, 'name' => $this->data['destination_name'] ?? null,
'iban' => $this->data['destination_iban'] ?? null, 'iban' => $this->data['destination_iban'] ?? null,
@@ -426,7 +426,7 @@ class JournalUpdateService
{ {
Log::debug('Now in updateType()'); Log::debug('Now in updateType()');
if ($this->hasFields(['type'])) { if ($this->hasFields(['type'])) {
$type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type']; $type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type'];
Log::debug( Log::debug(
sprintf( sprintf(
'Trying to change journal #%d from a %s to a %s.', 'Trying to change journal #%d from a %s to a %s.',
@@ -459,9 +459,9 @@ class JournalUpdateService
{ {
$type = $this->transactionJournal->transactionType->type; $type = $this->transactionJournal->transactionType->type;
if (( if ((
array_key_exists('bill_id', $this->data) array_key_exists('bill_id', $this->data)
|| array_key_exists('bill_name', $this->data) || array_key_exists('bill_name', $this->data)
) )
&& TransactionTypeEnum::WITHDRAWAL->value === $type && TransactionTypeEnum::WITHDRAWAL->value === $type
) { ) {
$billId = (int)($this->data['bill_id'] ?? 0); $billId = (int)($this->data['bill_id'] ?? 0);
@@ -478,7 +478,7 @@ class JournalUpdateService
private function updateField(string $fieldName): void private function updateField(string $fieldName): void
{ {
if (array_key_exists($fieldName, $this->data) && '' !== (string)$this->data[$fieldName]) { if (array_key_exists($fieldName, $this->data) && '' !== (string)$this->data[$fieldName]) {
$value = $this->data[$fieldName]; $value = $this->data[$fieldName];
if ('date' === $fieldName) { if ('date' === $fieldName) {
if (!$value instanceof Carbon) { if (!$value instanceof Carbon) {
@@ -575,7 +575,7 @@ class JournalUpdateService
if ($this->hasFields([$field])) { if ($this->hasFields([$field])) {
$value = '' === $this->data[$field] ? null : $this->data[$field]; $value = '' === $this->data[$field] ? null : $this->data[$field];
Log::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value)); Log::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value));
$set = [ $set = [
'journal' => $this->transactionJournal, 'journal' => $this->transactionJournal,
'name' => $field, 'name' => $field,
'data' => $value, 'data' => $value,
@@ -594,7 +594,7 @@ class JournalUpdateService
if ($this->hasFields([$field])) { if ($this->hasFields([$field])) {
try { try {
$value = '' === (string)$this->data[$field] ? null : new Carbon($this->data[$field]); $value = '' === (string)$this->data[$field] ? null : new Carbon($this->data[$field]);
} catch (InvalidDateException | InvalidFormatException $e) { // @phpstan-ignore-line } catch (InvalidDateException|InvalidFormatException $e) { // @phpstan-ignore-line
Log::debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage())); Log::debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage()));
return; return;
@@ -623,19 +623,19 @@ class JournalUpdateService
if (!$this->hasFields(['currency_id', 'currency_code'])) { if (!$this->hasFields(['currency_id', 'currency_code'])) {
return; return;
} }
$currencyId = $this->data['currency_id'] ?? null; $currencyId = $this->data['currency_id'] ?? null;
$currencyCode = $this->data['currency_code'] ?? null; $currencyCode = $this->data['currency_code'] ?? null;
$currency = $this->currencyRepository->findCurrency($currencyId, $currencyCode); $currency = $this->currencyRepository->findCurrency($currencyId, $currencyCode);
// update currency everywhere. // update currency everywhere.
$this->transactionJournal->transaction_currency_id = $currency->id; $this->transactionJournal->transaction_currency_id = $currency->id;
$this->transactionJournal->save(); $this->transactionJournal->save();
$source = $this->getSourceTransaction(); $source = $this->getSourceTransaction();
$source->transaction_currency_id = $currency->id; $source->transaction_currency_id = $currency->id;
$source->save(); $source->save();
$dest = $this->getDestinationTransaction(); $dest = $this->getDestinationTransaction();
$dest->transaction_currency_id = $currency->id; $dest->transaction_currency_id = $currency->id;
$dest->save(); $dest->save();
// refresh transactions. // refresh transactions.
@@ -651,7 +651,7 @@ class JournalUpdateService
return; return;
} }
$value = $this->data['amount'] ?? ''; $value = $this->data['amount'] ?? '';
Log::debug(sprintf('Amount is now "%s"', $value)); Log::debug(sprintf('Amount is now "%s"', $value));
try { try {
@@ -665,17 +665,17 @@ class JournalUpdateService
$origSourceTransaction->amount = Steam::negative($amount); $origSourceTransaction->amount = Steam::negative($amount);
$origSourceTransaction->balance_dirty = true; $origSourceTransaction->balance_dirty = true;
$origSourceTransaction->save(); $origSourceTransaction->save();
$destTransaction = $this->getDestinationTransaction(); $destTransaction = $this->getDestinationTransaction();
$originalAmount = $destTransaction->amount; $originalAmount = $destTransaction->amount;
$destTransaction->amount = Steam::positive($amount); $destTransaction->amount = Steam::positive($amount);
$destTransaction->balance_dirty = true; $destTransaction->balance_dirty = true;
$destTransaction->save(); $destTransaction->save();
// refresh transactions. // refresh transactions.
$this->sourceTransaction->refresh(); $this->sourceTransaction->refresh();
$this->destinationTransaction->refresh(); $this->destinationTransaction->refresh();
Log::debug(sprintf('Updated amount to "%s"', $amount)); Log::debug(sprintf('Updated amount to "%s"', $amount));
$group = $this->transactionGroup; $group = $this->transactionGroup;
if (null === $group) { if (null === $group) {
$group = $this->transactionJournal?->transactionGroup; $group = $this->transactionJournal?->transactionGroup;
} }
@@ -686,20 +686,20 @@ class JournalUpdateService
// should not return in NULL but seems to do. // should not return in NULL but seems to do.
if (0 !== bccomp($originalAmount, $value)) { if (0 !== bccomp($originalAmount, $value)) {
event(new TriggeredAuditLog( event(new TriggeredAuditLog(
$group->user, $group->user,
$group, $group,
'update_amount', 'update_amount',
[ [
'currency_symbol' => $destTransaction->transactionCurrency->symbol, 'currency_symbol' => $destTransaction->transactionCurrency->symbol,
'decimal_places' => $destTransaction->transactionCurrency->decimal_places, 'decimal_places' => $destTransaction->transactionCurrency->decimal_places,
'amount' => $originalAmount, 'amount' => $originalAmount,
], ],
[ [
'currency_symbol' => $destTransaction->transactionCurrency->symbol, 'currency_symbol' => $destTransaction->transactionCurrency->symbol,
'decimal_places' => $destTransaction->transactionCurrency->decimal_places, 'decimal_places' => $destTransaction->transactionCurrency->decimal_places,
'amount' => $value, 'amount' => $value,
] ]
)); ));
} }
} }
@@ -738,9 +738,9 @@ class JournalUpdateService
// if the transaction is a TRANSFER, and the foreign amount and currency are set (like they seem to be) // if the transaction is a TRANSFER, and the foreign amount and currency are set (like they seem to be)
// the correct fields to update in the destination transaction are NOT the foreign amount and currency // the correct fields to update in the destination transaction are NOT the foreign amount and currency
// but rather the normal amount and currency. This is new behavior. // but rather the normal amount and currency. This is new behavior.
$isTransfer = TransactionTypeEnum::TRANSFER->value === $this->transactionJournal->transactionType->type; $isTransfer = TransactionTypeEnum::TRANSFER->value === $this->transactionJournal->transactionType->type;
// also check if it is not between an asset account and a liability, because then the same rule applies. // also check if it is not between an asset account and a liability, because then the same rule applies.
$isBetween = $this->isBetweenAssetAndLiability(); $isBetween = $this->isBetweenAssetAndLiability();
if ($isTransfer || $isBetween) { if ($isTransfer || $isBetween) {
Log::debug('Switch amounts, store in amount and not foreign_amount'); Log::debug('Switch amounts, store in amount and not foreign_amount');
@@ -776,8 +776,8 @@ class JournalUpdateService
$source->foreign_amount = null; $source->foreign_amount = null;
$source->save(); $source->save();
$dest->foreign_currency_id = null; $dest->foreign_currency_id = null;
$dest->foreign_amount = null; $dest->foreign_amount = null;
$dest->save(); $dest->save();
Log::debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount)); Log::debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount));
} }
@@ -791,7 +791,7 @@ class JournalUpdateService
private function isBetweenAssetAndLiability(): bool private function isBetweenAssetAndLiability(): bool
{ {
/** @var null|Transaction $sourceTransaction */ /** @var null|Transaction $sourceTransaction */
$sourceTransaction = $this->transactionJournal->transactions()->where('amount', '<', 0)->first(); $sourceTransaction = $this->transactionJournal->transactions()->where('amount', '<', 0)->first();
/** @var null|Transaction $destinationTransaction */ /** @var null|Transaction $destinationTransaction */
$destinationTransaction = $this->transactionJournal->transactions()->where('amount', '>', 0)->first(); $destinationTransaction = $this->transactionJournal->transactions()->where('amount', '>', 0)->first();
@@ -806,15 +806,15 @@ class JournalUpdateService
return false; return false;
} }
$source = $sourceTransaction->account; $source = $sourceTransaction->account;
$destination = $destinationTransaction->account; $destination = $destinationTransaction->account;
if (null === $source || null === $destination) { if (null === $source || null === $destination) {
Log::warning('Either is false, stop.'); Log::warning('Either is false, stop.');
return false; return false;
} }
$sourceTypes = [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]; $sourceTypes = [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value];
// source is liability, destination is asset // 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) {

View File

@@ -334,8 +334,9 @@ class Amount
public function getTransactionCurrencyById(int $currencyId): TransactionCurrency public function getTransactionCurrencyById(int $currencyId): TransactionCurrency
{ {
if(0 === $currencyId) { if (0 === $currencyId) {
Log::debug('Could never find a currency with ID zero. Throw error.'); Log::debug('Could never find a currency with ID zero. Throw error.');
throw new FireflyException('Could never find a currency with ID zero. Throw error.'); throw new FireflyException('Could never find a currency with ID zero. Throw error.');
} }
$instance = PreferencesSingleton::getInstance(); $instance = PreferencesSingleton::getInstance();

View File

@@ -31,6 +31,7 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Throwable; use Throwable;
use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class CurrencyForm * Class CurrencyForm
@@ -123,10 +124,10 @@ class CurrencyForm
$classes = $this->getHolderClasses($name); $classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value); $value = $this->fillFieldValue($name, $value);
$options['step'] = 'any'; $options['step'] = 'any';
$primaryCurrency = $options['currency'] ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $primaryCurrency = $options['currency'] ?? Amount::getPrimaryCurrency();
/** @var Collection $currencies */ /** @var Collection $currencies */
$currencies = \FireflyIII\Support\Facades\Amount::getAllCurrencies(); $currencies = Amount::getAllCurrencies();
unset($options['currency'], $options['placeholder']); unset($options['currency'], $options['placeholder']);
// perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount) // perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount)
@@ -176,10 +177,10 @@ class CurrencyForm
$classes = $this->getHolderClasses($name); $classes = $this->getHolderClasses($name);
$value = $this->fillFieldValue($name, $value); $value = $this->fillFieldValue($name, $value);
$options['step'] = 'any'; $options['step'] = 'any';
$primaryCurrency = $options['currency'] ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $primaryCurrency = $options['currency'] ?? Amount::getPrimaryCurrency();
/** @var Collection $currencies */ /** @var Collection $currencies */
$currencies = \FireflyIII\Support\Facades\Amount::getCurrencies(); $currencies = Amount::getCurrencies();
unset($options['currency'], $options['placeholder']); unset($options['currency'], $options['placeholder']);
// perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount) // perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount)
$preFilled = session('preFilled'); $preFilled = session('preFilled');

View File

@@ -67,7 +67,7 @@ trait ChartGeneration
/** @var AccountRepositoryInterface $accountRepos */ /** @var AccountRepositoryInterface $accountRepos */
$accountRepos = app(AccountRepositoryInterface::class); $accountRepos = app(AccountRepositoryInterface::class);
$primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $primary = Amount::getPrimaryCurrency();
$chartData = []; $chartData = [];
Log::debug(sprintf('Start of accountBalanceChart(list, %s, %s)', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); Log::debug(sprintf('Start of accountBalanceChart(list, %s, %s)', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));

View File

@@ -34,6 +34,7 @@ use FireflyIII\Repositories\Budget\NoBudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use FireflyIII\Support\Facades\Amount;
/** /**
* Class BudgetReportGenerator * Class BudgetReportGenerator
@@ -136,7 +137,7 @@ class BudgetReportGenerator
$this->blRepository->setUser($user); $this->blRepository->setUser($user);
$this->opsRepository->setUser($user); $this->opsRepository->setUser($user);
$this->nbRepository->setUser($user); $this->nbRepository->setUser($user);
$this->currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); $this->currency = Amount::getPrimaryCurrencyByUserGroup($user->userGroup);
} }
/** /**

View File

@@ -180,7 +180,7 @@ class General extends AbstractExtension
if ('balance' === $key) { if ('balance' === $key) {
// balance in account currency. // balance in account currency.
if (!$usePrimary) { if (!$usePrimary) {
$strings[] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $balance, false); $strings[] = Amount::formatAnything($currency, $balance, false);
} }
continue; continue;
@@ -188,14 +188,14 @@ class General extends AbstractExtension
if ('pc_balance' === $key) { if ('pc_balance' === $key) {
// balance in primary currency. // balance in primary currency.
if ($usePrimary) { if ($usePrimary) {
$strings[] = \FireflyIII\Support\Facades\Amount::formatAnything($primary, $balance, false); $strings[] = Amount::formatAnything($primary, $balance, false);
} }
continue; continue;
} }
// for multi currency accounts. // for multi currency accounts.
if ($usePrimary && $key !== $primary->code) { if ($usePrimary && $key !== $primary->code) {
$strings[] = \FireflyIII\Support\Facades\Amount::formatAnything(Amount::getTransactionCurrencyByCode($key), $balance, false); $strings[] = Amount::formatAnything(Amount::getTransactionCurrencyByCode($key), $balance, false);
} }
} }

View File

@@ -35,6 +35,7 @@ use Illuminate\Support\Facades\DB;
use Override; use Override;
use Twig\Extension\AbstractExtension; use Twig\Extension\AbstractExtension;
use Twig\TwigFunction; use Twig\TwigFunction;
use FireflyIII\Support\Facades\Amount;
use function Safe\json_decode; use function Safe\json_decode;
@@ -172,7 +173,7 @@ class TransactionGroupTwig extends AbstractExtension
if (TransactionTypeEnum::TRANSFER->value === $type) { if (TransactionTypeEnum::TRANSFER->value === $type) {
$colored = false; $colored = false;
} }
$result = \FireflyIII\Support\Facades\Amount::formatFlat($array['foreign_currency_symbol'], (int)$array['foreign_currency_decimal_places'], $amount, $colored); $result = Amount::formatFlat($array['foreign_currency_symbol'], (int)$array['foreign_currency_decimal_places'], $amount, $colored);
if (TransactionTypeEnum::TRANSFER->value === $type) { if (TransactionTypeEnum::TRANSFER->value === $type) {
return sprintf('<span class="text-info money-transfer">%s</span>', $result); return sprintf('<span class="text-info money-transfer">%s</span>', $result);
} }
@@ -199,7 +200,7 @@ class TransactionGroupTwig extends AbstractExtension
if (TransactionTypeEnum::TRANSFER->value === $type) { if (TransactionTypeEnum::TRANSFER->value === $type) {
$colored = false; $colored = false;
} }
$result = \FireflyIII\Support\Facades\Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); $result = Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored);
if (TransactionTypeEnum::TRANSFER->value === $type) { if (TransactionTypeEnum::TRANSFER->value === $type) {
return sprintf('<span class="text-info money-transfer">%s</span>', $result); return sprintf('<span class="text-info money-transfer">%s</span>', $result);
} }
@@ -230,7 +231,7 @@ class TransactionGroupTwig extends AbstractExtension
$colored = false; $colored = false;
} }
$result = \FireflyIII\Support\Facades\Amount::formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored); $result = Amount::formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored);
if (TransactionTypeEnum::TRANSFER->value === $type) { if (TransactionTypeEnum::TRANSFER->value === $type) {
return sprintf('<span class="text-info money-transfer">%s</span>', $result); return sprintf('<span class="text-info money-transfer">%s</span>', $result);
} }
@@ -257,7 +258,7 @@ class TransactionGroupTwig extends AbstractExtension
if (TransactionTypeEnum::TRANSFER->value === $type) { if (TransactionTypeEnum::TRANSFER->value === $type) {
$colored = false; $colored = false;
} }
$result = \FireflyIII\Support\Facades\Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); $result = Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored);
if (TransactionTypeEnum::TRANSFER->value === $type) { if (TransactionTypeEnum::TRANSFER->value === $type) {
return sprintf('<span class="text-info money-transfer">%s</span>', $result); return sprintf('<span class="text-info money-transfer">%s</span>', $result);
} }

View File

@@ -55,7 +55,7 @@ class SetAmount implements ActionInterface
return false; return false;
} }
$value = $this->action->getValue($journal); $value = $this->action->getValue($journal);
if (!is_numeric($value) || 0 === bccomp($value, '0')) { if (!is_numeric($value) || 0 === bccomp($value, '0')) {
Log::debug(sprintf('RuleAction SetAmount, amount "%s" is not a number or is zero, will not continue.', $value)); Log::debug(sprintf('RuleAction SetAmount, amount "%s" is not a number or is zero, will not continue.', $value));
@@ -65,10 +65,10 @@ class SetAmount implements ActionInterface
} }
/** @var TransactionJournal $object */ /** @var TransactionJournal $object */
$object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']); $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']);
$positive = Steam::positive($value); $positive = Steam::positive($value);
$negative = Steam::negative($value); $negative = Steam::negative($value);
$this->updatePositive($object, $positive); $this->updatePositive($object, $positive);
$this->updateNegative($object, $negative); $this->updateNegative($object, $negative);
@@ -77,20 +77,20 @@ class SetAmount implements ActionInterface
// event for audit log entry // event for audit log entry
if (0 !== bccomp($journal['amount'], $value)) { if (0 !== bccomp($journal['amount'], $value)) {
event(new TriggeredAuditLog( event(new TriggeredAuditLog(
$this->action->rule, $this->action->rule,
$object, $object,
'update_amount', 'update_amount',
[ [
'currency_symbol' => $object->transactionCurrency->symbol, 'currency_symbol' => $object->transactionCurrency->symbol,
'decimal_places' => $object->transactionCurrency->decimal_places, 'decimal_places' => $object->transactionCurrency->decimal_places,
'amount' => $journal['amount'], 'amount' => $journal['amount'],
], ],
[ [
'currency_symbol' => $object->transactionCurrency->symbol, 'currency_symbol' => $object->transactionCurrency->symbol,
'decimal_places' => $object->transactionCurrency->decimal_places, 'decimal_places' => $object->transactionCurrency->decimal_places,
'amount' => $value, 'amount' => $value,
] ]
)); ));
} }
return true; return true;

View File

@@ -37,6 +37,7 @@ use FireflyIII\Repositories\Account\AccountRepository;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use FireflyIII\Support\Facades\Amount;
/** /**
* Trait TransactionValidation * Trait TransactionValidation
@@ -224,7 +225,7 @@ trait TransactionValidation
/** @var AccountRepository $accountRepository */ /** @var AccountRepository $accountRepository */
$accountRepository = app(AccountRepositoryInterface::class); $accountRepository = app(AccountRepositoryInterface::class);
$primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $primaryCurrency = Amount::getPrimaryCurrency();
$sourceCurrency = $accountRepository->getAccountCurrency($source) ?? $primaryCurrency; $sourceCurrency = $accountRepository->getAccountCurrency($source) ?? $primaryCurrency;
$destinationCurrency = $accountRepository->getAccountCurrency($destination) ?? $primaryCurrency; $destinationCurrency = $accountRepository->getAccountCurrency($destination) ?? $primaryCurrency;
// if both accounts have the same currency, continue. // if both accounts have the same currency, continue.

23
composer.lock generated
View File

@@ -11181,31 +11181,32 @@
}, },
{ {
"name": "php-debugbar/php-debugbar", "name": "php-debugbar/php-debugbar",
"version": "v2.2.4", "version": "v2.2.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-debugbar/php-debugbar.git", "url": "https://github.com/php-debugbar/php-debugbar.git",
"reference": "3146d04671f51f69ffec2a4207ac3bdcf13a9f35" "reference": "c5dce08e98dd101c771e55949fd89124b216271d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/3146d04671f51f69ffec2a4207ac3bdcf13a9f35", "url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/c5dce08e98dd101c771e55949fd89124b216271d",
"reference": "3146d04671f51f69ffec2a4207ac3bdcf13a9f35", "reference": "c5dce08e98dd101c771e55949fd89124b216271d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^8", "php": "^8.1",
"psr/log": "^1|^2|^3", "psr/log": "^1|^2|^3",
"symfony/var-dumper": "^4|^5|^6|^7" "symfony/var-dumper": "^5.4|^6.4|^7.3|^8.0"
}, },
"replace": { "replace": {
"maximebf/debugbar": "self.version" "maximebf/debugbar": "self.version"
}, },
"require-dev": { "require-dev": {
"dbrekelmans/bdi": "^1", "dbrekelmans/bdi": "^1",
"phpunit/phpunit": "^8|^9", "phpunit/phpunit": "^10",
"symfony/browser-kit": "^6.0|7.0",
"symfony/panther": "^1|^2.1", "symfony/panther": "^1|^2.1",
"twig/twig": "^1.38|^2.7|^3.0" "twig/twig": "^3.11.2"
}, },
"suggest": { "suggest": {
"kriswallsmith/assetic": "The best way to manage assets", "kriswallsmith/assetic": "The best way to manage assets",
@@ -11215,7 +11216,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.1-dev" "dev-master": "2.2-dev"
} }
}, },
"autoload": { "autoload": {
@@ -11248,9 +11249,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/php-debugbar/php-debugbar/issues", "issues": "https://github.com/php-debugbar/php-debugbar/issues",
"source": "https://github.com/php-debugbar/php-debugbar/tree/v2.2.4" "source": "https://github.com/php-debugbar/php-debugbar/tree/v2.2.5"
}, },
"time": "2025-07-22T14:01:30+00:00" "time": "2025-12-21T08:50:08+00:00"
}, },
{ {
"name": "phpstan/extension-installer", "name": "phpstan/extension-installer",

View File

@@ -78,8 +78,8 @@ return [
'running_balance_column' => env('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. 'running_balance_column' => env('USE_RUNNING_BALANCE', true), // this is only the default value, is not used.
// see cer.php for exchange rates feature flag. // see cer.php for exchange rates feature flag.
], ],
'version' => 'develop/2025-12-20', 'version' => 'develop/2025-12-22',
'build_time' => 1766210708, 'build_time' => 1766374469,
'api_version' => '2.1.0', // field is no longer used. 'api_version' => '2.1.0', // field is no longer used.
'db_version' => 28, // field is no longer used. 'db_version' => 28, // field is no longer used.

182
package-lock.json generated
View File

@@ -2592,9 +2592,9 @@
} }
}, },
"node_modules/@rollup/rollup-android-arm-eabi": { "node_modules/@rollup/rollup-android-arm-eabi": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.54.0.tgz",
"integrity": "sha512-iDGS/h7D8t7tvZ1t6+WPK04KD0MwzLZrG0se1hzBjSi5fyxlsiggoJHwh18PCFNn7tG43OWb6pdZ6Y+rMlmyNQ==", "integrity": "sha512-OywsdRHrFvCdvsewAInDKCNyR3laPA2mc9bRYJ6LBp5IyvF3fvXbbNR0bSzHlZVFtn6E0xw2oZlyjg4rKCVcng==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -2606,9 +2606,9 @@
] ]
}, },
"node_modules/@rollup/rollup-android-arm64": { "node_modules/@rollup/rollup-android-arm64": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.54.0.tgz",
"integrity": "sha512-wrSAViWvZHBMMlWk6EJhvg8/rjxzyEhEdgfMMjREHEq11EtJ6IP6yfcCH57YAEca2Oe3FNCE9DSTgU70EIGmVw==", "integrity": "sha512-Skx39Uv+u7H224Af+bDgNinitlmHyQX1K/atIA32JP3JQw6hVODX5tkbi2zof/E69M1qH2UoN3Xdxgs90mmNYw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2620,9 +2620,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-arm64": { "node_modules/@rollup/rollup-darwin-arm64": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.54.0.tgz",
"integrity": "sha512-S87zZPBmRO6u1YXQLwpveZm4JfPpAa6oHBX7/ghSiGH3rz/KDgAu1rKdGutV+WUI6tKDMbaBJomhnT30Y2t4VQ==", "integrity": "sha512-k43D4qta/+6Fq+nCDhhv9yP2HdeKeP56QrUUTW7E6PhZP1US6NDqpJj4MY0jBHlJivVJD5P8NxrjuobZBJTCRw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2634,9 +2634,9 @@
] ]
}, },
"node_modules/@rollup/rollup-darwin-x64": { "node_modules/@rollup/rollup-darwin-x64": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.54.0.tgz",
"integrity": "sha512-YTbnsAaHo6VrAczISxgpTva8EkfQus0VPEVJCEaboHtZRIb6h6j0BNxRBOwnDciFTZLDPW5r+ZBmhL/+YpTZgA==", "integrity": "sha512-cOo7biqwkpawslEfox5Vs8/qj83M/aZCSSNIWpVzfU2CYHa2G3P1UN5WF01RdTHSgCkri7XOlTdtk17BezlV3A==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2648,9 +2648,9 @@
] ]
}, },
"node_modules/@rollup/rollup-freebsd-arm64": { "node_modules/@rollup/rollup-freebsd-arm64": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.54.0.tgz",
"integrity": "sha512-1T8eY2J8rKJWzaznV7zedfdhD1BqVs1iqILhmHDq/bqCUZsrMt+j8VCTHhP0vdfbHK3e1IQ7VYx3jlKqwlf+vw==", "integrity": "sha512-miSvuFkmvFbgJ1BevMa4CPCFt5MPGw094knM64W9I0giUIMMmRYcGW/JWZDriaw/k1kOBtsWh1z6nIFV1vPNtA==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2662,9 +2662,9 @@
] ]
}, },
"node_modules/@rollup/rollup-freebsd-x64": { "node_modules/@rollup/rollup-freebsd-x64": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.54.0.tgz",
"integrity": "sha512-sHTiuXyBJApxRn+VFMaw1U+Qsz4kcNlxQ742snICYPrY+DDL8/ZbaC4DVIB7vgZmp3jiDaKA0WpBdP0aqPJoBQ==", "integrity": "sha512-KGXIs55+b/ZfZsq9aR026tmr/+7tq6VG6MsnrvF4H8VhwflTIuYh+LFUlIsRdQSgrgmtM3fVATzEAj4hBQlaqQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2676,9 +2676,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm-gnueabihf": { "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.54.0.tgz",
"integrity": "sha512-dV3T9MyAf0w8zPVLVBptVlzaXxka6xg1f16VAQmjg+4KMSTWDvhimI/Y6mp8oHwNrmnmVl9XxJ/w/mO4uIQONA==", "integrity": "sha512-EHMUcDwhtdRGlXZsGSIuXSYwD5kOT9NVnx9sqzYiwAc91wfYOE1g1djOEDseZJKKqtHAHGwnGPQu3kytmfaXLQ==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -2690,9 +2690,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm-musleabihf": { "node_modules/@rollup/rollup-linux-arm-musleabihf": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.54.0.tgz",
"integrity": "sha512-wIGYC1x/hyjP+KAu9+ewDI+fi5XSNiUi9Bvg6KGAh2TsNMA3tSEs+Sh6jJ/r4BV/bx/CyWu2ue9kDnIdRyafcQ==", "integrity": "sha512-+pBrqEjaakN2ySv5RVrj/qLytYhPKEUwk+e3SFU5jTLHIcAtqh2rLrd/OkbNuHJpsBgxsD8ccJt5ga/SeG0JmA==",
"cpu": [ "cpu": [
"arm" "arm"
], ],
@@ -2704,9 +2704,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-gnu": { "node_modules/@rollup/rollup-linux-arm64-gnu": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.54.0.tgz",
"integrity": "sha512-Y+qVA0D9d0y2FRNiG9oM3Hut/DgODZbU9I8pLLPwAsU0tUKZ49cyV1tzmB/qRbSzGvY8lpgGkJuMyuhH7Ma+Vg==", "integrity": "sha512-NSqc7rE9wuUaRBsBp5ckQ5CVz5aIRKCwsoa6WMF7G01sX3/qHUw/z4pv+D+ahL1EIKy6Enpcnz1RY8pf7bjwng==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2718,9 +2718,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-arm64-musl": { "node_modules/@rollup/rollup-linux-arm64-musl": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.54.0.tgz",
"integrity": "sha512-juaC4bEgJsyFVfqhtGLz8mbopaWD+WeSOYr5E16y+1of6KQjc0BpwZLuxkClqY1i8sco+MdyoXPNiCkQou09+g==", "integrity": "sha512-gr5vDbg3Bakga5kbdpqx81m2n9IX8M6gIMlQQIXiLTNeQW6CucvuInJ91EuCJ/JYvc+rcLLsDFcfAD1K7fMofg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2732,9 +2732,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-loong64-gnu": { "node_modules/@rollup/rollup-linux-loong64-gnu": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.54.0.tgz",
"integrity": "sha512-rIEC0hZ17A42iXtHX+EPJVL/CakHo+tT7W0pbzdAGuWOt2jxDFh7A/lRhsNHBcqL4T36+UiAgwO8pbmn3dE8wA==", "integrity": "sha512-gsrtB1NA3ZYj2vq0Rzkylo9ylCtW/PhpLEivlgWe0bpgtX5+9j9EZa0wtZiCjgu6zmSeZWyI/e2YRX1URozpIw==",
"cpu": [ "cpu": [
"loong64" "loong64"
], ],
@@ -2746,9 +2746,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-ppc64-gnu": { "node_modules/@rollup/rollup-linux-ppc64-gnu": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.54.0.tgz",
"integrity": "sha512-T7l409NhUE552RcAOcmJHj3xyZ2h7vMWzcwQI0hvn5tqHh3oSoclf9WgTl+0QqffWFG8MEVZZP1/OBglKZx52Q==", "integrity": "sha512-y3qNOfTBStmFNq+t4s7Tmc9hW2ENtPg8FeUD/VShI7rKxNW7O4fFeaYbMsd3tpFlIg1Q8IapFgy7Q9i2BqeBvA==",
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
@@ -2760,9 +2760,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-riscv64-gnu": { "node_modules/@rollup/rollup-linux-riscv64-gnu": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.54.0.tgz",
"integrity": "sha512-7OK5/GhxbnrMcxIFoYfhV/TkknarkYC1hqUw1wU2xUN3TVRLNT5FmBv4KkheSG2xZ6IEbRAhTooTV2+R5Tk0lQ==", "integrity": "sha512-89sepv7h2lIVPsFma8iwmccN7Yjjtgz0Rj/Ou6fEqg3HDhpCa+Et+YSufy27i6b0Wav69Qv4WBNl3Rs6pwhebQ==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@@ -2774,9 +2774,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-riscv64-musl": { "node_modules/@rollup/rollup-linux-riscv64-musl": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.54.0.tgz",
"integrity": "sha512-GwuDBE/PsXaTa76lO5eLJTyr2k8QkPipAyOrs4V/KJufHCZBJ495VCGJol35grx9xryk4V+2zd3Ri+3v7NPh+w==", "integrity": "sha512-ZcU77ieh0M2Q8Ur7D5X7KvK+UxbXeDHwiOt/CPSBTI1fBmeDMivW0dPkdqkT4rOgDjrDDBUed9x4EgraIKoR2A==",
"cpu": [ "cpu": [
"riscv64" "riscv64"
], ],
@@ -2788,9 +2788,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-s390x-gnu": { "node_modules/@rollup/rollup-linux-s390x-gnu": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.54.0.tgz",
"integrity": "sha512-IAE1Ziyr1qNfnmiQLHBURAD+eh/zH1pIeJjeShleII7Vj8kyEm2PF77o+lf3WTHDpNJcu4IXJxNO0Zluro8bOw==", "integrity": "sha512-2AdWy5RdDF5+4YfG/YesGDDtbyJlC9LHmL6rZw6FurBJ5n4vFGupsOBGfwMRjBYH7qRQowT8D/U4LoSvVwOhSQ==",
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
@@ -2802,9 +2802,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-gnu": { "node_modules/@rollup/rollup-linux-x64-gnu": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.54.0.tgz",
"integrity": "sha512-Pg6E+oP7GvZ4XwgRJBuSXZjcqpIW3yCBhK4BcsANvb47qMvAbCjR6E+1a/U2WXz1JJxp9/4Dno3/iSJLcm5auw==", "integrity": "sha512-WGt5J8Ij/rvyqpFexxk3ffKqqbLf9AqrTBbWDk7ApGUzaIs6V+s2s84kAxklFwmMF/vBNGrVdYgbblCOFFezMQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2816,9 +2816,9 @@
] ]
}, },
"node_modules/@rollup/rollup-linux-x64-musl": { "node_modules/@rollup/rollup-linux-x64-musl": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.54.0.tgz",
"integrity": "sha512-txGtluxDKTxaMDzUduGP0wdfng24y1rygUMnmlUJ88fzCCULCLn7oE5kb2+tRB+MWq1QDZT6ObT5RrR8HFRKqg==", "integrity": "sha512-JzQmb38ATzHjxlPHuTH6tE7ojnMKM2kYNzt44LO/jJi8BpceEC8QuXYA908n8r3CNuG/B3BV8VR3Hi1rYtmPiw==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2830,9 +2830,9 @@
] ]
}, },
"node_modules/@rollup/rollup-openharmony-arm64": { "node_modules/@rollup/rollup-openharmony-arm64": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.54.0.tgz",
"integrity": "sha512-3DFiLPnTxiOQV993fMc+KO8zXHTcIjgaInrqlG8zDp1TlhYl6WgrOHuJkJQ6M8zHEcntSJsUp1XFZSY8C1DYbg==", "integrity": "sha512-huT3fd0iC7jigGh7n3q/+lfPcXxBi+om/Rs3yiFxjvSxbSB6aohDFXbWvlspaqjeOh+hx7DDHS+5Es5qRkWkZg==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2844,9 +2844,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-arm64-msvc": { "node_modules/@rollup/rollup-win32-arm64-msvc": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.54.0.tgz",
"integrity": "sha512-nggc/wPpNTgjGg75hu+Q/3i32R00Lq1B6N1DO7MCU340MRKL3WZJMjA9U4K4gzy3dkZPXm9E1Nc81FItBVGRlA==", "integrity": "sha512-c2V0W1bsKIKfbLMBu/WGBz6Yci8nJ/ZJdheE0EwB73N3MvHYKiKGs3mVilX4Gs70eGeDaMqEob25Tw2Gb9Nqyw==",
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
@@ -2858,9 +2858,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-ia32-msvc": { "node_modules/@rollup/rollup-win32-ia32-msvc": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.54.0.tgz",
"integrity": "sha512-U/54pTbdQpPLBdEzCT6NBCFAfSZMvmjr0twhnD9f4EIvlm9wy3jjQ38yQj1AGznrNO65EWQMgm/QUjuIVrYF9w==", "integrity": "sha512-woEHgqQqDCkAzrDhvDipnSirm5vxUXtSKDYTVpZG3nUdW/VVB5VdCYA2iReSj/u3yCZzXID4kuKG7OynPnB3WQ==",
"cpu": [ "cpu": [
"ia32" "ia32"
], ],
@@ -2872,9 +2872,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-x64-gnu": { "node_modules/@rollup/rollup-win32-x64-gnu": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.54.0.tgz",
"integrity": "sha512-2NqKgZSuLH9SXBBV2dWNRCZmocgSOx8OJSdpRaEcRlIfX8YrKxUT6z0F1NpvDVhOsl190UFTRh2F2WDWWCYp3A==", "integrity": "sha512-dzAc53LOuFvHwbCEOS0rPbXp6SIhAf2txMP5p6mGyOXXw5mWY8NGGbPMPrs4P1WItkfApDathBj/NzMLUZ9rtQ==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -2886,9 +2886,9 @@
] ]
}, },
"node_modules/@rollup/rollup-win32-x64-msvc": { "node_modules/@rollup/rollup-win32-x64-msvc": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.5.tgz", "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.54.0.tgz",
"integrity": "sha512-JRpZUhCfhZ4keB5v0fe02gQJy05GqboPOaxvjugW04RLSYYoB/9t2lx2u/tMs/Na/1NXfY8QYjgRljRpN+MjTQ==", "integrity": "sha512-hYT5d3YNdSh3mbCU1gwQyPgQd3T2ne0A3KG8KSBdav5TiBg6eInVmV+TeR5uHufiIgSFg0XsOWGW5/RhNcSvPg==",
"cpu": [ "cpu": [
"x64" "x64"
], ],
@@ -10036,9 +10036,9 @@
} }
}, },
"node_modules/rollup": { "node_modules/rollup": {
"version": "4.53.5", "version": "4.54.0",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.5.tgz", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.54.0.tgz",
"integrity": "sha512-iTNAbFSlRpcHeeWu73ywU/8KuU/LZmNCSxp6fjQkJBD3ivUb8tpDrXhIxEzA05HlYMEwmtaUnb3RP+YNv162OQ==", "integrity": "sha512-3nk8Y3a9Ea8szgKhinMlGMhGMw89mqule3KWczxhIzqudyHdCIOHw8WJlj/r329fACjKLEh13ZSk7oE22kyeIw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -10052,28 +10052,28 @@
"npm": ">=8.0.0" "npm": ">=8.0.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"@rollup/rollup-android-arm-eabi": "4.53.5", "@rollup/rollup-android-arm-eabi": "4.54.0",
"@rollup/rollup-android-arm64": "4.53.5", "@rollup/rollup-android-arm64": "4.54.0",
"@rollup/rollup-darwin-arm64": "4.53.5", "@rollup/rollup-darwin-arm64": "4.54.0",
"@rollup/rollup-darwin-x64": "4.53.5", "@rollup/rollup-darwin-x64": "4.54.0",
"@rollup/rollup-freebsd-arm64": "4.53.5", "@rollup/rollup-freebsd-arm64": "4.54.0",
"@rollup/rollup-freebsd-x64": "4.53.5", "@rollup/rollup-freebsd-x64": "4.54.0",
"@rollup/rollup-linux-arm-gnueabihf": "4.53.5", "@rollup/rollup-linux-arm-gnueabihf": "4.54.0",
"@rollup/rollup-linux-arm-musleabihf": "4.53.5", "@rollup/rollup-linux-arm-musleabihf": "4.54.0",
"@rollup/rollup-linux-arm64-gnu": "4.53.5", "@rollup/rollup-linux-arm64-gnu": "4.54.0",
"@rollup/rollup-linux-arm64-musl": "4.53.5", "@rollup/rollup-linux-arm64-musl": "4.54.0",
"@rollup/rollup-linux-loong64-gnu": "4.53.5", "@rollup/rollup-linux-loong64-gnu": "4.54.0",
"@rollup/rollup-linux-ppc64-gnu": "4.53.5", "@rollup/rollup-linux-ppc64-gnu": "4.54.0",
"@rollup/rollup-linux-riscv64-gnu": "4.53.5", "@rollup/rollup-linux-riscv64-gnu": "4.54.0",
"@rollup/rollup-linux-riscv64-musl": "4.53.5", "@rollup/rollup-linux-riscv64-musl": "4.54.0",
"@rollup/rollup-linux-s390x-gnu": "4.53.5", "@rollup/rollup-linux-s390x-gnu": "4.54.0",
"@rollup/rollup-linux-x64-gnu": "4.53.5", "@rollup/rollup-linux-x64-gnu": "4.54.0",
"@rollup/rollup-linux-x64-musl": "4.53.5", "@rollup/rollup-linux-x64-musl": "4.54.0",
"@rollup/rollup-openharmony-arm64": "4.53.5", "@rollup/rollup-openharmony-arm64": "4.54.0",
"@rollup/rollup-win32-arm64-msvc": "4.53.5", "@rollup/rollup-win32-arm64-msvc": "4.54.0",
"@rollup/rollup-win32-ia32-msvc": "4.53.5", "@rollup/rollup-win32-ia32-msvc": "4.54.0",
"@rollup/rollup-win32-x64-gnu": "4.53.5", "@rollup/rollup-win32-x64-gnu": "4.54.0",
"@rollup/rollup-win32-x64-msvc": "4.53.5", "@rollup/rollup-win32-x64-msvc": "4.54.0",
"fsevents": "~2.3.2" "fsevents": "~2.3.2"
} }
}, },