mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-21 00:50:07 +00:00
Revert "Cleanup in preparation of an overhaul."
This reverts commit 5662a02a36.
This commit is contained in:
@@ -140,7 +140,8 @@ class AccountController extends BaseController
|
||||
{
|
||||
$subTitle = $this->_subTitlesByIdentifier[$what];
|
||||
$subTitleIcon = $this->_subIconsByIdentifier[$what];
|
||||
$accounts = $this->_repository->getAccountsByType($this->_accountTypesByIdentifier[$what]);
|
||||
|
||||
$accounts = $this->_repository->getAccountsByType($this->_accountTypesByIdentifier[$what]);
|
||||
|
||||
return View::make('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts'));
|
||||
}
|
||||
@@ -168,23 +169,21 @@ class AccountController extends BaseController
|
||||
public function store()
|
||||
{
|
||||
|
||||
/*
|
||||
* always validate using the account validator:
|
||||
* TODO move to constructor.
|
||||
*/
|
||||
/** @var \FireflyIII\Validation\Account $validator */
|
||||
$validator = App::make('FireflyIII\Validation\Account');
|
||||
$data = Input::except('_token', 'post_submit_action');
|
||||
$errors = $validator->store($data);
|
||||
$data = Input::except('_token');
|
||||
|
||||
// always validate:
|
||||
$messages = $this->_repository->validate($data);
|
||||
|
||||
// flash messages:
|
||||
Session::flash('errors', $errors);
|
||||
if ($errors->count() > 0) {
|
||||
Session::flash('error', 'Could not store account: ' . $errors->first());
|
||||
Session::flash('warnings', $messages['warnings']);
|
||||
Session::flash('successes', $messages['successes']);
|
||||
Session::flash('errors', $messages['errors']);
|
||||
if ($messages['errors']->count() > 0) {
|
||||
Session::flash('error', 'Could not store account: ' . $messages['errors']->first());
|
||||
}
|
||||
|
||||
// return to create screen:
|
||||
if ($data['post_submit_action'] == 'validate_only' || $errors->count() > 0) {
|
||||
if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) {
|
||||
return Redirect::route('accounts.create', e($data['what']))->withInput();
|
||||
}
|
||||
|
||||
@@ -206,24 +205,23 @@ class AccountController extends BaseController
|
||||
*/
|
||||
public function update(Account $account)
|
||||
{
|
||||
/*
|
||||
* always validate using the account validator:
|
||||
* TODO move to constructor.
|
||||
*/
|
||||
/** @var \FireflyIII\Validation\Account $validator */
|
||||
$validator = App::make('FireflyIII\Validation\Account');
|
||||
$data = Input::except('_token');
|
||||
$data['what'] = $this->_shortNamesByFullName[$account->accountType->type];
|
||||
$errors = $validator->update($data, $account);
|
||||
|
||||
|
||||
// always validate:
|
||||
$messages = $this->_repository->validate($data);
|
||||
|
||||
// flash messages:
|
||||
Session::flash('errors', $errors);
|
||||
if ($errors->count() > 0) {
|
||||
Session::flash('error', 'Could not update account: ' . $errors->first());
|
||||
Session::flash('warnings', $messages['warnings']);
|
||||
Session::flash('successes', $messages['successes']);
|
||||
Session::flash('errors', $messages['errors']);
|
||||
if ($messages['errors']->count() > 0) {
|
||||
Session::flash('error', 'Could not update account: ' . $messages['errors']->first());
|
||||
}
|
||||
|
||||
// return to update screen:
|
||||
if ($data['post_submit_action'] == 'validate_only' || $errors->count() > 0) {
|
||||
if ($data['post_submit_action'] == 'validate_only' || $messages['errors']->count() > 0) {
|
||||
return Redirect::route('accounts.edit', $account->id)->withInput();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user