Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Cleanup.
James Coledbc95dd878d1
diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.phpindex a6492f7b59..73d8ec9338 100644--- a/app/controllers/AccountController.php+++ b/app/controllers/AccountController.php@@ -19,6 +19,8 @@ class AccountController extends BaseController}/**+ * @param $what+ ** @return \Illuminate\View\View*/public function create($what)diff --git a/app/controllers/BudgetController.php b/app/controllers/BudgetController.phpindex e0455fc708..c2a857fb6d 100644--- a/app/controllers/BudgetController.php+++ b/app/controllers/BudgetController.php@@ -11,6 +11,9 @@ class BudgetController extends BaseController{+ /**+ *+ */public function __construct(){View::share('title', 'Budgets');@@ -18,9 +21,10 @@ class BudgetController extends BaseController}/**- * Update the amount for a budget's limitrepetition and/or create it.- ** @param Budget $budget+ *+ * @return \Illuminate\Http\JsonResponse+ * @throws Exception*/public function amount(Budget $budget){@@ -82,6 +86,11 @@ class BudgetController extends BaseControllerreturn View::make('budgets.delete')->with('budget', $budget)->with('subTitle', 'Delete budget "' . $budget->name . '"');}+ /**+ * @param Budget $budget+ *+ * @return \Illuminate\Http\RedirectResponse+ */public function destroy(Budget $budget){/** @var \FireflyIII\Database\Budget $repos */@@ -115,7 +124,6 @@ class BudgetController extends BaseController/** @var \FireflyIII\Shared\Preferences\PreferencesInterface $preferences */$preferences = App::make('FireflyIII\Shared\Preferences\PreferencesInterface');- $date = Session::get('start');/** @var \FireflyIII\Database\Budget $repos */$repos = App::make('FireflyIII\Database\Budget');@@ -205,7 +213,6 @@ class BudgetController extends BaseController// get nothing? i dunno$limits = [$repetition->limit];// get all transaction journals for this budget and limit repetition.- $journals = [];$subTitle = $budget->name . ' in ' . $repetition->startdate->format('F Y');$journals = $repos->getTransactionJournalsInRepetition($budget, $repetition, 50);}@@ -216,7 +223,8 @@ class BudgetController extends BaseController}/**- * @return \Illuminate\Http\RedirectResponse+ * @return $this+ * @throws FireflyException*/public function store(){@@ -263,6 +271,7 @@ class BudgetController extends BaseController/*** @param Budget $budget*+ * @return $this* @throws FireflyException*/public function update(Budget $budget)diff --git a/app/controllers/CategoryController.php b/app/controllers/CategoryController.phpindex 200a2fc2c0..2093aa54e0 100644--- a/app/controllers/CategoryController.php+++ b/app/controllers/CategoryController.php@@ -90,7 +90,8 @@ class CategoryController extends BaseController}/**- * @return $this|\Illuminate\Http\RedirectResponse+ * @return $this+ * @throws FireflyException*/public function store(){@@ -137,7 +138,8 @@ class CategoryController extends BaseController/*** @param Category $category*- * @return $this|\Illuminate\Http\RedirectResponse+ * @return $this+ * @throws FireflyException*/public function update(Category $category){diff --git a/app/controllers/GoogleChartController.php b/app/controllers/GoogleChartController.phpindex 0c33eb792d..0eb2b58396 100644--- a/app/controllers/GoogleChartController.php+++ b/app/controllers/GoogleChartController.php@@ -68,6 +68,7 @@ class GoogleChartController extends BaseController/*** @param Account $account+ * @param string $view** @return \Illuminate\Http\JsonResponse*/@@ -148,6 +149,7 @@ class GoogleChartController extends BaseController/*** @param Account $account+ * @param string $view** @return \Illuminate\Http\JsonResponse*/@@ -376,6 +378,12 @@ class GoogleChartController extends BaseController}+ /**+ * @param Budget $budget+ * @param LimitRepetition $repetition+ *+ * @return \Illuminate\Http\JsonResponse+ */public function budgetLimitSpending(\Budget $budget, \LimitRepetition $repetition){$start = clone $repetition->startdate;@@ -405,6 +413,8 @@ class GoogleChartController extends BaseController}/**+ * @param $year+ ** @return \Illuminate\Http\JsonResponse*/public function budgetsReportChart($year)@@ -513,13 +523,17 @@ class GoogleChartController extends BaseController}+ /**+ * @param Piggybank $piggybank+ *+ * @return \Illuminate\Http\JsonResponse+ */public function piggyBankHistory(\Piggybank $piggybank){/** @var \Grumpydictator\Gchart\GChart $chart */$chart = App::make('gchart');$chart->addColumn('Date', 'date');$chart->addColumn('Balance', 'number');- $sum = 0;$set = \DB::table('piggybank_events')->where('piggybank_id', $piggybank->id)->groupBy('date')->get(['date', DB::Raw('SUM(`amount`) AS `sum`')]);@@ -535,6 +549,8 @@ class GoogleChartController extends BaseController/*** @param RecurringTransaction $recurring+ *+ * @return \Illuminate\Http\JsonResponse*/public function recurringOverview(RecurringTransaction $recurring){diff --git a/app/controllers/HelpController.php b/app/controllers/HelpController.phpindex 4fee5b9c3a..1424351c40 100644--- a/app/controllers/HelpController.php+++ b/app/controllers/HelpController.php@@ -1,7 +1,15 @@<?php+/**+ * Class HelpController+ */class HelpController extends BaseController{+ /**+ * @param $route+ *+ * @return \Illuminate\Http\JsonResponse+ */public function show($route){// no valid routediff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.phpindex c4e0c18640..9617608efc 100644--- a/app/controllers/HomeController.php+++ b/app/controllers/HomeController.php@@ -6,48 +6,6 @@*/class HomeController extends BaseController{- public function cleanup()- {- Auth::loginUsingId(1);- /** @var \FireflyIII\Database\TransactionJournal $repository */- $repository = App::make('FireflyIII\Database\TransactionJournal');-- /** @var \FireflyIII\Database\Account $acct */- $acct = App::make('FireflyIII\Database\Account');--- $journals = $repository->get();-- /** @var TransactionJournal $journal */- foreach ($journals as $journal) {-- if ($journal->transactionType->type == 'Withdrawal') {- echo '#' . $journal->id . ': ' . e($journal->description);- /** @var Transaction $transaction */- foreach ($journal->transactions as $transaction) {- if (floatval($transaction->amount) > 0) {- // this is the one with the beneficiary account!- if ($transaction->account->accountType->type == 'Beneficiary account') {- echo ', <span style="color:red;">should be an expense account</span>';- if (Input::get('update') == 'true') {- $newAccount = $acct->firstExpenseAccountOrCreate($transaction->account->name);- $transaction->account_id = $newAccount->id;- $transaction->save();-- echo '<span style="color:darkgreen">, updated!</span>';- }- }- }- }- echo '<br />';- }--- }-- return ' ';- }-/*** @return \Illuminate\Http\RedirectResponse*/diff --git a/app/controllers/PiggybankController.php b/app/controllers/PiggybankController.phpindex 08ba47d26a..0b4a8a61ab 100644--- a/app/controllers/PiggybankController.php+++ b/app/controllers/PiggybankController.php@@ -59,7 +59,7 @@ class PiggybankController extends BaseController}/**- * @param Piggybank $piggyBank+ * @param Piggybank $piggybank** @return $this*/@@ -86,7 +86,7 @@ class PiggybankController extends BaseController}/**- * @param Piggybank $piggyBank+ * @param Piggybank $piggybank** @return $this*/@@ -117,6 +117,9 @@ class PiggybankController extends BaseController)->with('subTitle', 'Edit piggy bank "' . e($piggybank->name) . '"')->with('subTitleIcon', 'fa-pencil');}+ /**+ * @return $this+ */public function index(){/** @var \FireflyIII\Database\Piggybank $repos */@@ -226,6 +229,11 @@ class PiggybankController extends BaseControllerreturn View::make('piggybanks.remove', compact('piggybank'));}+ /**+ * @param Piggybank $piggybank+ *+ * @return $this+ */public function show(Piggybank $piggybank){@@ -301,7 +309,8 @@ class PiggybankController extends BaseController/*** @param Piggybank $piggyBank*- * @return $this|\Illuminate\Http\RedirectResponse+ * @return $this+ * @throws FireflyException*/public function update(Piggybank $piggyBank){diff --git a/app/controllers/PreferencesController.php b/app/controllers/PreferencesController.phpindex 6e165af1c3..0d6a373843 100644--- a/app/controllers/PreferencesController.php+++ b/app/controllers/PreferencesController.php@@ -3,7 +3,6 @@/*** Class PreferencesController*- * @SuppressWarnings(PHPMD.CamelCasePropertyName)*/class PreferencesController extends BaseController{diff --git a/app/controllers/RecurringController.php b/app/controllers/RecurringController.phpindex 1e586146ab..bd3a7faed6 100644--- a/app/controllers/RecurringController.php+++ b/app/controllers/RecurringController.php@@ -5,10 +5,12 @@ use Illuminate\Support\MessageBag;/*** Class RecurringController*- * @SuppressWarnings(PHPMD.CamelCasePropertyName)*/class RecurringController extends BaseController{+ /**+ *+ */public function __construct(){@@ -126,6 +128,10 @@ class RecurringController extends BaseController);}+ /**+ * @return $this+ * @throws FireflyException+ */public function store(){$data = Input::except('_token');@@ -169,6 +175,12 @@ class RecurringController extends BaseController}+ /**+ * @param RecurringTransaction $recurringTransaction+ *+ * @return $this+ * @throws FireflyException+ */public function update(RecurringTransaction $recurringTransaction){/** @var \FireflyIII\Database\Recurring $repos */diff --git a/app/controllers/ReminderController.php b/app/controllers/ReminderController.phpindex 5a50c48f94..fe8c186e88 100644--- a/app/controllers/ReminderController.php+++ b/app/controllers/ReminderController.php@@ -8,12 +8,21 @@ use FireflyIII\Exception\FireflyException;class ReminderController extends BaseController{+ /**+ *+ */public function __construct(){View::share('title', 'Reminders');View::share('mainTitleIcon', 'fa-lightbulb-o');}+ /**+ * @param Reminder $reminder+ *+ * @return \Illuminate\Http\RedirectResponse+ * @throws FireflyException+ */public function act(Reminder $reminder){@@ -38,6 +47,11 @@ class ReminderController extends BaseController}}+ /**+ * @param Reminder $reminder+ *+ * @return \Illuminate\Http\RedirectResponse+ */public function dismiss(Reminder $reminder){$reminder->active = 0;@@ -47,6 +61,11 @@ class ReminderController extends BaseControllerreturn Redirect::route('index');}+ /**+ * @param Reminder $reminder+ *+ * @return \Illuminate\Http\RedirectResponse+ */public function notnow(Reminder $reminder){$reminder->active = 0;@@ -59,6 +78,8 @@ class ReminderController extends BaseController/*** @param Reminder $reminder+ *+ * @return \Illuminate\View\View*/public function show(Reminder $reminder){diff --git a/app/controllers/RepeatedExpenseController.php b/app/controllers/RepeatedExpenseController.phpindex 45cbfc7408..b3bdd762e0 100644--- a/app/controllers/RepeatedExpenseController.php+++ b/app/controllers/RepeatedExpenseController.php@@ -4,14 +4,23 @@ use Carbon\Carbon;use FireflyIII\Exception\FireflyException;use Illuminate\Support\MessageBag;+/**+ * Class RepeatedExpenseController+ */class RepeatedExpenseController extends BaseController{+ /**+ *+ */public function __construct(){View::share('title', 'Repeated expenses');View::share('mainTitleIcon', 'fa-rotate-left');}+ /**+ * @return $this+ */public function create(){/** @var \FireflyIII\Database\Account $acct */@@ -27,6 +36,9 @@ class RepeatedExpenseController extends BaseController);}+ /**+ * @return \Illuminate\View\View+ */public function index(){@@ -45,6 +57,11 @@ class RepeatedExpenseController extends BaseControllerreturn View::make('repeatedexpense.index', compact('expenses', 'subTitle'));}+ /**+ * @param Piggybank $piggyBank+ *+ * @return \Illuminate\View\View+ */public function show(Piggybank $piggyBank){$subTitle = $piggyBank->name;@@ -56,7 +73,7 @@ class RepeatedExpenseController extends BaseController$repetitions = $piggyBank->piggybankrepetitions()->get();$repetitions->each(function (PiggybankRepetition $repetition) use ($repository) {- $repetition = $repository->calculateParts($repetition);+ $repository->calculateParts($repetition);});@@ -64,7 +81,8 @@ class RepeatedExpenseController extends BaseController}/**- *+ * @return $this+ * @throws FireflyException*/public function store(){diff --git a/app/controllers/ReportController.php b/app/controllers/ReportController.phpindex 0bc6d0e3f8..ecc45c9649 100644--- a/app/controllers/ReportController.php+++ b/app/controllers/ReportController.php@@ -7,15 +7,19 @@ use Carbon\Carbon;class ReportController extends BaseController{-+ /**+ * @param $year+ * @param $month+ *+ * @return \Illuminate\View\View+ */public function budgets($year, $month){try {- $date = new Carbon($year . '-' . $month . '-01');+ $start = new Carbon($year . '-' . $month . '-01');} catch (Exception $e) {App::abort(500);}- $start = new Carbon($year . '-' . $month . '-01');$end = clone $start;$title = 'Reports';$subTitle = 'Budgets in ' . $start->format('F Y');@@ -145,6 +149,12 @@ class ReportController extends BaseControllerreturn View::make('reports.index', compact('years', 'months'))->with('title', 'Reports')->with('mainTitleIcon', 'fa-line-chart');}+ /**+ * @param $year+ * @param $month+ *+ * @return \Illuminate\View\View+ */public function unbalanced($year, $month){try {diff --git a/app/controllers/TransactionController.php b/app/controllers/TransactionController.phpindex a5b8bcc4cb..69333d6852 100644--- a/app/controllers/TransactionController.php+++ b/app/controllers/TransactionController.php@@ -23,7 +23,14 @@ class TransactionController extends BaseControllerView::share('mainTitleIcon', 'fa-repeat');}- // TODO this needs cleaning up and thinking over.+ /**+ *+ * TODO this needs cleaning up and thinking over.+ *+ * @param TransactionJournal $journal+ *+ * @return array|\Illuminate\Http\JsonResponse+ */public function alreadyRelated(TransactionJournal $journal){@@ -155,7 +162,11 @@ class TransactionController extends BaseControllerreturn Redirect::route('transactions.index', $return);}- // TODO this needs cleaning up and thinking over.+ /**+ * TODO this needs cleaning up and thinking over.+ *+ * @return \Illuminate\Http\JsonResponse+ */public function doRelate(){$id = intval(Input::get('id'));@@ -352,6 +363,11 @@ class TransactionController extends BaseController}+ /**+ * @param TransactionJournal $journal+ *+ * @return \Illuminate\View\View+ */public function relate(TransactionJournal $journal){$groups = $journal->transactiongroups()->get();@@ -369,7 +385,13 @@ class TransactionController extends BaseControllerreturn View::make('transactions.relate', compact('journal', 'members'));}- // TODO this needs cleaning up and thinking over.+ /**+ * TODO this needs cleaning up and thinking over.+ *+ * @param TransactionJournal $journal+ *+ * @return \Illuminate\Http\JsonResponse+ */public function relatedSearch(TransactionJournal $journal){$search = e(trim(Input::get('searchValue')));@@ -490,7 +512,14 @@ class TransactionController extends BaseController}}- // TODO this needs cleaning up and thinking over.+ /**+ * TODO this needs cleaning up and thinking over.+ *+ * @param TransactionJournal $journal+ *+ * @return \Illuminate\Http\JsonResponse+ * @throws Exception+ */public function unrelate(TransactionJournal $journal){$groups = $journal->transactiongroups()->get();