Update reference to Steam

This commit is contained in:
Sander Dorigo
2025-12-17 08:43:39 +01:00
parent e8fe9db181
commit 486e0d5ed5
48 changed files with 150 additions and 148 deletions

View File

@@ -286,7 +286,7 @@ class BudgetController extends Controller
} }
if (null !== $limit && $this->convertToPrimary) { if (null !== $limit && $this->convertToPrimary) {
// convert and add all amounts. // convert and add all amounts.
$limit->amount = app('steam')->positive($amount); $limit->amount = \FireflyIII\Support\Facades\Steam::positive($amount);
Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount)); Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount));
} }

View File

@@ -244,7 +244,7 @@ class CorrectsAmounts extends Command
return false; return false;
} }
if (-1 === $check) { if (-1 === $check) {
$item->trigger_value = app('steam')->positive($item->trigger_value); $item->trigger_value = \FireflyIII\Support\Facades\Steam::positive($item->trigger_value);
$item->save(); $item->save();
return true; return true;

View File

@@ -55,7 +55,7 @@ class CorrectsIbans extends Command
/** @var Account $account */ /** @var Account $account */
foreach ($accounts as $account) { foreach ($accounts as $account) {
$iban = (string) $account->iban; $iban = (string) $account->iban;
$newIban = app('steam')->filterSpaces($iban); $newIban = \FireflyIII\Support\Facades\Steam::filterSpaces($iban);
if ('' !== $iban && $iban !== $newIban) { if ('' !== $iban && $iban !== $newIban) {
$account->iban = $newIban; $account->iban = $newIban;
$account->save(); $account->save();
@@ -66,7 +66,7 @@ class CorrectsIbans extends Command
$accountNumber = $account->accountMeta->where('name', 'account_number')->first(); $accountNumber = $account->accountMeta->where('name', 'account_number')->first();
if (null !== $accountNumber) { if (null !== $accountNumber) {
$number = (string) $accountNumber->value; $number = (string) $accountNumber->value;
$newNumber = app('steam')->filterSpaces($number); $newNumber = \FireflyIII\Support\Facades\Steam::filterSpaces($number);
if ('' !== $number && $number !== $newNumber) { if ('' !== $number && $number !== $newNumber) {
$accountNumber->value = $newNumber; $accountNumber->value = $newNumber;
$accountNumber->save(); $accountNumber->save();

View File

@@ -112,9 +112,9 @@ class CorrectsUnevenAmount extends Command
if ($source->transaction_currency_id === $destination->transaction_currency_id) { if ($source->transaction_currency_id === $destination->transaction_currency_id) {
Log::debug('Ready to swap data between transactions.'); Log::debug('Ready to swap data between transactions.');
$destination->foreign_currency_id = $source->transaction_currency_id; $destination->foreign_currency_id = $source->transaction_currency_id;
$destination->foreign_amount = app('steam')->positive($source->amount); $destination->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount);
$destination->transaction_currency_id = $source->foreign_currency_id; $destination->transaction_currency_id = $source->foreign_currency_id;
$destination->amount = app('steam')->positive($source->foreign_amount); $destination->amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount);
$destination->balance_dirty = true; $destination->balance_dirty = true;
$source->balance_dirty = true; $source->balance_dirty = true;
$destination->save(); $destination->save();
@@ -257,8 +257,8 @@ class CorrectsUnevenAmount extends Command
// source currency = dest foreign currency // source currency = dest foreign currency
// dest amount = source foreign currency // dest amount = source foreign currency
// dest currency = source foreign currency // dest currency = source foreign currency
// Log::debug(sprintf('[a] %s', bccomp(app('steam')->positive($source->amount), app('steam')->positive($destination->foreign_amount)))); // Log::debug(sprintf('[a] %s', bccomp(\FireflyIII\Support\Facades\Steam::positive($source->amount), \FireflyIII\Support\Facades\Steam::positive($destination->foreign_amount))));
// Log::debug(sprintf('[b] %s', bccomp(app('steam')->positive($destination->amount), app('steam')->positive($source->foreign_amount)))); // Log::debug(sprintf('[b] %s', bccomp(\FireflyIII\Support\Facades\Steam::positive($destination->amount), \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount))));
// Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true))); // Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true)));
// Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true))); // Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true)));
return 0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount)) return 0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount))
@@ -428,9 +428,9 @@ class CorrectsUnevenAmount extends Command
// // only fix the destination transaction // // only fix the destination transaction
// $destination->foreign_currency_id = $source->transaction_currency_id; // $destination->foreign_currency_id = $source->transaction_currency_id;
// $destination->foreign_amount = app('steam')->positive($source->amount); // $destination->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount);
// $destination->transaction_currency_id = $source->foreign_currency_id; // $destination->transaction_currency_id = $source->foreign_currency_id;
// $destination->amount = app('steam')->positive($source->foreign_amount); // $destination->amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount);
// $destination->balance_dirty = true; // $destination->balance_dirty = true;
// $source->balance_dirty = true; // $source->balance_dirty = true;
// $destination->save(); // $destination->save();

View File

@@ -281,7 +281,7 @@ class Handler extends ExceptionHandler
protected function invalid($request, LaravelValidationException $exception): \Illuminate\Http\Response|JsonResponse|RedirectResponse protected function invalid($request, LaravelValidationException $exception): \Illuminate\Http\Response|JsonResponse|RedirectResponse
{ {
// protect against open redirect when submitting invalid forms. // protect against open redirect when submitting invalid forms.
$previous = app('steam')->getSafePreviousUrl(); $previous = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl();
$redirect = $this->getRedirectUrl($exception); $redirect = $this->getRedirectUrl($exception);
return redirect($redirect ?? $previous) return redirect($redirect ?? $previous)

View File

@@ -58,10 +58,10 @@ class TransactionFactory
$foreignAmount = null; $foreignAmount = null;
} }
if (null !== $foreignAmount) { if (null !== $foreignAmount) {
$foreignAmount = app('steam')->negative($foreignAmount); $foreignAmount = \FireflyIII\Support\Facades\Steam::negative($foreignAmount);
} }
return $this->create(app('steam')->negative($amount), $foreignAmount); return $this->create(\FireflyIII\Support\Facades\Steam::negative($amount), $foreignAmount);
} }
/** /**
@@ -170,10 +170,10 @@ class TransactionFactory
$foreignAmount = null; $foreignAmount = null;
} }
if (null !== $foreignAmount) { if (null !== $foreignAmount) {
$foreignAmount = app('steam')->positive($foreignAmount); $foreignAmount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount);
} }
return $this->create(app('steam')->positive($amount), $foreignAmount); return $this->create(\FireflyIII\Support\Facades\Steam::positive($amount), $foreignAmount);
} }
public function setAccount(Account $account): void public function setAccount(Account $account): void

View File

@@ -56,7 +56,7 @@ class ChartJsGenerator implements GeneratorInterface
$index = 0; $index = 0;
foreach ($data as $key => $valueArray) { foreach ($data as $key => $valueArray) {
// make larger than 0 // make larger than 0
$chartData['datasets'][0]['data'][] = app('steam')->positive((string) $valueArray['amount']); $chartData['datasets'][0]['data'][] = \FireflyIII\Support\Facades\Steam::positive((string) $valueArray['amount']);
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index); $chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
$chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol']; $chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol'];
$chartData['labels'][] = $key; $chartData['labels'][] = $key;
@@ -163,7 +163,7 @@ class ChartJsGenerator implements GeneratorInterface
$index = 0; $index = 0;
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
// make larger than 0 // make larger than 0
$chartData['datasets'][0]['data'][] = app('steam')->positive((string) $value); $chartData['datasets'][0]['data'][] = \FireflyIII\Support\Facades\Steam::positive((string) $value);
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index); $chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
$chartData['labels'][] = $key; $chartData['labels'][] = $key;

View File

@@ -153,13 +153,13 @@ class MonthReportGenerator implements ReportGeneratorInterface
// make sure amount is in the right "direction". // make sure amount is in the right "direction".
if ($account->id === $journal['destination_account_id']) { if ($account->id === $journal['destination_account_id']) {
$transactionAmount = app('steam')->positive($journal['amount']); $transactionAmount = \FireflyIII\Support\Facades\Steam::positive($journal['amount']);
} }
if ($currency->id === $journal['foreign_currency_id']) { if ($currency->id === $journal['foreign_currency_id']) {
$transactionAmount = $journal['foreign_amount']; $transactionAmount = $journal['foreign_amount'];
if ($account->id === $journal['destination_account_id']) { if ($account->id === $journal['destination_account_id']) {
$transactionAmount = app('steam')->positive($journal['foreign_amount']); $transactionAmount = \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']);
} }
} }
@@ -175,7 +175,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
$journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date'); $journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date');
$journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date'); $journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');
} }
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
// call is correct. // call is correct.
Log::debug(sprintf('getAuditReport end: Call finalAccountBalance with date/time "%s"', $this->end->toIso8601String())); Log::debug(sprintf('getAuditReport end: Call finalAccountBalance with date/time "%s"', $this->end->toIso8601String()));

View File

@@ -39,7 +39,7 @@ trait AmountCollection
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->where('source.amount', app('steam')->negative($amount)); $q->where('source.amount', \FireflyIII\Support\Facades\Steam::negative($amount));
} }
); );
@@ -50,7 +50,7 @@ trait AmountCollection
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->where('source.amount', '!=', app('steam')->negative($amount)); $q->where('source.amount', '!=', \FireflyIII\Support\Facades\Steam::negative($amount));
} }
); );
@@ -64,7 +64,7 @@ trait AmountCollection
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->where('destination.amount', '<=', app('steam')->positive($amount)); $q->where('destination.amount', '<=', \FireflyIII\Support\Facades\Steam::positive($amount));
} }
); );
@@ -78,7 +78,7 @@ trait AmountCollection
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->where('destination.amount', '>=', app('steam')->positive($amount)); $q->where('destination.amount', '>=', \FireflyIII\Support\Facades\Steam::positive($amount));
} }
); );
@@ -93,7 +93,7 @@ trait AmountCollection
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->whereNotNull('source.foreign_amount'); $q->whereNotNull('source.foreign_amount');
$q->where('source.foreign_amount', app('steam')->negative($amount)); $q->where('source.foreign_amount', \FireflyIII\Support\Facades\Steam::negative($amount));
} }
); );
@@ -108,7 +108,7 @@ trait AmountCollection
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->whereNull('source.foreign_amount'); $q->whereNull('source.foreign_amount');
$q->orWhere('source.foreign_amount', '!=', app('steam')->negative($amount)); $q->orWhere('source.foreign_amount', '!=', \FireflyIII\Support\Facades\Steam::negative($amount));
} }
); );
@@ -123,7 +123,7 @@ trait AmountCollection
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->whereNotNull('destination.foreign_amount'); $q->whereNotNull('destination.foreign_amount');
$q->where('destination.foreign_amount', '<=', app('steam')->positive($amount)); $q->where('destination.foreign_amount', '<=', \FireflyIII\Support\Facades\Steam::positive($amount));
} }
); );
@@ -138,7 +138,7 @@ trait AmountCollection
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->whereNotNull('destination.foreign_amount'); $q->whereNotNull('destination.foreign_amount');
$q->where('destination.foreign_amount', '>=', app('steam')->positive($amount)); $q->where('destination.foreign_amount', '>=', \FireflyIII\Support\Facades\Steam::positive($amount));
} }
); );

View File

@@ -148,9 +148,9 @@ class EditController extends Controller
'BIC' => $repository->getMetaValue($account, 'BIC'), 'BIC' => $repository->getMetaValue($account, 'BIC'),
'opening_balance_date' => substr((string) $openingBalanceDate, 0, 10), 'opening_balance_date' => substr((string) $openingBalanceDate, 0, 10),
'liability_type_id' => $account->account_type_id, 'liability_type_id' => $account->account_type_id,
'opening_balance' => app('steam')->bcround($openingBalanceAmount, $currency->decimal_places), 'opening_balance' => \FireflyIII\Support\Facades\Steam::bcround($openingBalanceAmount, $currency->decimal_places),
'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'), 'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'),
'virtual_balance' => app('steam')->bcround($virtualBalance, $currency->decimal_places), 'virtual_balance' => \FireflyIII\Support\Facades\Steam::bcround($virtualBalance, $currency->decimal_places),
'currency_id' => $currency->id, 'currency_id' => $currency->id,
'include_net_worth' => $hasOldInput ? (bool) $request->old('include_net_worth') : $includeNetWorth, 'include_net_worth' => $hasOldInput ? (bool) $request->old('include_net_worth') : $includeNetWorth,
'interest' => $repository->getMetaValue($account, 'interest'), 'interest' => $repository->getMetaValue($account, 'interest'),

View File

@@ -84,8 +84,8 @@ class EditController extends Controller
$this->rememberPreviousUrl('bills.edit.url'); $this->rememberPreviousUrl('bills.edit.url');
} }
$bill->amount_min = app('steam')->bcround($bill->amount_min, $bill->transactionCurrency->decimal_places); $bill->amount_min = \FireflyIII\Support\Facades\Steam::bcround($bill->amount_min, $bill->transactionCurrency->decimal_places);
$bill->amount_max = app('steam')->bcround($bill->amount_max, $bill->transactionCurrency->decimal_places); $bill->amount_max = \FireflyIII\Support\Facades\Steam::bcround($bill->amount_max, $bill->transactionCurrency->decimal_places);
$rules = $this->repository->getRulesForBill($bill); $rules = $this->repository->getRulesForBill($bill);
// code to handle active-checkboxes // code to handle active-checkboxes

View File

@@ -274,7 +274,7 @@ class BudgetLimitController extends Controller
$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'] = app('steam')->bcround($limit['amount'], $limit->transactionCurrency->decimal_places); $array['amount'] = \FireflyIII\Support\Facades\Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places);
$array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']); $array['left_per_day_formatted'] = app('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

@@ -104,7 +104,7 @@ class EditController extends Controller
$amount = '0'; $amount = '0';
} }
$amount = (string) $amount; $amount = (string) $amount;
$preFilled['auto_budget_amount'] = app('steam')->bcround($amount, $autoBudget->transactionCurrency->decimal_places); $preFilled['auto_budget_amount'] = \FireflyIII\Support\Facades\Steam::bcround($amount, $autoBudget->transactionCurrency->decimal_places);
} }
// put previous url in session if not redirect from store (not "return_to_edit"). // put previous url in session if not redirect from store (not "return_to_edit").

View File

@@ -203,7 +203,7 @@ class IndexController extends Controller
foreach ($budgetLimits as $limit) { foreach ($budgetLimits as $limit) {
Log::debug(sprintf('Working on budget limit #%d', $limit->id)); Log::debug(sprintf('Working on budget limit #%d', $limit->id));
$currency = $limit->transactionCurrency ?? $primaryCurrency; $currency = $limit->transactionCurrency ?? $primaryCurrency;
$amount = app('steam')->bcround($limit->amount, $currency->decimal_places); $amount = \FireflyIII\Support\Facades\Steam::bcround($limit->amount, $currency->decimal_places);
$array['budgeted'][] = [ $array['budgeted'][] = [
'id' => $limit->id, 'id' => $limit->id,
'amount' => $amount, 'amount' => $amount,

View File

@@ -113,7 +113,7 @@ class BillController extends Controller
if ($cache->has()) { if ($cache->has()) {
return response()->json($cache->get()); return response()->json($cache->get());
} }
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
/** @var GroupCollectorInterface $collector */ /** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class); $collector = app(GroupCollectorInterface::class);

View File

@@ -166,7 +166,7 @@ class BudgetController extends Controller
if ($cache->has()) { if ($cache->has()) {
return response()->json($cache->get()); return response()->json($cache->get());
} }
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
$entries = []; $entries = [];
$amount = $budgetLimit->amount ?? '0'; $amount = $budgetLimit->amount ?? '0';
$budgetCollection = new Collection()->push($budget); $budgetCollection = new Collection()->push($budget);
@@ -531,13 +531,13 @@ class BudgetController extends Controller
// get budget limit in this period for this currency. // get budget limit in this period for this currency.
$limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd); $limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd);
if ($limit instanceof BudgetLimit) { if ($limit instanceof BudgetLimit) {
$chartData[1]['entries'][$title] = app('steam')->bcround($limit->amount, $currency->decimal_places); $chartData[1]['entries'][$title] = \FireflyIII\Support\Facades\Steam::bcround($limit->amount, $currency->decimal_places);
} }
// get spent amount in this period for this currency. // get spent amount in this period for this currency.
$sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection()->push($budget), $currency); $sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection()->push($budget), $currency);
$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0'); $amount = \FireflyIII\Support\Facades\Steam::positive($sum[$currency->id]['sum'] ?? '0');
$chartData[0]['entries'][$title] = app('steam')->bcround($amount, $currency->decimal_places); $chartData[0]['entries'][$title] = \FireflyIII\Support\Facades\Steam::bcround($amount, $currency->decimal_places);
$currentStart = clone $currentEnd; $currentStart = clone $currentEnd;
$currentStart->addDay()->startOfDay(); $currentStart->addDay()->startOfDay();
@@ -574,8 +574,8 @@ class BudgetController extends Controller
$currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange); $currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange);
$title = $currentStart->isoFormat($titleFormat); $title = $currentStart->isoFormat($titleFormat);
$sum = $this->nbRepository->sumExpenses($currentStart, $currentEnd, $accounts, $currency); $sum = $this->nbRepository->sumExpenses($currentStart, $currentEnd, $accounts, $currency);
$amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0'); $amount = \FireflyIII\Support\Facades\Steam::positive($sum[$currency->id]['sum'] ?? '0');
$chartData[$title] = app('steam')->bcround($amount, $currency->decimal_places); $chartData[$title] = \FireflyIII\Support\Facades\Steam::bcround($amount, $currency->decimal_places);
$currentStart = Navigation::addPeriod($currentStart, $preferredRange, 0); $currentStart = Navigation::addPeriod($currentStart, $preferredRange, 0);
} }

View File

@@ -70,7 +70,7 @@ class PiggyBankController extends Controller
} }
$set = $repository->getEvents($piggyBank); $set = $repository->getEvents($piggyBank);
$set = $set->reverse(); $set = $set->reverse();
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
// get first event or start date of piggy bank or today // get first event or start date of piggy bank or today
$startDate = $piggyBank->start_date ?? today(config('app.timezone')); $startDate = $piggyBank->start_date ?? today(config('app.timezone'));

View File

@@ -105,7 +105,7 @@ class JavascriptController extends Controller
if ($account instanceof Account) { if ($account instanceof Account) {
$currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency; $currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency;
} }
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
$accounting = app('amount')->getJsConfig(); $accounting = app('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'));

View File

@@ -278,9 +278,9 @@ class ReconcileController extends Controller
} }
if ($inverse) { if ($inverse) {
$journal['amount'] = app('steam')->positive($journal['amount']); $journal['amount'] = \FireflyIII\Support\Facades\Steam::positive($journal['amount']);
if (null !== $journal['foreign_amount']) { if (null !== $journal['foreign_amount']) {
$journal['foreign_amount'] = app('steam')->positive($journal['foreign_amount']); $journal['foreign_amount'] = \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']);
} }
} }

View File

@@ -167,7 +167,7 @@ class RecurrenceController extends Controller
} }
$date->startOfDay(); $date->startOfDay();
$preSelected = (string) $request->get('pre_select'); $preSelected = (string) $request->get('pre_select');
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true))); Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
Log::debug(sprintf('past = true? %s', var_export('true' === (string) $request->get('past'), true))); Log::debug(sprintf('past = true? %s', var_export('true' === (string) $request->get('past'), true)));

View File

@@ -89,7 +89,7 @@ class EditController extends Controller
$preFilled = [ $preFilled = [
'name' => $piggyBank->name, 'name' => $piggyBank->name,
'transaction_currency_id' => (int) $piggyBank->transaction_currency_id, 'transaction_currency_id' => (int) $piggyBank->transaction_currency_id,
'target_amount' => app('steam')->bcround($piggyBank->target_amount, $piggyBank->transactionCurrency->decimal_places), 'target_amount' => \FireflyIII\Support\Facades\Steam::bcround($piggyBank->target_amount, $piggyBank->transactionCurrency->decimal_places),
'target_date' => $targetDate, 'target_date' => $targetDate,
'start_date' => $startDate, 'start_date' => $startDate,
'accounts' => [], 'accounts' => [],

View File

@@ -108,7 +108,7 @@ class PreferencesController extends Controller
if (!is_array($frontpageAccounts)) { if (!is_array($frontpageAccounts)) {
$frontpageAccounts = $accountIds; $frontpageAccounts = $accountIds;
} }
$language = app('steam')->getLanguage(); $language = \FireflyIII\Support\Facades\Steam::getLanguage();
$languages = config('firefly.languages'); $languages = config('firefly.languages');
$locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data;
$listPageSize = Preferences::get('listPageSize', 50)->data; $listPageSize = Preferences::get('listPageSize', 50)->data;

View File

@@ -83,7 +83,7 @@ class DeleteController extends Controller
} }
$objectType = strtolower($journal->transaction_type_type ?? $journal->transactionType->type); $objectType = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
$subTitle = (string) trans('firefly.delete_'.$objectType, ['description' => $group->title ?? $journal->description]); $subTitle = (string) trans('firefly.delete_'.$objectType, ['description' => $group->title ?? $journal->description]);
$previous = app('steam')->getSafePreviousUrl(); $previous = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl();
// put previous url in session // put previous url in session
Log::debug('Will try to remember previous URL'); Log::debug('Will try to remember previous URL');
$this->rememberPreviousUrl('transactions.delete.url'); $this->rememberPreviousUrl('transactions.delete.url');

View File

@@ -145,6 +145,6 @@ class LinkController extends Controller
$linkId = (int) $request->get('id'); $linkId = (int) $request->get('id');
$this->repository->switchLinkById($linkId); $this->repository->switchLinkById($linkId);
return redirect(app('steam')->getSafePreviousUrl()); return redirect(\FireflyIII\Support\Facades\Steam::getSafePreviousUrl());
} }
} }

View File

@@ -142,9 +142,9 @@ class MassController extends Controller
// reverse amounts // reverse amounts
foreach ($journals as $index => $journal) { foreach ($journals as $index => $journal) {
$journals[$index]['amount'] = app('steam')->bcround(app('steam')->positive($journal['amount']), $journal['currency_decimal_places']); $journals[$index]['amount'] = \FireflyIII\Support\Facades\Steam::bcround(\FireflyIII\Support\Facades\Steam::positive($journal['amount']), $journal['currency_decimal_places']);
$journals[$index]['foreign_amount'] = null === $journal['foreign_amount'] $journals[$index]['foreign_amount'] = null === $journal['foreign_amount']
? null : app('steam')->positive($journal['foreign_amount']); ? null : \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']);
} }
$this->rememberPreviousUrl('transactions.mass-edit.url'); $this->rememberPreviousUrl('transactions.mass-edit.url');

View File

@@ -42,7 +42,7 @@ class StartFireflySession extends StartSession
protected function storeCurrentUrl(Request $request, $session): void protected function storeCurrentUrl(Request $request, $session): void
{ {
$url = $request->fullUrl(); $url = $request->fullUrl();
$safeUrl = app('steam')->getSafeUrl($url, route('index')); $safeUrl = \FireflyIII\Support\Facades\Steam::getSafeUrl($url, route('index'));
if ($url !== $safeUrl) { if ($url !== $safeUrl) {
return; return;

View File

@@ -87,7 +87,7 @@ class AccountFormRequest extends FormRequest
$data['account_type_id'] = $this->convertInteger('liability_type_id'); $data['account_type_id'] = $this->convertInteger('liability_type_id');
if ('' !== $data['opening_balance']) { if ('' !== $data['opening_balance']) {
// opening balance is always positive for liabilities // opening balance is always positive for liabilities
$data['opening_balance'] = app('steam')->positive($data['opening_balance']); $data['opening_balance'] = \FireflyIII\Support\Facades\Steam::positive($data['opening_balance']);
} }
} }

View File

@@ -57,7 +57,7 @@ class NewIPAddressWarningMail extends Mailable
$this->host = ''; $this->host = '';
try { try {
$hostName = app('steam')->getHostName($this->ipAddress); $hostName = \FireflyIII\Support\Facades\Steam::getHostName($this->ipAddress);
} catch (FireflyException $e) { } catch (FireflyException $e) {
Log::error($e->getMessage()); Log::error($e->getMessage());
$hostName = $this->ipAddress; $hostName = $this->ipAddress;

View File

@@ -157,7 +157,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
]; ];
foreach ($journals as $journal) { foreach ($journals as $journal) {
$amount = app('steam')->negative($journal['amount']); $amount = \FireflyIII\Support\Facades\Steam::negative($journal['amount']);
$journalCurrencyId = (int) $journal['currency_id']; $journalCurrencyId = (int) $journal['currency_id'];
if (false === $convertToPrimary) { if (false === $convertToPrimary) {
$currencyId = $journalCurrencyId; $currencyId = $journalCurrencyId;

View File

@@ -78,7 +78,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn
$journalId = (int) $journal['transaction_journal_id']; $journalId = (int) $journal['transaction_journal_id'];
$array[$currencyId]['categories'][0]['transaction_journals'][$journalId] $array[$currencyId]['categories'][0]['transaction_journals'][$journalId]
= [ = [
'amount' => app('steam')->negative($journal['amount']), 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']),
'date' => $journal['date'], 'date' => $journal['date'],
]; ];
} }
@@ -124,7 +124,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn
$journalId = (int) $journal['transaction_journal_id']; $journalId = (int) $journal['transaction_journal_id'];
$array[$currencyId]['categories'][0]['transaction_journals'][$journalId] $array[$currencyId]['categories'][0]['transaction_journals'][$journalId]
= [ = [
'amount' => app('steam')->positive($journal['amount']), 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']),
'date' => $journal['date'], 'date' => $journal['date'],
]; ];
} }

View File

@@ -100,7 +100,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
// only a subset of the fields. // only a subset of the fields.
$journalId = (int) $journal['transaction_journal_id']; $journalId = (int) $journal['transaction_journal_id'];
$array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [
'amount' => app('steam')->negative($journal['amount']), 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']),
'date' => $journal['date'], 'date' => $journal['date'],
'source_account_id' => (string) $journal['source_account_id'], 'source_account_id' => (string) $journal['source_account_id'],
'budget_name' => $journal['budget_name'], 'budget_name' => $journal['budget_name'],
@@ -178,7 +178,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
// only a subset of the fields. // only a subset of the fields.
$journalId = (int) $journal['transaction_journal_id']; $journalId = (int) $journal['transaction_journal_id'];
$array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [
'amount' => app('steam')->positive($journal['amount']), 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']),
'date' => $journal['date'], 'date' => $journal['date'],
'source_account_id' => (string) $journal['source_account_id'], 'source_account_id' => (string) $journal['source_account_id'],
'destination_account_id' => (string) $journal['destination_account_id'], 'destination_account_id' => (string) $journal['destination_account_id'],
@@ -240,7 +240,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
// only a subset of the fields. // only a subset of the fields.
$journalId = (int) $journal['transaction_journal_id']; $journalId = (int) $journal['transaction_journal_id'];
$array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [
'amount' => app('steam')->positive($journal['amount']), 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']),
'date' => $journal['date'], 'date' => $journal['date'],
'source_account_id' => (string) $journal['source_account_id'], 'source_account_id' => (string) $journal['source_account_id'],
'category_name' => $journal['category_name'], 'category_name' => $journal['category_name'],
@@ -303,7 +303,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
// only a subset of the fields. // only a subset of the fields.
$journalId = (int) $journal['transaction_journal_id']; $journalId = (int) $journal['transaction_journal_id'];
$array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [
'amount' => app('steam')->negative($journal['amount']), 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']),
'date' => $journal['date'], 'date' => $journal['date'],
'source_account_id' => (string) $journal['source_account_id'], 'source_account_id' => (string) $journal['source_account_id'],
'category_name' => $journal['category_name'], 'category_name' => $journal['category_name'],

View File

@@ -97,7 +97,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
]; ];
$array[$currencyId]['tags'][$tagId]['transaction_journals'][$journalId] = [ $array[$currencyId]['tags'][$tagId]['transaction_journals'][$journalId] = [
'amount' => app('steam')->negative($journal['amount']), 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']),
'date' => $journal['date'], 'date' => $journal['date'],
'source_account_id' => $journal['source_account_id'], 'source_account_id' => $journal['source_account_id'],
'budget_name' => $journal['budget_name'], 'budget_name' => $journal['budget_name'],
@@ -182,7 +182,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
]; ];
$journalId = (int) $journal['transaction_journal_id']; $journalId = (int) $journal['transaction_journal_id'];
$array[$currencyId]['tags'][$tagId]['transaction_journals'][$journalId] = [ $array[$currencyId]['tags'][$tagId]['transaction_journals'][$journalId] = [
'amount' => app('steam')->positive($journal['amount']), 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']),
'date' => $journal['date'], 'date' => $journal['date'],
'source_account_id' => $journal['source_account_id'], 'source_account_id' => $journal['source_account_id'],
'budget_name' => $journal['budget_name'], 'budget_name' => $journal['budget_name'],

View File

@@ -245,9 +245,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
$transaction = $journal->transactions->first(); $transaction = $journal->transactions->first();
$currency = $transaction->transactionCurrency; $currency = $transaction->transactionCurrency;
$type = $journal->transactionType->type; $type = $journal->transactionType->type;
$amount = app('steam')->positive($transaction->amount); $amount = \FireflyIII\Support\Facades\Steam::positive($transaction->amount);
if (TransactionTypeEnum::WITHDRAWAL->value === $type) { if (TransactionTypeEnum::WITHDRAWAL->value === $type) {
return Amount::formatAnything($currency, app('steam')->negative($amount)); return Amount::formatAnything($currency, \FireflyIII\Support\Facades\Steam::negative($amount));
} }
return Amount::formatAnything($currency, $amount); return Amount::formatAnything($currency, $amount);
@@ -267,9 +267,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
$currency = $transaction->foreignCurrency; $currency = $transaction->foreignCurrency;
$type = $journal->transactionType->type; $type = $journal->transactionType->type;
$amount = app('steam')->positive($transaction->foreign_amount); $amount = \FireflyIII\Support\Facades\Steam::positive($transaction->foreign_amount);
if (TransactionTypeEnum::WITHDRAWAL->value === $type) { if (TransactionTypeEnum::WITHDRAWAL->value === $type) {
return Amount::formatAnything($currency, app('steam')->negative($amount)); return Amount::formatAnything($currency, \FireflyIII\Support\Facades\Steam::negative($amount));
} }
return Amount::formatAnything($currency, $amount); return Amount::formatAnything($currency, $amount);

View File

@@ -65,7 +65,7 @@ trait AccountServiceTrait
return null; return null;
} }
return app('steam')->filterSpaces($iban); return \FireflyIII\Support\Facades\Steam::filterSpaces($iban);
} }
/** /**
@@ -225,7 +225,7 @@ trait AccountServiceTrait
} }
// make amount positive, regardless: // make amount positive, regardless:
$amount = app('steam')->positive($amount); $amount = \FireflyIII\Support\Facades\Steam::positive($amount);
// get or grab currency: // get or grab currency:
$currency = $this->accountRepository->getAccountCurrency($account); $currency = $this->accountRepository->getAccountCurrency($account);
@@ -371,12 +371,12 @@ trait AccountServiceTrait
} }
// if direction is "debit" (I owe this debt), amount is negative. // if direction is "debit" (I owe this debt), amount is negative.
// which means the liability will have a negative balance which the user must fill. // which means the liability will have a negative balance which the user must fill.
$openingBalance = app('steam')->negative($openingBalance); $openingBalance = \FireflyIII\Support\Facades\Steam::negative($openingBalance);
// if direction is "credit" (I am owed this debt), amount is positive. // if direction is "credit" (I am owed this debt), amount is positive.
// which means the liability will have a positive balance which is drained when its paid back into any asset. // which means the liability will have a positive balance which is drained when its paid back into any asset.
if ('credit' === $direction) { if ('credit' === $direction) {
$openingBalance = app('steam')->positive($openingBalance); $openingBalance = \FireflyIII\Support\Facades\Steam::positive($openingBalance);
} }
// create if not exists: // create if not exists:
@@ -398,11 +398,11 @@ trait AccountServiceTrait
$journal->transactionCurrency()->associate($currency); $journal->transactionCurrency()->associate($currency);
// account always gains money: // account always gains money:
$accountTransaction->amount = app('steam')->positive($openingBalance); $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance);
$accountTransaction->transaction_currency_id = $currency->id; $accountTransaction->transaction_currency_id = $currency->id;
// CL account always loses money: // CL account always loses money:
$clTransaction->amount = app('steam')->negative($openingBalance); $clTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance);
$clTransaction->transaction_currency_id = $currency->id; $clTransaction->transaction_currency_id = $currency->id;
// save both // save both
$accountTransaction->save(); $accountTransaction->save();
@@ -448,7 +448,7 @@ trait AccountServiceTrait
} }
// amount must be positive for the transaction to work. // amount must be positive for the transaction to work.
$amount = app('steam')->positive($openingBalance); $amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance);
// get or grab currency: // get or grab currency:
$currency = $this->accountRepository->getAccountCurrency($account); $currency = $this->accountRepository->getAccountCurrency($account);
@@ -584,21 +584,21 @@ trait AccountServiceTrait
if (1 === bccomp('0', $openingBalance)) { if (1 === bccomp('0', $openingBalance)) {
Log::debug('Amount is negative.'); Log::debug('Amount is negative.');
// account transaction loses money: // account transaction loses money:
$accountTransaction->amount = app('steam')->negative($openingBalance); $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance);
$accountTransaction->transaction_currency_id = $currency->id; $accountTransaction->transaction_currency_id = $currency->id;
// OB account transaction gains money // OB account transaction gains money
$obTransaction->amount = app('steam')->positive($openingBalance); $obTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance);
$obTransaction->transaction_currency_id = $currency->id; $obTransaction->transaction_currency_id = $currency->id;
} }
if (-1 === bccomp('0', $openingBalance)) { if (-1 === bccomp('0', $openingBalance)) {
Log::debug('Amount is positive.'); Log::debug('Amount is positive.');
// account gains money: // account gains money:
$accountTransaction->amount = app('steam')->positive($openingBalance); $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance);
$accountTransaction->transaction_currency_id = $currency->id; $accountTransaction->transaction_currency_id = $currency->id;
// OB account loses money: // OB account loses money:
$obTransaction->amount = app('steam')->negative($openingBalance); $obTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance);
$obTransaction->transaction_currency_id = $currency->id; $obTransaction->transaction_currency_id = $currency->id;
} }
// save both // save both
@@ -646,7 +646,7 @@ trait AccountServiceTrait
} }
// make amount positive, regardless: // make amount positive, regardless:
$amount = app('steam')->positive($openingBalance); $amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance);
// get or grab currency: // get or grab currency:
$currency = $this->accountRepository->getAccountCurrency($account); $currency = $this->accountRepository->getAccountCurrency($account);

View File

@@ -159,8 +159,8 @@ class CreditRecalculateService
$this->validateOpeningBalance($account, $openingBalance); $this->validateOpeningBalance($account, $openingBalance);
} }
$startOfDebt = $this->repository->getOpeningBalanceAmount($account, false) ?? '0'; $startOfDebt = $this->repository->getOpeningBalanceAmount($account, false) ?? '0';
$leftOfDebt = app('steam')->positive($startOfDebt); $leftOfDebt = \FireflyIII\Support\Facades\Steam::positive($startOfDebt);
// Log::debug(sprintf('Start of debt is "%s", so initial left of debt is "%s"', app('steam')->bcround($startOfDebt, 2), app('steam')->bcround($leftOfDebt, 2))); // Log::debug(sprintf('Start of debt is "%s", so initial left of debt is "%s"', \FireflyIII\Support\Facades\Steam::bcround($startOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2)));
/** @var AccountMetaFactory $factory */ /** @var AccountMetaFactory $factory */
$factory = app(AccountMetaFactory::class); $factory = app(AccountMetaFactory::class);
@@ -200,17 +200,17 @@ class CreditRecalculateService
$dest = $openingBalance->transactions()->where('amount', '>', 0)->first(); $dest = $openingBalance->transactions()->where('amount', '>', 0)->first();
if ($source->account_id !== $account->id) { if ($source->account_id !== $account->id) {
Log::info(sprintf('Liability #%d has a reversed opening balance. Will fix this now.', $account->id)); Log::info(sprintf('Liability #%d has a reversed opening balance. Will fix this now.', $account->id));
Log::debug(sprintf('Source amount "%s" is now "%s"', $source->amount, app('steam')->positive($source->amount))); Log::debug(sprintf('Source amount "%s" is now "%s"', $source->amount, \FireflyIII\Support\Facades\Steam::positive($source->amount)));
Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->amount, app('steam')->negative($dest->amount))); Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->amount, \FireflyIII\Support\Facades\Steam::negative($dest->amount)));
$source->amount = app('steam')->positive($source->amount); $source->amount = \FireflyIII\Support\Facades\Steam::positive($source->amount);
$dest->amount = app('steam')->negative($source->amount); $dest->amount = \FireflyIII\Support\Facades\Steam::negative($source->amount);
if (null !== $source->foreign_amount && '' !== $source->foreign_amount) { if (null !== $source->foreign_amount && '' !== $source->foreign_amount) {
$source->foreign_amount = app('steam')->positive($source->foreign_amount); $source->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount);
Log::debug(sprintf('Source foreign amount "%s" is now "%s"', $source->foreign_amount, app('steam')->positive($source->foreign_amount))); Log::debug(sprintf('Source foreign amount "%s" is now "%s"', $source->foreign_amount, \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount)));
} }
if (null !== $dest->foreign_amount && '' !== $dest->foreign_amount) { if (null !== $dest->foreign_amount && '' !== $dest->foreign_amount) {
$dest->foreign_amount = app('steam')->negative($dest->foreign_amount); $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::negative($dest->foreign_amount);
Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->foreign_amount, app('steam')->negative($dest->foreign_amount))); Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->foreign_amount, \FireflyIII\Support\Facades\Steam::negative($dest->foreign_amount)));
} }
$source->save(); $source->save();
$dest->save(); $dest->save();
@@ -241,7 +241,7 @@ class CreditRecalculateService
$foreignCurrency = $transaction->foreignCurrency; $foreignCurrency = $transaction->foreignCurrency;
$accountCurrency = $this->repository->getAccountCurrency($account); $accountCurrency = $this->repository->getAccountCurrency($account);
$type = $journal->transactionType->type; $type = $journal->transactionType->type;
// Log::debug(sprintf('Left of debt is: %s', app('steam')->bcround($leftOfDebt, 2))); // Log::debug(sprintf('Left of debt is: %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2)));
if ('' === $direction) { if ('' === $direction) {
// Log::warning('Direction is empty, so do nothing.'); // Log::warning('Direction is empty, so do nothing.');
@@ -262,81 +262,81 @@ class CreditRecalculateService
$isCredit = 'credit' === $direction; $isCredit = 'credit' === $direction;
if ($isSameAccount && $isCredit && $this->isWithdrawalIn($usedAmount, $type)) { // case 1 if ($isSameAccount && $isCredit && $this->isWithdrawalIn($usedAmount, $type)) { // case 1
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcadd($leftOfDebt, (string) $usedAmount); return bcadd($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case 1 (withdrawal into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 1 (withdrawal into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isCredit && $this->isWithdrawalOut($usedAmount, $type)) { // case 2 if ($isSameAccount && $isCredit && $this->isWithdrawalOut($usedAmount, $type)) { // case 2
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcsub($leftOfDebt, (string) $usedAmount); return bcsub($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case 2 (withdrawal away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 2 (withdrawal away from liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isCredit && $this->isDepositOut($usedAmount, $type)) { // case 3 if ($isSameAccount && $isCredit && $this->isDepositOut($usedAmount, $type)) { // case 3
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcsub($leftOfDebt, (string) $usedAmount); return bcsub($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case 3 (deposit away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 3 (deposit away from liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isCredit && $this->isDepositIn($usedAmount, $type)) { // case 4 if ($isSameAccount && $isCredit && $this->isDepositIn($usedAmount, $type)) { // case 4
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcadd($leftOfDebt, (string) $usedAmount); return bcadd($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case 4 (deposit into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 4 (deposit into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isCredit && $this->isTransferIn($usedAmount, $type)) { // case 5 if ($isSameAccount && $isCredit && $this->isTransferIn($usedAmount, $type)) { // case 5
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcadd($leftOfDebt, (string) $usedAmount); return bcadd($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case 5 (transfer into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 5 (transfer into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isDebit && $this->isWithdrawalIn($usedAmount, $type)) { // case 6 if ($isSameAccount && $isDebit && $this->isWithdrawalIn($usedAmount, $type)) { // case 6
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcsub($leftOfDebt, (string) $usedAmount); return bcsub($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case 6 (withdrawal into debit liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 6 (withdrawal into debit liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isDebit && $this->isDepositOut($usedAmount, $type)) { // case 7 if ($isSameAccount && $isDebit && $this->isDepositOut($usedAmount, $type)) { // case 7
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcadd($leftOfDebt, (string) $usedAmount); return bcadd($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case 7 (deposit away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 7 (deposit away from liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isDebit && $this->isWithdrawalOut($usedAmount, $type)) { // case 8 if ($isSameAccount && $isDebit && $this->isWithdrawalOut($usedAmount, $type)) { // case 8
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcadd($leftOfDebt, (string) $usedAmount); return bcadd($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case 8 (withdrawal away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 8 (withdrawal away from liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isDebit && $this->isTransferIn($usedAmount, $type)) { // case 9 if ($isSameAccount && $isDebit && $this->isTransferIn($usedAmount, $type)) { // case 9
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcsub($leftOfDebt, (string) $usedAmount); return bcsub($leftOfDebt, (string) $usedAmount);
// 2024-10-05, #9225 this used to say you would owe more, but a transfer INTO a debit from wherever means you owe LESS. // 2024-10-05, #9225 this used to say you would owe more, but a transfer INTO a debit from wherever means you owe LESS.
// Log::debug(sprintf('Case 9 (transfer into debit liability, means you owe LESS): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 9 (transfer into debit liability, means you owe LESS): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
if ($isSameAccount && $isDebit && $this->isTransferOut($usedAmount, $type)) { // case 10 if ($isSameAccount && $isDebit && $this->isTransferOut($usedAmount, $type)) { // case 10
$usedAmount = app('steam')->positive($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount);
return bcadd($leftOfDebt, (string) $usedAmount); return bcadd($leftOfDebt, (string) $usedAmount);
// 2024-10-05, #9225 this used to say you would owe less, but a transfer OUT OF a debit from wherever means you owe MORE. // 2024-10-05, #9225 this used to say you would owe less, but a transfer OUT OF a debit from wherever means you owe MORE.
// Log::debug(sprintf('Case 10 (transfer out of debit liability, means you owe MORE): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case 10 (transfer out of debit liability, means you owe MORE): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
// in any other case, remove amount from left of debt. // in any other case, remove amount from left of debt.
if (in_array($type, [TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::TRANSFER->value], true)) { if (in_array($type, [TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::TRANSFER->value], true)) {
$usedAmount = app('steam')->negative($usedAmount); $usedAmount = \FireflyIII\Support\Facades\Steam::negative($usedAmount);
return bcadd($leftOfDebt, (string) $usedAmount); return bcadd($leftOfDebt, (string) $usedAmount);
// Log::debug(sprintf('Case X (all other cases): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); // Log::debug(sprintf('Case X (all other cases): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2)));
} }
Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', app('steam')->bcround($leftOfDebt, 2))); Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2)));
return $leftOfDebt; return $leftOfDebt;
} }
@@ -344,10 +344,10 @@ class CreditRecalculateService
private function getAmountToUse(Transaction $transaction, TransactionCurrency $accountCurrency, ?TransactionCurrency $foreignCurrency): string private function getAmountToUse(Transaction $transaction, TransactionCurrency $accountCurrency, ?TransactionCurrency $foreignCurrency): string
{ {
$usedAmount = $transaction->amount; $usedAmount = $transaction->amount;
// Log::debug(sprintf('Amount of transaction is %s', app('steam')->bcround($usedAmount, 2))); // Log::debug(sprintf('Amount of transaction is %s', \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2)));
if ($foreignCurrency instanceof TransactionCurrency && $foreignCurrency->id === $accountCurrency->id) { if ($foreignCurrency instanceof TransactionCurrency && $foreignCurrency->id === $accountCurrency->id) {
$usedAmount = $transaction->foreign_amount; $usedAmount = $transaction->foreign_amount;
// Log::debug(sprintf('Overruled by foreign amount. Amount of transaction is now %s', app('steam')->bcround($usedAmount, 2))); // Log::debug(sprintf('Overruled by foreign amount. Amount of transaction is now %s', \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2)));
} }
return $usedAmount; return $usedAmount;

View File

@@ -123,7 +123,7 @@ class AccountUpdateService
$account->active = $data['active']; $account->active = $data['active'];
} }
if (array_key_exists('iban', $data)) { if (array_key_exists('iban', $data)) {
$account->iban = app('steam')->filterSpaces((string) $data['iban']); $account->iban = \FireflyIII\Support\Facades\Steam::filterSpaces((string) $data['iban']);
} }
// set liability, but account must already be a liability. // set liability, but account must already be a liability.
@@ -269,7 +269,7 @@ class AccountUpdateService
// if liability, make sure the amount is positive for a credit, and negative for a debit. // if liability, make sure the amount is positive for a credit, and negative for a debit.
if ($this->isLiability($account)) { if ($this->isLiability($account)) {
$openingBalance = 'credit' === $data['liability_direction'] ? app('steam')->positive($openingBalance) : app('steam')->negative( $openingBalance = 'credit' === $data['liability_direction'] ? \FireflyIII\Support\Facades\Steam::positive($openingBalance) : \FireflyIII\Support\Facades\Steam::negative(
$openingBalance $openingBalance
); );
} }

View File

@@ -47,6 +47,7 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface
use FireflyIII\Services\Internal\Support\JournalServiceTrait; use FireflyIII\Services\Internal\Support\JournalServiceTrait;
use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Facades\Preferences; use FireflyIII\Support\Facades\Preferences;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\NullArrayObject; use FireflyIII\Support\NullArrayObject;
use FireflyIII\Validation\AccountValidator; use FireflyIII\Validation\AccountValidator;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
@@ -661,12 +662,12 @@ class JournalUpdateService
return; return;
} }
$origSourceTransaction = $this->getSourceTransaction(); $origSourceTransaction = $this->getSourceTransaction();
$origSourceTransaction->amount = app('steam')->negative($amount); $origSourceTransaction->amount = \FireflyIII\Support\Facades\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 = app('steam')->positive($amount); $destTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($amount);
$destTransaction->balance_dirty = true; $destTransaction->balance_dirty = true;
$destTransaction->save(); $destTransaction->save();
// refresh transactions. // refresh transactions.
@@ -682,6 +683,7 @@ class JournalUpdateService
return; return;
} }
// should not return in NULL but seems to do.
event(new TriggeredAuditLog( event(new TriggeredAuditLog(
$group->user, $group->user,
$group, $group,
@@ -729,7 +731,7 @@ class JournalUpdateService
// add foreign currency info to source and destination if possible. // add foreign currency info to source and destination if possible.
if (null !== $foreignCurrency && null !== $foreignAmount) { if (null !== $foreignCurrency && null !== $foreignAmount) {
$source->foreign_currency_id = $foreignCurrency->id; $source->foreign_currency_id = $foreignCurrency->id;
$source->foreign_amount = app('steam')->negative($foreignAmount); $source->foreign_amount = \FireflyIII\Support\Facades\Steam::negative($foreignAmount);
$source->save(); $source->save();
// 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)
@@ -742,13 +744,13 @@ class JournalUpdateService
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');
$dest->transaction_currency_id = $foreignCurrency->id; $dest->transaction_currency_id = $foreignCurrency->id;
$dest->amount = app('steam')->positive($foreignAmount); $dest->amount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount);
$dest->foreign_amount = app('steam')->positive($source->amount); $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount);
$dest->foreign_currency_id = $source->transaction_currency_id; $dest->foreign_currency_id = $source->transaction_currency_id;
} }
if (!$isTransfer && !$isBetween) { if (!$isTransfer && !$isBetween) {
$dest->foreign_currency_id = $foreignCurrency->id; $dest->foreign_currency_id = $foreignCurrency->id;
$dest->foreign_amount = app('steam')->positive($foreignAmount); $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount);
} }
$dest->save(); $dest->save();

View File

@@ -102,7 +102,7 @@ class FrontpageChartGenerator
$this->blRepository->setUser($user); $this->blRepository->setUser($user);
$this->opsRepository->setUser($user); $this->opsRepository->setUser($user);
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
$this->monthAndDayFormat = (string)trans('config.month_and_day_js', [], $locale); $this->monthAndDayFormat = (string)trans('config.month_and_day_js', [], $locale);
} }

View File

@@ -102,8 +102,8 @@ class WholePeriodChartGenerator
$earnedInfoKey = sprintf('earned-in-%s', $code); $earnedInfoKey = sprintf('earned-in-%s', $code);
$spentAmount = $spent[$key][$currencyId]['sum'] ?? '0'; $spentAmount = $spent[$key][$currencyId]['sum'] ?? '0';
$earnedAmount = $earned[$key][$currencyId]['sum'] ?? '0'; $earnedAmount = $earned[$key][$currencyId]['sum'] ?? '0';
$chartData[$spentInfoKey]['entries'][$label] = app('steam')->bcround($spentAmount, $currency['currency_decimal_places']); $chartData[$spentInfoKey]['entries'][$label] = \FireflyIII\Support\Facades\Steam::bcround($spentAmount, $currency['currency_decimal_places']);
$chartData[$earnedInfoKey]['entries'][$label] = app('steam')->bcround($earnedAmount, $currency['currency_decimal_places']); $chartData[$earnedInfoKey]['entries'][$label] = \FireflyIII\Support\Facades\Steam::bcround($earnedAmount, $currency['currency_decimal_places']);
} }
$current = Navigation::addPeriod($current, $step); $current = Navigation::addPeriod($current, $step);
} }

View File

@@ -150,7 +150,7 @@ class CurrencyForm
// make sure value is formatted nicely: // make sure value is formatted nicely:
if (null !== $value && '' !== $value) { if (null !== $value && '' !== $value) {
$value = app('steam')->bcround($value, $primaryCurrency->decimal_places); $value = \FireflyIII\Support\Facades\Steam::bcround($value, $primaryCurrency->decimal_places);
} }
try { try {
@@ -202,7 +202,7 @@ class CurrencyForm
// make sure value is formatted nicely: // make sure value is formatted nicely:
if (null !== $value && '' !== $value) { if (null !== $value && '' !== $value) {
$value = app('steam')->bcround($value, $primaryCurrency->decimal_places); $value = \FireflyIII\Support\Facades\Steam::bcround($value, $primaryCurrency->decimal_places);
} }
try { try {

View File

@@ -59,7 +59,7 @@ trait ChartGeneration
return $cache->get(); return $cache->get();
} }
Log::debug('Regenerate chart.account.account-balance-chart from scratch.'); Log::debug('Regenerate chart.account.account-balance-chart from scratch.');
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
/** @var GeneratorInterface $generator */ /** @var GeneratorInterface $generator */
$generator = app(GeneratorInterface::class); $generator = app(GeneratorInterface::class);

View File

@@ -53,7 +53,7 @@ trait UserNavigation
$url = (string)session($identifier); $url = (string)session($identifier);
Log::debug(sprintf('The URL is %s', $url)); Log::debug(sprintf('The URL is %s', $url));
return app('steam')->getSafeUrl($url, route('index')); return \FireflyIII\Support\Facades\Steam::getSafeUrl($url, route('index'));
} }
/** /**
@@ -137,7 +137,7 @@ trait UserNavigation
final protected function rememberPreviousUrl(string $identifier): ?string final protected function rememberPreviousUrl(string $identifier): ?string
{ {
$return = app('steam')->getSafePreviousUrl(); $return = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl();
session()->put($identifier, $return); session()->put($identifier, $return);
Log::debug(sprintf('rememberPreviousUrl: %s: "%s"', $identifier, $return)); Log::debug(sprintf('rememberPreviousUrl: %s: "%s"', $identifier, $return));

View File

@@ -404,7 +404,7 @@ class Navigation
*/ */
public function listOfPeriods(Carbon $start, Carbon $end): array public function listOfPeriods(Carbon $start, Carbon $end): array
{ {
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
// define period to increment // define period to increment
$increment = 'addDay'; $increment = 'addDay';
$format = $this->preferredCarbonFormat($start, $end); $format = $this->preferredCarbonFormat($start, $end);
@@ -536,7 +536,7 @@ class Navigation
*/ */
public function preferredCarbonLocalizedFormat(Carbon $start, Carbon $end): string public function preferredCarbonLocalizedFormat(Carbon $start, Carbon $end): string
{ {
$locale = app('steam')->getLocale(); $locale = \FireflyIII\Support\Facades\Steam::getLocale();
$diff = $start->diffInMonths($end, true); $diff = $start->diffInMonths($end, true);
if ($diff >= 1.001 && $diff < 12.001) { if ($diff >= 1.001 && $diff < 12.001) {
return (string)trans('config.month_js', [], $locale); return (string)trans('config.month_js', [], $locale);

View File

@@ -103,7 +103,7 @@ trait RecalculatesAvailableBudgetsTrait
return; return;
} }
Log::debug(sprintf('Concluded new amount for this AB must be %s', $newAmount)); Log::debug(sprintf('Concluded new amount for this AB must be %s', $newAmount));
$availableBudget->amount = app('steam')->bcround($newAmount, $availableBudget->transactionCurrency->decimal_places); $availableBudget->amount = \FireflyIII\Support\Facades\Steam::bcround($newAmount, $availableBudget->transactionCurrency->decimal_places);
$availableBudget->save(); $availableBudget->save();
} }

View File

@@ -139,7 +139,7 @@ class TransactionSummarizer
} }
} }
// $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->{$method}($amount)); // $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], \FireflyIII\Support\Facades\Steam::{$method}($amount));
// Log::debug(sprintf('Journal #%d adds amount %s %s', $journal['transaction_journal_id'], $currencyCode, $amount)); // Log::debug(sprintf('Journal #%d adds amount %s %s', $journal['transaction_journal_id'], $currencyCode, $amount));
} }
Log::debug('End of sumExpenses.', $array); Log::debug('End of sumExpenses.', $array);

View File

@@ -2287,7 +2287,7 @@ class OperatorQuerySearch implements SearchInterface
// strip comma's, make dots. // strip comma's, make dots.
Log::debug(sprintf('Original value "%s"', $value)); Log::debug(sprintf('Original value "%s"', $value));
$value = str_replace(',', '.', $value); $value = str_replace(',', '.', $value);
$amount = app('steam')->positive($value); $amount = \FireflyIII\Support\Facades\Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIs($amount); $this->collector->amountIs($amount);
@@ -2297,7 +2297,7 @@ class OperatorQuerySearch implements SearchInterface
// strip comma's, make dots. // strip comma's, make dots.
Log::debug(sprintf('Original value "%s"', $value)); Log::debug(sprintf('Original value "%s"', $value));
$value = str_replace(',', '.', $value); $value = str_replace(',', '.', $value);
$amount = app('steam')->positive($value); $amount = \FireflyIII\Support\Facades\Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountIsNot($amount); $this->collector->amountIsNot($amount);
@@ -2307,7 +2307,7 @@ class OperatorQuerySearch implements SearchInterface
// strip comma's, make dots. // strip comma's, make dots.
$value = str_replace(',', '.', $value); $value = str_replace(',', '.', $value);
$amount = app('steam')->positive($value); $amount = \FireflyIII\Support\Facades\Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountIs($amount); $this->collector->foreignAmountIs($amount);
@@ -2317,7 +2317,7 @@ class OperatorQuerySearch implements SearchInterface
// strip comma's, make dots. // strip comma's, make dots.
$value = str_replace(',', '.', $value); $value = str_replace(',', '.', $value);
$amount = app('steam')->positive($value); $amount = \FireflyIII\Support\Facades\Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountIsNot($amount); $this->collector->foreignAmountIsNot($amount);
@@ -2328,7 +2328,7 @@ class OperatorQuerySearch implements SearchInterface
// strip comma's, make dots. // strip comma's, make dots.
$value = str_replace(',', '.', $value); $value = str_replace(',', '.', $value);
$amount = app('steam')->positive($value); $amount = \FireflyIII\Support\Facades\Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountLess($amount); $this->collector->amountLess($amount);
@@ -2339,7 +2339,7 @@ class OperatorQuerySearch implements SearchInterface
// strip comma's, make dots. // strip comma's, make dots.
$value = str_replace(',', '.', $value); $value = str_replace(',', '.', $value);
$amount = app('steam')->positive($value); $amount = \FireflyIII\Support\Facades\Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountLess($amount); $this->collector->foreignAmountLess($amount);
@@ -2350,7 +2350,7 @@ class OperatorQuerySearch implements SearchInterface
Log::debug(sprintf('Now handling operator "%s"', $operator)); Log::debug(sprintf('Now handling operator "%s"', $operator));
// strip comma's, make dots. // strip comma's, make dots.
$value = str_replace(',', '.', $value); $value = str_replace(',', '.', $value);
$amount = app('steam')->positive($value); $amount = \FireflyIII\Support\Facades\Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->amountMore($amount); $this->collector->amountMore($amount);
@@ -2361,7 +2361,7 @@ class OperatorQuerySearch implements SearchInterface
Log::debug(sprintf('Now handling operator "%s"', $operator)); Log::debug(sprintf('Now handling operator "%s"', $operator));
// strip comma's, make dots. // strip comma's, make dots.
$value = str_replace(',', '.', $value); $value = str_replace(',', '.', $value);
$amount = app('steam')->positive($value); $amount = \FireflyIII\Support\Facades\Steam::positive($value);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount));
$this->collector->foreignAmountMore($amount); $this->collector->foreignAmountMore($amount);

View File

@@ -200,7 +200,7 @@ class General extends AbstractExtension
} }
return implode(', ', $strings); return implode(', ', $strings);
// return app('steam')->balance($account, $date); // return \FireflyIII\Support\Facades\Steam::balance($account, $date);
} }
); );
} }

View File

@@ -66,8 +66,8 @@ 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 = app('steam')->positive($value); $positive = \FireflyIII\Support\Facades\Steam::positive($value);
$negative = app('steam')->negative($value); $negative = \FireflyIII\Support\Facades\Steam::negative($value);
$this->updatePositive($object, $positive); $this->updatePositive($object, $positive);
$this->updateNegative($object, $negative); $this->updateNegative($object, $negative);