Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Small optimisations.
James Cole9be05e7e17af
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex b44db645be..a0c828a2c5 100644--- a/app/Http/Controllers/HomeController.php+++ b/app/Http/Controllers/HomeController.php@@ -1,5 +1,6 @@<?php namespace FireflyIII\Http\Controllers;+use Auth;use Carbon\Carbon;use FireflyIII\Repositories\Account\AccountRepositoryInterface;use Input;@@ -46,6 +47,16 @@ class HomeController extends Controller$accounts = $repository->getFrontpageAccounts($frontPage);$savings = $repository->getSavingsAccounts();+ // check if all books are correct.+ $sum = floatval(Auth::user()->transactions()->sum('amount'));+ if ($sum == 0) {+ Session::flash(+ 'error', 'Your transactions are unbalanced. This means a'+ . ' withdrawal, deposit or transfer was not stored properly. '+ . 'Please check your accounts and transactions for errors.'+ );+ }+foreach ($accounts as $account) {$set = $repository->getFrontpageTransactions($account, $start, $end);if (count($set) > 0) {diff --git a/app/Support/Preferences.php b/app/Support/Preferences.phpindex b12a8fef6a..0604a0b1be 100644--- a/app/Support/Preferences.php+++ b/app/Support/Preferences.php@@ -16,7 +16,7 @@ class Preferences* @param $name* @param null $default*- * @return null|\Preference+ * @return null|Preference*/public function get($name, $default = null){@@ -37,7 +37,7 @@ class Preferences* @param $name* @param $value*- * @return \Preference+ * @return Preference*/public function set($name, $value){diff --git a/app/User.php b/app/User.phpindex 659d236c1d..1631995fd7 100644--- a/app/User.php+++ b/app/User.php@@ -75,6 +75,14 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordConreturn $this->hasManyThrough('FireflyIII\Models\PiggyBank', 'FireflyIII\Models\Account');}+ /**+ * @return \Illuminate\Database\Eloquent\Relations\HasManyThrough+ */+ public function transactions()+ {+ return $this->hasManyThrough('FireflyIII\Models\Transaction', 'FireflyIII\Models\TransactionJournal');+ }+/*** @return \Illuminate\Database\Eloquent\Relations\HasMany*/