mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-11-23 09:26:29 -06:00
Cleanup.
This commit is contained in:
parent
792e8a9947
commit
dbc95dd878
@ -19,6 +19,8 @@ class AccountController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $what
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function create($what)
|
||||
|
@ -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 BaseController
|
||||
return 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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -1,7 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class HelpController
|
||||
*/
|
||||
class HelpController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @param $route
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function show($route)
|
||||
{
|
||||
// no valid route
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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 BaseController
|
||||
return 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)
|
||||
{
|
||||
|
@ -3,7 +3,6 @@
|
||||
/**
|
||||
* Class PreferencesController
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
|
||||
*/
|
||||
class PreferencesController extends BaseController
|
||||
{
|
||||
|
@ -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 */
|
||||
|
@ -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 BaseController
|
||||
return 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)
|
||||
{
|
||||
|
@ -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 BaseController
|
||||
return 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()
|
||||
{
|
||||
|
@ -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 BaseController
|
||||
return 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 {
|
||||
|
@ -23,7 +23,14 @@ class TransactionController extends BaseController
|
||||
View::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 BaseController
|
||||
return 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 BaseController
|
||||
return 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();
|
||||
|
Loading…
Reference in New Issue
Block a user