mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 20:38:57 +00:00
There's a giant mix brewing between "old" code, bad code and not implemented exceptions. I suspect the next change will be to cut out all old stuff, throw a lot of NotImplementedExceptions and get going.
This commit is contained in:
@@ -32,21 +32,21 @@ class AccountController extends BaseController
|
||||
break;
|
||||
case 'asset':
|
||||
$subTitleIcon = 'fa-money';
|
||||
$subTitle = 'Asset accounts';
|
||||
$subTitle = 'Asset accounts';
|
||||
break;
|
||||
case 'expense':
|
||||
$subTitleIcon = 'fa-shopping-cart';
|
||||
$subTitle = 'Expense accounts';
|
||||
$subTitle = 'Expense accounts';
|
||||
break;
|
||||
case 'revenue':
|
||||
$subTitleIcon = 'fa-download';
|
||||
$subTitle = 'Revenue accounts';
|
||||
$subTitle = 'Revenue accounts';
|
||||
break;
|
||||
}
|
||||
return View::make('accounts.index')
|
||||
->with('what', $what)
|
||||
->with(compact('subTitleIcon'))
|
||||
->with(compact('subTitle'));
|
||||
->with('what', $what)
|
||||
->with(compact('subTitleIcon'))
|
||||
->with(compact('subTitle'));
|
||||
}
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ class AccountController extends BaseController
|
||||
}
|
||||
|
||||
return View::make('accounts.create')
|
||||
->with('subTitle', 'Create a new ' . $what . ' account')
|
||||
->with('what', $what)
|
||||
->with(compact('subTitleIcon'));
|
||||
->with('subTitle', 'Create a new ' . $what . ' account')
|
||||
->with('what', $what)
|
||||
->with(compact('subTitleIcon'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,13 +194,10 @@ class AccountController extends BaseController
|
||||
}
|
||||
|
||||
return View::make('accounts.edit')
|
||||
->with('account', $account)
|
||||
->with('openingBalance', $openingBalance)
|
||||
->with(compact('subTitleIcon'))
|
||||
->with('subTitle', 'Edit ' . strtolower(
|
||||
$account->accountType->type
|
||||
) . ' "' . $account->name . '"'
|
||||
);
|
||||
->with('account', $account)
|
||||
->with('openingBalance', $openingBalance)
|
||||
->with(compact('subTitleIcon'))
|
||||
->with('subTitle', 'Edit ' . strtolower($account->accountType->type) . ' "' . $account->name . '"');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -227,9 +224,9 @@ class AccountController extends BaseController
|
||||
|
||||
//$data = $this->_accounts->show($account, 40);
|
||||
return View::make('accounts.show')
|
||||
->with('account', $account)
|
||||
->with('subTitle', 'Details for ' . strtolower($account->accountType->type) . ' "' . $account->name . '"')
|
||||
->with(compact('subTitleIcon'));
|
||||
->with('account', $account)
|
||||
->with('subTitle', 'Details for ' . strtolower($account->accountType->type) . ' "' . $account->name . '"')
|
||||
->with(compact('subTitleIcon'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,7 +324,7 @@ class AccountController extends BaseController
|
||||
if ($data['post_submit_action'] == 'create_another') {
|
||||
return Redirect::route('accounts.edit', $account->id);
|
||||
} else {
|
||||
return Redirect::route('accounts.index',$data['what']);
|
||||
return Redirect::route('accounts.index', $data['what']);
|
||||
}
|
||||
case 'validate_only':
|
||||
$messageBags = $acct->validate($data);
|
||||
|
||||
@@ -22,8 +22,8 @@ class BudgetController extends BaseController
|
||||
*/
|
||||
public function postUpdateIncome()
|
||||
{
|
||||
/** @var \Firefly\Helper\Preferences\PreferencesHelperInterface $preferences */
|
||||
$preferences = App::make('Firefly\Helper\Preferences\PreferencesHelperInterface');
|
||||
/** @var \FireflyIII\Shared\Preferences\PreferencesInterface $preferences */
|
||||
$preferences = App::make('FireflyIII\Shared\Preferences\PreferencesInterface');
|
||||
$date = Session::get('start');
|
||||
|
||||
$value = intval(Input::get('amount'));
|
||||
@@ -72,11 +72,14 @@ class BudgetController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
/** @var \Firefly\Helper\Preferences\PreferencesHelperInterface $preferences */
|
||||
$preferences = App::make('Firefly\Helper\Preferences\PreferencesHelperInterface');
|
||||
/** @var \FireflyIII\Shared\Preferences\PreferencesInterface $preferences */
|
||||
$preferences = App::make('FireflyIII\Shared\Preferences\PreferencesInterface');
|
||||
$date = Session::get('start');
|
||||
|
||||
/** @var \FireflyIII\Database\Budget $repos */
|
||||
@@ -133,8 +136,8 @@ class BudgetController extends BaseController
|
||||
public function updateIncome()
|
||||
{
|
||||
$date = Session::get('start');
|
||||
/** @var \Firefly\Helper\Preferences\PreferencesHelperInterface $preferences */
|
||||
$preferences = App::make('Firefly\Helper\Preferences\PreferencesHelperInterface');
|
||||
/** @var \FireflyIII\Shared\Preferences\PreferencesInterface $preferences */
|
||||
$preferences = App::make('FireflyIII\Shared\Preferences\PreferencesInterface');
|
||||
$budgetAmount = $preferences->get('budgetIncomeTotal' . $date->format('FY'), 1000);
|
||||
return View::make('budgets.income')->with('amount', $budgetAmount)->with('date', $date);
|
||||
}
|
||||
|
||||
@@ -171,6 +171,51 @@ class GoogleTableController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
public function recurringList()
|
||||
{
|
||||
/** @var \Grumpydictator\Gchart\GChart $chart */
|
||||
$chart = App::make('gchart');
|
||||
$chart->addColumn('ID', 'number');
|
||||
$chart->addColumn('ID_Edit', 'string');
|
||||
$chart->addColumn('ID_Delete', 'string');
|
||||
$chart->addColumn('Name_URL', 'string');
|
||||
$chart->addColumn('Name', 'string');
|
||||
|
||||
/** @var \FireflyIII\Database\RecurringTransaction $repository */
|
||||
$repository = App::make('FireflyIII\Database\RecurringTransaction');
|
||||
|
||||
$set = $repository->get();
|
||||
|
||||
/** @var \RecurringTransaction $entry */
|
||||
foreach ($set as $entry) {
|
||||
$row = [
|
||||
$entry->id,
|
||||
route('recurring.edit', $entry->id),
|
||||
route('recurring.delete', $entry->id),
|
||||
route('recurring.show', $entry->id),
|
||||
$entry->name
|
||||
];
|
||||
$chart->addRowArray($row);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* <th>name</th>
|
||||
<th>match</th>
|
||||
<th>amount_min</th>
|
||||
<th>amount_max</th>
|
||||
<th>date</th>
|
||||
<th>active</th>
|
||||
<th>automatch</th>
|
||||
<th>repeat_freq</th>
|
||||
<th>id</th>
|
||||
|
||||
*/
|
||||
$chart->generate();
|
||||
return Response::json($chart->getData());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Account $account
|
||||
*/
|
||||
|
||||
@@ -9,40 +9,44 @@ use FireflyIII\Shared\Preferences\PreferencesInterface as Prefs;
|
||||
class HomeController extends BaseController
|
||||
{
|
||||
protected $_preferences;
|
||||
protected $_journal;
|
||||
|
||||
/**
|
||||
* @param PHI $preferences
|
||||
* @param Prefs $preferences
|
||||
*/
|
||||
public function __construct(Prefs $preferences)
|
||||
{
|
||||
$this->_preferences = $preferences;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function sessionPrev()
|
||||
{
|
||||
/** @var \Firefly\Helper\Toolkit\ToolkitInterface $toolkit */
|
||||
$toolkit = App::make('Firefly\Helper\Toolkit\ToolkitInterface');
|
||||
$toolkit->prev();
|
||||
/** @var \FireflyIII\Shared\Toolkit\Navigation $navigation */
|
||||
$navigation = App::make('FireflyIII\Shared\Toolkit\Navigation');
|
||||
$navigation->prev();
|
||||
return Redirect::back();
|
||||
//return Redirect::route('index');
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
/**
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function sessionNext()
|
||||
{
|
||||
/** @var \Firefly\Helper\Toolkit\ToolkitInterface $toolkit */
|
||||
$toolkit = App::make('Firefly\Helper\Toolkit\ToolkitInterface');
|
||||
$toolkit->next();
|
||||
/** @var \FireflyIII\Shared\Toolkit\Navigation $navigation */
|
||||
$navigation = App::make('FireflyIII\Shared\Toolkit\Navigation');
|
||||
$navigation->next();
|
||||
return Redirect::back();
|
||||
//return Redirect::route('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $range
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function rangeJump($range)
|
||||
{
|
||||
|
||||
|
||||
@@ -1,31 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Firefly\Storage\User\UserRepositoryInterface as URI;
|
||||
|
||||
/**
|
||||
* Class ProfileController
|
||||
*/
|
||||
class ProfileController extends BaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param URI $user
|
||||
*/
|
||||
public function __construct(URI $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\View\View
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return View::make('profile.index')
|
||||
->with('title', 'Profile')
|
||||
->with('subTitle', Auth::user()->email)
|
||||
->with('mainTitleIcon', 'fa-user');
|
||||
return View::make('profile.index')->with('title', 'Profile')->with('subTitle', Auth::user()->email)->with('mainTitleIcon', 'fa-user');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,10 +20,9 @@ class ProfileController extends BaseController
|
||||
*/
|
||||
public function changePassword()
|
||||
{
|
||||
return View::make('profile.change-password')
|
||||
->with('title', Auth::user()->email)
|
||||
->with('subTitle', 'Change your password')
|
||||
->with('mainTitleIcon', 'fa-user');
|
||||
return View::make('profile.change-password')->with('title', Auth::user()->email)->with('subTitle', 'Change your password')->with(
|
||||
'mainTitleIcon', 'fa-user'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,8 +56,9 @@ class ProfileController extends BaseController
|
||||
}
|
||||
|
||||
// update the user with the new password.
|
||||
/** @noinspection PhpParamsInspection */
|
||||
$this->user->updatePassword(Auth::user(), Input::get('new1'));
|
||||
/** @var \FireflyIII\Database\User $repository */
|
||||
$repository = \App::make('FireflyIII\Database\User');
|
||||
$repository->updatePassword(Auth::user(), Input::get('new1'));
|
||||
|
||||
Session::flash('success', 'Password changed!');
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Firefly\Exception\FireflyException;
|
||||
use Firefly\Storage\RecurringTransaction\RecurringTransactionRepositoryInterface as RTR;
|
||||
use Firefly\Helper\Controllers\RecurringInterface as RI;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
|
||||
/**
|
||||
* Class RecurringController
|
||||
@@ -11,17 +9,8 @@ use Firefly\Helper\Controllers\RecurringInterface as RI;
|
||||
*/
|
||||
class RecurringController extends BaseController
|
||||
{
|
||||
protected $_repository;
|
||||
protected $_helper;
|
||||
|
||||
/**
|
||||
* @param RTR $repository
|
||||
* @param RI $helper
|
||||
*/
|
||||
public function __construct(RTR $repository, RI $helper)
|
||||
public function __construct()
|
||||
{
|
||||
$this->_repository = $repository;
|
||||
$this->_helper = $helper;
|
||||
|
||||
View::share('title', 'Recurring transactions');
|
||||
View::share('mainTitleIcon', 'fa-rotate-right');
|
||||
@@ -59,7 +48,11 @@ class RecurringController extends BaseController
|
||||
public function destroy(RecurringTransaction $recurringTransaction)
|
||||
{
|
||||
//Event::fire('recurring.destroy', [$recurringTransaction]);
|
||||
$result = $this->_repository->destroy($recurringTransaction);
|
||||
|
||||
/** @var \FireflyIII\Database\RecurringTransaction $repository */
|
||||
$repository = App::make('FireflyIII\Database\RecurringTransaction');
|
||||
|
||||
$result = $repository->destroy($recurringTransaction);
|
||||
if ($result === true) {
|
||||
Session::flash('success', 'The recurring transaction was deleted.');
|
||||
} else {
|
||||
@@ -113,127 +106,19 @@ class RecurringController extends BaseController
|
||||
Session::flash('warning', 'Inactive recurring transactions cannot be scanned.');
|
||||
return Redirect::back();
|
||||
}
|
||||
// do something!
|
||||
/** @var \Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface $repo */
|
||||
$repo = App::make('Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface');
|
||||
$set = $repo->get();
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($set as $journal) {
|
||||
Event::fire('recurring.rescan', [$recurringTransaction, $journal]);
|
||||
}
|
||||
throw new NotImplementedException;
|
||||
Session::flash('success', 'Rescanned everything.');
|
||||
return Redirect::back();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$data = Input::except(['_token', 'post_submit_action']);
|
||||
switch (Input::get('post_submit_action')) {
|
||||
default:
|
||||
throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.');
|
||||
break;
|
||||
case 'store':
|
||||
case 'create_another':
|
||||
/*
|
||||
* Try to store:
|
||||
*/
|
||||
$messageBag = $this->_repository->store($data);
|
||||
|
||||
/*
|
||||
* Failure!
|
||||
*/
|
||||
if ($messageBag->count() > 0) {
|
||||
Session::flash('error', 'Could not save recurring transaction: ' . $messageBag->first());
|
||||
return Redirect::route('recurring.create')->withInput()->withErrors($messageBag);
|
||||
}
|
||||
|
||||
/*
|
||||
* Success!
|
||||
*/
|
||||
Session::flash('success', 'Recurring transaction "' . e(Input::get('name')) . '" saved!');
|
||||
|
||||
/*
|
||||
* Redirect to original location or back to the form.
|
||||
*/
|
||||
if (Input::get('post_submit_action') == 'create_another') {
|
||||
return Redirect::route('recurring.create')->withInput();
|
||||
} else {
|
||||
return Redirect::route('recurring.index');
|
||||
}
|
||||
break;
|
||||
case 'validate_only':
|
||||
$messageBags = $this->_helper->validate($data);
|
||||
|
||||
Session::flash('warnings', $messageBags['warnings']);
|
||||
Session::flash('successes', $messageBags['successes']);
|
||||
Session::flash('errors', $messageBags['errors']);
|
||||
return Redirect::route('recurring.create')->withInput();
|
||||
break;
|
||||
}
|
||||
throw new NotImplementedException;
|
||||
|
||||
}
|
||||
|
||||
public function update(RecurringTransaction $recurringTransaction)
|
||||
{
|
||||
$data = Input::except(['_token', 'post_submit_action']);
|
||||
switch (Input::get('post_submit_action')) {
|
||||
case 'update':
|
||||
case 'return_to_edit':
|
||||
$messageBag = $this->_repository->update($recurringTransaction, $data);
|
||||
if ($messageBag->count() == 0) {
|
||||
// has been saved, return to index:
|
||||
Session::flash('success', 'Recurring transaction updated!');
|
||||
|
||||
if (Input::get('post_submit_action') == 'return_to_edit') {
|
||||
return Redirect::route('recurring.edit', $recurringTransaction->id)->withInput();
|
||||
} else {
|
||||
return Redirect::route('recurring.index');
|
||||
}
|
||||
} else {
|
||||
Session::flash('error', 'Could not update recurring transaction: ' . $messageBag->first());
|
||||
|
||||
return Redirect::route('transactions.edit', $recurringTransaction->id)->withInput()
|
||||
->withErrors($messageBag);
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'validate_only':
|
||||
$data = Input::all();
|
||||
$data['id'] = $recurringTransaction->id;
|
||||
$messageBags = $this->_helper->validate($data);
|
||||
|
||||
Session::flash('warnings', $messageBags['warnings']);
|
||||
Session::flash('successes', $messageBags['successes']);
|
||||
Session::flash('errors', $messageBags['errors']);
|
||||
return Redirect::route('recurring.edit', $recurringTransaction->id)->withInput();
|
||||
|
||||
break;
|
||||
// update
|
||||
default:
|
||||
throw new FireflyException('Method ' . Input::get('post_submit_action') . ' not implemented yet.');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// /** @var \RecurringTransaction $recurringTransaction */
|
||||
// $recurringTransaction = $this->_repository->update($recurringTransaction, Input::all());
|
||||
// if ($recurringTransaction->errors()->count() == 0) {
|
||||
// Session::flash('success', 'The recurring transaction has been updated.');
|
||||
// //Event::fire('recurring.update', [$recurringTransaction]);
|
||||
//
|
||||
// return Redirect::route('recurring.index');
|
||||
// } else {
|
||||
// Session::flash(
|
||||
// 'error', 'Could not update the recurring transaction: ' . $recurringTransaction->errors()->first()
|
||||
// );
|
||||
//
|
||||
// return Redirect::route('recurring.edit', $recurringTransaction->id)->withInput()->withErrors(
|
||||
// $recurringTransaction->errors()
|
||||
// );
|
||||
// }
|
||||
throw new NotImplementedException;
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,17 @@
|
||||
<?php
|
||||
|
||||
use Firefly\Helper\Controllers\SearchInterface as SI;
|
||||
use FireflyIII\Exception\NotImplementedException;
|
||||
|
||||
/**
|
||||
* Class SearchController
|
||||
*/
|
||||
class SearchController extends BaseController
|
||||
{
|
||||
protected $_helper;
|
||||
|
||||
public function __construct(SI $helper)
|
||||
{
|
||||
$this->_helper = $helper;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Results always come in the form of an array [results, count, fullCount]
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
$subTitle = null;
|
||||
$rawQuery = null;
|
||||
$result = [];
|
||||
|
||||
@@ -1,33 +1,22 @@
|
||||
<?php
|
||||
|
||||
|
||||
use Firefly\Exception\FireflyException;
|
||||
use Firefly\Helper\Controllers\TransactionInterface as TI;
|
||||
use Firefly\Storage\TransactionJournal\TransactionJournalRepositoryInterface as TJRI;
|
||||
use FireflyIII\Exception\FireflyException;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
/**
|
||||
* Class TransactionController
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CamelCasePropertyName)
|
||||
*
|
||||
*/
|
||||
class TransactionController extends BaseController
|
||||
{
|
||||
|
||||
protected $_helper;
|
||||
protected $_repository;
|
||||
|
||||
/**
|
||||
* Construct a new transaction controller with two of the most often used helpers.
|
||||
*
|
||||
* @param TJRI $repository
|
||||
* @param TI $helper
|
||||
*/
|
||||
public function __construct(TJRI $repository, TI $helper)
|
||||
public function __construct()
|
||||
{
|
||||
$this->_repository = $repository;
|
||||
$this->_helper = $helper;
|
||||
View::share('title', 'Transactions');
|
||||
View::share('mainTitleIcon', 'fa-repeat');
|
||||
}
|
||||
@@ -41,6 +30,7 @@ class TransactionController extends BaseController
|
||||
*/
|
||||
public function create($what = 'deposit')
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
/*
|
||||
* The repositories we need:
|
||||
*/
|
||||
@@ -110,6 +100,7 @@ class TransactionController extends BaseController
|
||||
*/
|
||||
public function destroy(TransactionJournal $transactionJournal)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
$type = $transactionJournal->transactionType->type;
|
||||
$transactionJournal->delete();
|
||||
|
||||
@@ -135,6 +126,7 @@ class TransactionController extends BaseController
|
||||
*/
|
||||
public function edit(TransactionJournal $journal)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
/*
|
||||
* All the repositories we need:
|
||||
*/
|
||||
@@ -268,6 +260,7 @@ class TransactionController extends BaseController
|
||||
*/
|
||||
public function store($what)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
/*
|
||||
* Collect data to process:
|
||||
*/
|
||||
@@ -334,6 +327,7 @@ class TransactionController extends BaseController
|
||||
*/
|
||||
public function update(TransactionJournal $journal)
|
||||
{
|
||||
throw new NotImplementedException;
|
||||
switch (Input::get('post_submit_action')) {
|
||||
case 'update':
|
||||
case 'return_to_edit':
|
||||
|
||||
Reference in New Issue
Block a user