Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Bug fixes in strict types.
James Cole74a9edaaf7e6
diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.phpindex 0ec3e190c7..38235d2e3e 100644--- a/app/Http/Controllers/PiggyBankController.php+++ b/app/Http/Controllers/PiggyBankController.php@@ -175,7 +175,7 @@ class PiggyBankController extends Controllerforeach ($piggyBanks as $piggyBank) {$piggyBank->savedSoFar = round($piggyBank->currentRelevantRep()->currentamount, 2);$piggyBank->percentage = $piggyBank->savedSoFar != 0 ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0;- $piggyBank->leftToSave = bcsub($piggyBank->targetamount, $piggyBank->savedSoFar);+ $piggyBank->leftToSave = bcsub($piggyBank->targetamount, strval($piggyBank->savedSoFar));$piggyBank->percentage = $piggyBank->percentage > 100 ? 100 : $piggyBank->percentage;/*@@ -192,7 +192,7 @@ class PiggyBankController extends Controller'leftToSave' => $piggyBank->leftToSave,];} else {- $accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], $piggyBank->savedSoFar);+ $accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], strval($piggyBank->savedSoFar));$accounts[$account->id]['sumOfTargets'] = bcadd($accounts[$account->id]['sumOfTargets'], $piggyBank->targetamount);$accounts[$account->id]['leftToSave'] = bcadd($accounts[$account->id]['leftToSave'], $piggyBank->leftToSave);}diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.phpindex b26b5778eb..b54f628668 100644--- a/app/Http/Controllers/Transaction/MassController.php+++ b/app/Http/Controllers/Transaction/MassController.php@@ -1,4 +1,6 @@<?php+declare(strict_types = 1);+/*** MassController.php* Copyright (C) 2016 [email protected]@@ -7,11 +9,8 @@* of the MIT license. See the LICENSE file for details.*/-declare(strict_types = 1);-namespace FireflyIII\Http\Controllers\Transaction;-use Auth;use Carbon\Carbon;use ExpandedForm;diff --git a/app/Providers/CrudServiceProvider.php b/app/Providers/CrudServiceProvider.phpindex 9ea942796e..df8601eac6 100644--- a/app/Providers/CrudServiceProvider.php+++ b/app/Providers/CrudServiceProvider.php@@ -40,32 +40,43 @@ class CrudServiceProvider extends ServiceProvider*/public function register(){+ $this->registerJournal();+ $this->registerAccount();+ }++ private function registerAccount()+ {+$this->app->bind(- 'FireflyIII\Crud\Split\JournalInterface',+ 'FireflyIII\Crud\Account\AccountCrudInterface',function (Application $app, array $arguments) {if (!isset($arguments[0]) && $app->auth->check()) {- return app('FireflyIII\Crud\Split\Journal', [$app->auth->user()]);+ return app('FireflyIII\Crud\Account\AccountCrud', [$app->auth->user()]);}if (!isset($arguments[0]) && !$app->auth->check()) {throw new FireflyException('There is no user present.');}- return app('FireflyIII\Crud\Split\Journal', $arguments);+ return app('FireflyIII\Crud\Account\AccountCrud', $arguments);});+ }+ private function registerJournal()+ {$this->app->bind(- 'FireflyIII\Crud\Account\AccountCrudInterface',+ 'FireflyIII\Crud\Split\JournalInterface',function (Application $app, array $arguments) {if (!isset($arguments[0]) && $app->auth->check()) {- return app('FireflyIII\Crud\Account\AccountCrud', [$app->auth->user()]);+ return app('FireflyIII\Crud\Split\Journal', [$app->auth->user()]);}if (!isset($arguments[0]) && !$app->auth->check()) {throw new FireflyException('There is no user present.');}- return app('FireflyIII\Crud\Account\AccountCrud', $arguments);+ return app('FireflyIII\Crud\Split\Journal', $arguments);});+}}diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.phpindex 2462f3f0e1..19363a9a81 100644--- a/app/Repositories/Account/AccountRepository.php+++ b/app/Repositories/Account/AccountRepository.php@@ -407,7 +407,7 @@ class AccountRepository implements AccountRepositoryInterface$balance = Steam::balanceIgnoreVirtual($account, $date);/** @var PiggyBank $p */foreach ($account->piggybanks()->get() as $p) {- $balance -= $p->currentRelevantRep()->currentamount;+ $balance = bcsub($balance, $p->currentRelevantRep()->currentamount);}return $balance;