Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Some code simplifications.
James Coleea014a6504e6
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex ad6eae5f9e..1e8156f82b 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -286,17 +286,14 @@ class ReportHelper implements ReportHelperInterface/** @var Tag $entry */foreach ($set as $entry) {// less than zero? multiply to be above zero.- $amount = $entry->amount;- $id = intval($entry->id);- if (!isset($collection[$id])) {- $collection[$id] = [- 'id' => $id,- 'tag' => $entry->tag,- 'amount' => $amount,- ];- } else {- $collection[$id]['amount'] = bcadd($collection[$id]['amount'], $amount);- }+ $amount = $entry->amount;+ $id = intval($entry->id);+ $previousAmount = $collection[$id]['amount'] ?? '0';+ $collection[$id] = [+ 'id' => $id,+ 'tag' => $entry->tag,+ 'amount' => bcadd($previousAmount, $amount),+ ];}// cleanup collection (match "fonts")diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.phpindex a8f7b9eba5..2164e22eaa 100644--- a/app/Http/Controllers/AttachmentController.php+++ b/app/Http/Controllers/AttachmentController.php@@ -128,12 +128,13 @@ class AttachmentController extends Controller*/public function preview(Attachment $attachment){+ $image = 'images/page_green.png';++if ($attachment->mime == 'application/pdf') {- $file = public_path('images/page_white_acrobat.png');- } else {- $file = public_path('images/page_green.png');+ $image = 'images/page_white_acrobat.png';}-+ $file = public_path($image);$response = Response::make(File::get($file));$response->header('Content-Type', 'image/png');diff --git a/app/Http/Controllers/Auth/ConfirmationController.php b/app/Http/Controllers/Auth/ConfirmationController.phpindex 790540bf02..d51100630b 100644--- a/app/Http/Controllers/Auth/ConfirmationController.php+++ b/app/Http/Controllers/Auth/ConfirmationController.php@@ -69,14 +69,13 @@ class ConfirmationController extends Controller$now = time();$maxDiff = config('firefly.resend_confirmation');$owner = env('SITE_OWNER', '[email protected]');+ $view = 'auth.confirmation.no-resent';if ($now - $time > $maxDiff) {-event(new ResendConfirmation(Auth::user(), $request->ip()));-- return view('auth.confirmation.resent', ['owner' => $owner]);- } else {- return view('auth.confirmation.no-resent', ['owner' => $owner]);+ $view = 'auth.confirmation.resent';}++ return view($view, ['owner' => $owner]);}}diff --git a/app/Http/Controllers/Auth/PasswordController.php b/app/Http/Controllers/Auth/PasswordController.phpindex e341c46372..dfd510f5e7 100644--- a/app/Http/Controllers/Auth/PasswordController.php+++ b/app/Http/Controllers/Auth/PasswordController.php@@ -53,11 +53,14 @@ class PasswordController extends Controller{$this->validate($request, ['email' => 'required|email']);- $user = User::whereEmail($request->get('email'))->first();+ $user = User::whereEmail($request->get('email'))->first();+ $response = 'passwords.blocked';- if (!is_null($user) && intval($user->blocked) === 1) {- $response = 'passwords.blocked';- } else {+ if (is_null($user)) {+ $response = Password::INVALID_USER;+ }++ if (!is_null($user) && intval($user->blocked) === 0) {$response = Password::sendResetLink($request->only('email'), function (Message $message) {$message->subject($this->getEmailSubject());diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.phpindex c28c54d3be..0a4570a05b 100644--- a/app/Http/Controllers/BudgetController.php+++ b/app/Http/Controllers/BudgetController.php@@ -158,6 +158,11 @@ class BudgetController extends Controller$budgeted = '0';$range = Preferences::get('viewRange', '1M')->data;$repeatFreq = Config::get('firefly.range_to_repeat_freq.' . $range);++ if (session('is_custom_range') === true) {+ $repeatFreq = 'custom';+ }+/** @var Carbon $start */$start = session('start', new Carbon);/** @var Carbon $end */