mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 19:01:39 +00:00
Fix cast error in PHP 8.0
This commit is contained in:
@@ -95,7 +95,7 @@ class IndexController extends Controller
|
|||||||
Log::debug('Start of IndexController::index()');
|
Log::debug('Start of IndexController::index()');
|
||||||
|
|
||||||
// collect some basic vars:
|
// collect some basic vars:
|
||||||
$range = app('preferences')->get('viewRange', '1M')->data;
|
$range = (string) app('preferences')->get('viewRange', '1M')->data;
|
||||||
$start = $start ?? session('start', Carbon::now()->startOfMonth());
|
$start = $start ?? session('start', Carbon::now()->startOfMonth());
|
||||||
$end = $end ?? app('navigation')->endOfPeriod($start, $range);
|
$end = $end ?? app('navigation')->endOfPeriod($start, $range);
|
||||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||||
@@ -276,6 +276,7 @@ class IndexController extends Controller
|
|||||||
// complement budget with budget limits in range, and expenses in currency X in range.
|
// complement budget with budget limits in range, and expenses in currency X in range.
|
||||||
/** @var Budget $current */
|
/** @var Budget $current */
|
||||||
foreach ($collection as $current) {
|
foreach ($collection as $current) {
|
||||||
|
Log::debug(sprintf('Working on budget #%d ("%s")', $current->id, $current->name));
|
||||||
$array = $current->toArray();
|
$array = $current->toArray();
|
||||||
$array['spent'] = [];
|
$array['spent'] = [];
|
||||||
$array['budgeted'] = [];
|
$array['budgeted'] = [];
|
||||||
@@ -284,6 +285,7 @@ class IndexController extends Controller
|
|||||||
$budgetLimits = $this->blRepository->getBudgetLimits($current, $start, $end);
|
$budgetLimits = $this->blRepository->getBudgetLimits($current, $start, $end);
|
||||||
/** @var BudgetLimit $limit */
|
/** @var BudgetLimit $limit */
|
||||||
foreach ($budgetLimits as $limit) {
|
foreach ($budgetLimits as $limit) {
|
||||||
|
Log::debug(sprintf('Working on budget limit #%d', $limit->id));
|
||||||
$currency = $limit->transactionCurrency ?? $defaultCurrency;
|
$currency = $limit->transactionCurrency ?? $defaultCurrency;
|
||||||
$array['budgeted'][] = [
|
$array['budgeted'][] = [
|
||||||
'id' => $limit->id,
|
'id' => $limit->id,
|
||||||
|
@@ -105,7 +105,7 @@ trait ModifiesPiggyBanks
|
|||||||
$leftOnAccount = $this->leftOnAccount($piggyBank, today(config('app.timezone')));
|
$leftOnAccount = $this->leftOnAccount($piggyBank, today(config('app.timezone')));
|
||||||
$savedSoFar = (string)$this->getRepetition($piggyBank)->currentamount;
|
$savedSoFar = (string)$this->getRepetition($piggyBank)->currentamount;
|
||||||
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
|
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
|
||||||
$maxAmount = (string)min(round((float) $leftOnAccount, 12), round($leftToSave, 12));
|
$maxAmount = (string)min(round((float) $leftOnAccount, 12), round((float)$leftToSave, 12));
|
||||||
$compare = bccomp($amount, $maxAmount);
|
$compare = bccomp($amount, $maxAmount);
|
||||||
$result = $compare <= 0;
|
$result = $compare <= 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user