diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index 8e10e9f830..ba394611ae 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -382,7 +382,7 @@ class AccountController extends BaseController if ($data['post_submit_action'] == 'create_another') { return Redirect::route('accounts.edit', $account->id); } else { - return Redirect::route('accounts.edit', $account->id); + return Redirect::route('accounts.index',$data['what']); } case 'validate_only': $messageBags = $acct->validate($data); diff --git a/app/controllers/BudgetController.php b/app/controllers/BudgetController.php index 74ed304099..26c1b3ead2 100644 --- a/app/controllers/BudgetController.php +++ b/app/controllers/BudgetController.php @@ -335,12 +335,12 @@ class BudgetController extends BaseController } // store! $repos->update($budget, $data); - Session::flash('success', 'Account updated!'); + Session::flash('success', 'Budget updated!'); if ($data['post_submit_action'] == 'create_another') { return Redirect::route('budgets.edit', $budget->id); } else { - return Redirect::route('budgets.edit', $budget->id); + return Redirect::route('budgets.index'); } case 'validate_only': $messageBags = $repos->validate($data); diff --git a/app/lib/FireflyIII/Database/Budget.php b/app/lib/FireflyIII/Database/Budget.php index 7d82420abb..ba8d22fcf4 100644 --- a/app/lib/FireflyIII/Database/Budget.php +++ b/app/lib/FireflyIII/Database/Budget.php @@ -91,10 +91,13 @@ class Budget implements CUD, CommonDatabaseCalls, BudgetInterface } else { $errors->add('name', 'Name is mandatory'); } - $validator = \Validator::make([$model], \Budget::$rules); + $validator = \Validator::make($model, \Component::$rules); + if ($validator->invalid()) { - $errors->merge($errors); + $errors->merge($validator->errors()); } + + if(!$errors->has('name')) { $successes->add('name','OK'); } diff --git a/app/views/budgets/indexByBudget.blade.php b/app/views/budgets/indexByBudget.blade.php deleted file mode 100644 index b567fc482a..0000000000 --- a/app/views/budgets/indexByBudget.blade.php +++ /dev/null @@ -1,113 +0,0 @@ -@extends('layouts.default') -@section('content') -
-
-

Use budgets to organize and limit your expenses.

- -

- Budgets are groups of expenses that reappear every [period]*. Examples could be "groceries", "bills" or - "drinks with friends". The table below lists all of the budgets you have, if any. - By definition, budgets are an estimated amount - of money, ie. € 400,-. Such an estimation can change over time but should always be set. Budgets - without an actual budget are fairly pointless. -

-

- Use this page to create or change budgets and the estimated amount of money you think is wise. Pages further ahead - will explain what an "envelope" is in the context of budgeting. -

-

- * Every month, week, year, etc. -

- - -

-
-
-
-
- - - - - - - @foreach($budgets as $budget) - - - - - - @endforeach - -
BudgetCurrent envelope(s)Update budget
- {{{$budget->name}}} - - -
-
- Envelope -
-
- Left -
-
- @foreach($budget->limits as $limit) - @foreach($limit->limitrepetitions as $index => $rep) -
-
- - - {{mf($rep->amount,false)}} -
-
- @if($rep->leftInRepetition() < 0) - - - {{mf($rep->leftInRepetition(),false)}} - @else - - - {{mf($rep->leftInRepetition(),false)}} - @endif -
- - @if($limit->repeats == 1) -
- auto repeats -
- @endif -
-
- - @if($limit->repeats == 0 || ($limit->repeats == 1 && $index == 0)) - - @endif -
-
-
- @endforeach - @endforeach -

- Add another envelope -

-
-
- - - -
-
- -
-
-@stop \ No newline at end of file diff --git a/app/views/budgets/indexByDate.blade.php b/app/views/budgets/indexByDate.blade.php deleted file mode 100644 index 705dbb7105..0000000000 --- a/app/views/budgets/indexByDate.blade.php +++ /dev/null @@ -1,87 +0,0 @@ -@extends('layouts.default') -@section('content') -
-
-

Use budgets to organize and limit your expenses.

- -

- Budgets are groups of expenses that reappear every [period]*. Examples could be "groceries", "bills" or - "drinks with friends". The table below lists all of the budgets you have, if any. - By definition, budgets are an estimated amount - of money, ie. € 400,-. Such an estimation can change over time but should always be set. Budgets - without an actual budget are fairly pointless. -

-

- Use this page to create or change budgets and the estimated amount of money you think is wise. Pages further ahead - will explain what an "envelope" is in the context of budgeting. -

-

- * Every month, week, year, etc. -

- -
-
- - - -@foreach($budgets as $date => $entry) -
-
-

{{$entry['date']}} - Create a new envelope for {{$entry['date']}} -

- - - - - - - - @foreach($entry['limitrepetitions'] as $index => $repetition) - - - - - - - -@endforeach -
BudgetEnvelopeLeft 
-
- - -
-
- - {{{$repetition->limit->budget->name}}} - - - - {{mf($repetition->amount,false)}} - - @if($repetition->left < 0) - - - {{mf($repetition->left,false)}} - @else - - - {{mf($repetition->left,false)}} - @endif - -
- - -
- @if($repetition->limit->repeats == 1) - auto repeats - @endif -
-
-
-@endforeach - -@stop \ No newline at end of file diff --git a/app/views/budgets/nobudget.blade.php b/app/views/budgets/nobudget.blade.php deleted file mode 100644 index 9f392c4eb8..0000000000 --- a/app/views/budgets/nobudget.blade.php +++ /dev/null @@ -1,30 +0,0 @@ -@extends('layouts.default') -@section('content') -
-
- @if($view == 'session') - -

- This view is filtered to only show transactions between {{Session::get('start')->format('d M Y')}} - and {{Session::get('end')->format('d M Y')}}. -

- @endif -
-
-@if($transactions->count() > 0) -
-
- @include('lists.transactions',['journals' => $transactions,'sum' => true]) -
-
-@else -
-
-

{{$repetition['date']}} -

-

No transactions

-
-
-@endif - -@stop \ No newline at end of file diff --git a/app/views/budgets/show.blade.php b/app/views/budgets/show.blade.php index bc3de1a0ca..73fd354ac8 100644 --- a/app/views/budgets/show.blade.php +++ b/app/views/budgets/show.blade.php @@ -1,119 +1,9 @@ @extends('layouts.default') @section('content') -
-
-

Budgets can help you cut back on spending.

- @if($view == 1) - -

- This view is filtered to show only the envelope from - {{{$repetitions[0]['limitrepetition']->periodShow()}}}, - which contains {{mf($repetitions[0]['limit']->amount,false)}}. -

- - @endif - - - @if($view == 2) - -

- This view is filtered to show transactions not in an envelope only. -

- @endif - - @if($view == 3) - -

- This view is filtered to only show transactions between {{Session::get('start')->format('d M Y')}} - and {{Session::get('end')->format('d M Y')}}. -

- @endif - @if($view != 4) -

- Reset the filter -

- @endif - -
-
- -
-
-
- @if($view == 1) -
- @endif - - - @if($view == 2) -
- @endif - - @if($view == 3) -
- @endif - - @if($view == 4) -
- @endif - -
-
- -@foreach($repetitions as $repetition) -@if(isset($repetition['journals']) && count($repetition['journals']) > 0) -
-
- - - @if($repetition['paginated'] == true) -

- - {{$repetition['date']}} paginated

- @else -

- - {{$repetition['date']}} - -

- {{mf($repetition['limit']->amount,false)}} - (left: {{mf($repetition['limitrepetition']->leftInRepetition(),false)}}) - @endif - - @if($repetition['paginated'] == true) - @include('paginated.transactions',['journals' => $repetition['journals'],'highlight' => $highlight]) - @else - @include('lists.transactions',['journals' => $repetition['journals'],'sum' => true,'highlight' => $highlight]) - @endif -
-
-@else -
-
-

{{$repetition['date']}} -

-

No transactions

-
-
-@endif -@endforeach @stop @section('scripts') -@if($view == 1) -{{HTML::script('assets/javascript/firefly/budgets/limit.js')}} -@endif -@if($view == 2) -{{HTML::script('assets/javascript/firefly/budgets/nolimit.js')}} -@endif - -@if($view == 3) -{{HTML::script('assets/javascript/firefly/budgets/session.js')}} -@endif -@if($view == 4) -{{HTML::script('assets/javascript/firefly/budgets/default.js')}} -@endif @stop \ No newline at end of file