mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-05 04:03:26 +00:00
Fixed some bugs in transaction handling. [skip ci]
This commit is contained in:
@@ -37,8 +37,13 @@ class RecurringController extends BaseController
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit()
|
public function edit(RecurringTransaction $recurringTransaction)
|
||||||
{
|
{
|
||||||
|
$periods = \Config::get('firefly.periods_to_text');
|
||||||
|
|
||||||
|
return View::make('recurring.edit')->with('periods', $periods)->with(
|
||||||
|
'recurringTransaction', $recurringTransaction
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
@@ -71,7 +76,7 @@ class RecurringController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update()
|
public function update(RecurringTransaction $recurringTransaction)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -133,14 +133,9 @@ class TransactionController extends BaseController
|
|||||||
*
|
*
|
||||||
* @return $this|\Illuminate\View\View
|
* @return $this|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function show($journalId)
|
public function show(TransactionJournal $journal)
|
||||||
{
|
{
|
||||||
// $journal = $this->_journal->find($journalId);
|
return View::make('transactions.show')->with('journal', $journal);
|
||||||
// if ($journal) {
|
|
||||||
// return View::make('transactions.show')->with('journal', $journal);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return View::make('error')->with('message', 'Invalid journal');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -386,7 +386,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
|||||||
case 'Withdrawal':
|
case 'Withdrawal':
|
||||||
// means transaction[0] is the users account.
|
// means transaction[0] is the users account.
|
||||||
$account = $accountRepository->find($data['account_id']);
|
$account = $accountRepository->find($data['account_id']);
|
||||||
$beneficiary = $accountRepository->findByName($data['beneficiary']);
|
$beneficiary = $accountRepository->createOrFindBeneficiary($data['beneficiary']);
|
||||||
$transactions[0]->account()->associate($account);
|
$transactions[0]->account()->associate($account);
|
||||||
$transactions[1]->account()->associate($beneficiary);
|
$transactions[1]->account()->associate($beneficiary);
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
|||||||
case 'Deposit':
|
case 'Deposit':
|
||||||
// means transaction[0] is the beneficiary.
|
// means transaction[0] is the beneficiary.
|
||||||
$account = $accountRepository->find($data['account_id']);
|
$account = $accountRepository->find($data['account_id']);
|
||||||
$beneficiary = $accountRepository->findByName($data['beneficiary']);
|
$beneficiary = $accountRepository->createOrFindBeneficiary($data['beneficiary']);
|
||||||
$journal->transactions[0]->account()->associate($beneficiary);
|
$journal->transactions[0]->account()->associate($beneficiary);
|
||||||
$journal->transactions[1]->account()->associate($account);
|
$journal->transactions[1]->account()->associate($account);
|
||||||
break;
|
break;
|
||||||
|
@@ -147,6 +147,7 @@ Route::group(['before' => 'auth'], function () {
|
|||||||
|
|
||||||
// recurring transactions controller
|
// recurring transactions controller
|
||||||
Route::get('/recurring',['uses' => 'RecurringController@index', 'as' => 'recurring.index']);
|
Route::get('/recurring',['uses' => 'RecurringController@index', 'as' => 'recurring.index']);
|
||||||
|
Route::get('/recurring/show/{recurring}',['uses' => 'RecurringController@show', 'as' => 'recurring.show']);
|
||||||
Route::get('/recurring/create',['uses' => 'RecurringController@create', 'as' => 'recurring.create']);
|
Route::get('/recurring/create',['uses' => 'RecurringController@create', 'as' => 'recurring.create']);
|
||||||
Route::get('/recurring/edit/{recurring}',['uses' => 'RecurringController@edit','as' => 'recurring.edit']);
|
Route::get('/recurring/edit/{recurring}',['uses' => 'RecurringController@edit','as' => 'recurring.edit']);
|
||||||
Route::get('/recurring/delete/{recurring}',['uses' => 'RecurringController@delete','as' => 'recurring.delete']);
|
Route::get('/recurring/delete/{recurring}',['uses' => 'RecurringController@delete','as' => 'recurring.delete']);
|
||||||
|
194
app/views/recurring/edit.blade.php
Normal file
194
app/views/recurring/edit.blade.php
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
@extends('layouts.default')
|
||||||
|
@section('content')
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12 col-md-12 col-sm-12">
|
||||||
|
<h1>Firefly
|
||||||
|
<small>Edit recurring transaction "{{{$recurringTransaction->name}}}"</small>
|
||||||
|
</h1>
|
||||||
|
<p class="lead">Use recurring transactions to track repeated expenses</p>
|
||||||
|
<p class="text-info">
|
||||||
|
Bla bla.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{Form::open(['class' => 'form-horizontal','url' => route('recurring.update', $recurringTransaction->id)])}}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 col-md-12 col-sm-6">
|
||||||
|
<h4>Mandatory fields</h4>
|
||||||
|
|
||||||
|
<!-- name -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="name" class="col-sm-4 control-label">Name</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" name="name" class="form-control" id="name"
|
||||||
|
value="{{{Input::old('name') ?: $recurringTransaction->name}}}" placeholder="Name">
|
||||||
|
@if($errors->has('name'))
|
||||||
|
<p class="text-danger">{{$errors->first('name')}}</p>
|
||||||
|
@else
|
||||||
|
<span class="help-block">For example: rent, gas, insurance</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="match" class="col-sm-4 control-label">Matches on</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<input type="text" name="match" class="form-control" id="match"
|
||||||
|
value="{{Input::old('match') ?: join(',',explode(' ',$recurringTransaction->match))}}"
|
||||||
|
data-role="tagsinput">
|
||||||
|
@if($errors->has('match'))
|
||||||
|
<p class="text-danger">{{$errors->first('match')}}</p>
|
||||||
|
@else
|
||||||
|
<span class="help-block">For example: rent, [company name]. All matches need to
|
||||||
|
be present for the recurring transaction to be recognized. This field is not case-sensitive.</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('amount_min', 'Minimum amount', ['class' => 'col-sm-4 control-label'])}}
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon">€</span>
|
||||||
|
{{Form::input('number','amount_min', Input::old('amount_min') ?: $recurringTransaction->amount_min,
|
||||||
|
['step' => 'any', 'class' => 'form-control'])}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($errors->has('amount_min'))
|
||||||
|
<p class="text-danger">{{$errors->first('amount_min')}}</p>
|
||||||
|
@else
|
||||||
|
<span class="help-block">Firefly will only include transactions with a higher amount than this. If your rent
|
||||||
|
is usually around € 500,-, enter <code>450</code> to be safe.</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('amount_max', 'Maximum amount', ['class' => 'col-sm-4 control-label'])}}
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-addon">€</span>
|
||||||
|
{{Form::input('number','amount_max', Input::old('amount_max') ?: $recurringTransaction->amount_max,
|
||||||
|
['step' => 'any', 'class' => 'form-control'])}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if($errors->has('amount_max'))
|
||||||
|
<p class="text-danger">{{$errors->first('amount_max')}}</p>
|
||||||
|
@else
|
||||||
|
<span class="help-block">Firefly will only include transactions with a lower amount than this.
|
||||||
|
If your rent is usually around € 500,-, enter <code>550</code> to be safe.</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('date', 'Date', ['class' => 'col-sm-4 control-label'])}}
|
||||||
|
<div class="col-sm-8">
|
||||||
|
{{ Form::input('date','date', Input::old('date') ?: $recurringTransaction->date->format('Y-m-d'),
|
||||||
|
['class' => 'form-control']) }}
|
||||||
|
@if($errors->has('date'))
|
||||||
|
<p class="text-danger">{{$errors->first('date')}}</p>
|
||||||
|
@else
|
||||||
|
<span class="help-block">Select the next date you expect the transaction to occur.</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="period" class="col-sm-4 control-label">Recurrence</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
{{Form::select('repeat_freq',$periods,Input::old('repeat_freq') ?: $recurringTransaction->repeat_freq,
|
||||||
|
['class' => 'form-control'])}}
|
||||||
|
@if($errors->has('repeat_freq'))
|
||||||
|
<p class="text-danger">{{$errors->first('repeat_freq')}}</p>
|
||||||
|
@else
|
||||||
|
<span class="help-block">Select the period over which this transaction repeats</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6 col-md-12 col-sm-6">
|
||||||
|
<h4>Optional fields</h4>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
{{ Form::label('skip', 'Skip', ['class' => 'col-sm-4 control-label'])}}
|
||||||
|
<div class="col-sm-8">
|
||||||
|
{{Form::input('number','skip', Input::old('skip') ?: $recurringTransaction->skip,
|
||||||
|
['class' => 'form-control'])}}
|
||||||
|
|
||||||
|
@if($errors->has('skip'))
|
||||||
|
<p class="text-danger">{{$errors->first('skip')}}</p>
|
||||||
|
@else
|
||||||
|
<span class="help-block">Make Firefly skip every <em>n</em> times. Fill in <code>2</code>, and Firefly
|
||||||
|
will match, skip, skip and match a transaction.</span>
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- select budget -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- select category -->
|
||||||
|
|
||||||
|
<!-- select beneficiary -->
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="automatch" class="col-sm-4 control-label">Auto-match</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
{{Form::checkbox('automatch',1,Input::old('automatch') == '1' ||
|
||||||
|
(is_null(Input::old('automatch')) && $recurringTransaction->automatch == 1))}}
|
||||||
|
Yes
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<span class="help-block">Firefly will automatically match transactions.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="active" class="col-sm-4 control-label">Active</label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
{{Form::checkbox('active',1,Input::old('active') == '1' ||
|
||||||
|
(is_null(Input::old('active')) && $recurringTransaction->active == 1))}}
|
||||||
|
Yes
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<span class="help-block">This recurring transaction is actually active.</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 col-md-12 col-sm-6">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-4 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-default btn-success">Update the recurring transaction</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{Form::close()}}
|
||||||
|
|
||||||
|
|
||||||
|
@stop
|
||||||
|
@section('styles')
|
||||||
|
<?php echo stylesheet_link_tag('recurring'); ?>
|
||||||
|
@stop
|
||||||
|
@section('scripts')
|
||||||
|
<?php echo javascript_include_tag('recurring'); ?>
|
||||||
|
|
||||||
|
@stop
|
@@ -29,10 +29,10 @@
|
|||||||
</tr>
|
</tr>
|
||||||
@foreach($list as $entry)
|
@foreach($list as $entry)
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#">{{{$entry->name}}}</a></td>
|
<td><a href="{{route('recurring.show',$entry->id)}}">{{{$entry->name}}}</a></td>
|
||||||
<td>
|
<td>
|
||||||
@foreach(explode(' ',$entry->match) as $word)
|
@foreach(explode(' ',$entry->match) as $word)
|
||||||
<span class="label label-default">{{{$word}}}</span>
|
<span class="label label-info">{{{$word}}}</span>
|
||||||
@endforeach
|
@endforeach
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@@ -38,6 +38,9 @@
|
|||||||
<label for="description" class="col-sm-4 control-label">Description</label>
|
<label for="description" class="col-sm-4 control-label">Description</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="text" name="description" value="{{{Input::old('description')}}}" autocomplete="off" class="form-control" placeholder="Description" />
|
<input type="text" name="description" value="{{{Input::old('description')}}}" autocomplete="off" class="form-control" placeholder="Description" />
|
||||||
|
@if($errors->has('description')
|
||||||
|
<p class="text-danger">{{$errors->first('description')}}</p>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -54,6 +57,9 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
{{Form::select('account_id',$accounts,Input::old('account_id') ?: Input::get('account'),['class' => 'form-control'])}}
|
{{Form::select('account_id',$accounts,Input::old('account_id') ?: Input::get('account'),['class' => 'form-control'])}}
|
||||||
|
@if($errors->has('account_id')
|
||||||
|
<p class="text-danger">{{$errors->first('account_id')}}</p>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -71,7 +77,11 @@
|
|||||||
</label>
|
</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="text" name="beneficiary" value="{{{Input::old('beneficiary')}}}" autocomplete="off" class="form-control" placeholder="Beneficiary" />
|
<input type="text" name="beneficiary" value="{{{Input::old('beneficiary')}}}" autocomplete="off" class="form-control" placeholder="Beneficiary" />
|
||||||
|
@if($errors->has('beneficiary')
|
||||||
|
<p class="text-danger">{{$errors->first('beneficiary')}}</p>
|
||||||
|
@else
|
||||||
<span class="help-block">This field will auto-complete your existing beneficiaries (if any), but you can type freely to create new ones.</span>
|
<span class="help-block">This field will auto-complete your existing beneficiaries (if any), but you can type freely to create new ones.</span>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -125,6 +135,9 @@
|
|||||||
<label for="date" class="col-sm-4 control-label">Date</label>
|
<label for="date" class="col-sm-4 control-label">Date</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="date" name="date" value="{{Input::old('date') ?: date('Y-m-d')}}" class="form-control" />
|
<input type="date" name="date" value="{{Input::old('date') ?: date('Y-m-d')}}" class="form-control" />
|
||||||
|
@if($errors->has('date')
|
||||||
|
<p class="text-danger">{{$errors->first('date')}}</p>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -138,7 +151,11 @@
|
|||||||
<label for="budget_id" class="col-sm-4 control-label">Budget</label>
|
<label for="budget_id" class="col-sm-4 control-label">Budget</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
{{Form::select('budget_id',$budgets,Input::old('budget_id') ?: 0,['class' => 'form-control'])}}
|
{{Form::select('budget_id',$budgets,Input::old('budget_id') ?: 0,['class' => 'form-control'])}}
|
||||||
|
@if($errors->has('budget_id')
|
||||||
|
<p class="text-danger">{{$errors->first('budget_id')}}</p>
|
||||||
|
@else
|
||||||
<span class="help-block">Select one of your budgets to make this transaction a part of it.</span>
|
<span class="help-block">Select one of your budgets to make this transaction a part of it.</span>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@@ -147,10 +164,14 @@
|
|||||||
<label for="category" class="col-sm-4 control-label">Category</label>
|
<label for="category" class="col-sm-4 control-label">Category</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="text" name="category" value="{{Input::old('category')}}" autocomplete="off" class="form-control" placeholder="Category" />
|
<input type="text" name="category" value="{{Input::old('category')}}" autocomplete="off" class="form-control" placeholder="Category" />
|
||||||
|
@if($errors->has('category')
|
||||||
|
<p class="text-danger">{{$errors->first('category')}}</p>
|
||||||
|
@else
|
||||||
<span class="help-block">Add more fine-grained information to this transaction by entering a category.
|
<span class="help-block">Add more fine-grained information to this transaction by entering a category.
|
||||||
Like the beneficiary-field, this field will auto-complete existing categories but can also be used
|
Like the beneficiary-field, this field will auto-complete existing categories but can also be used
|
||||||
to create new ones.
|
to create new ones.
|
||||||
</span>
|
</span>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@@ -157,6 +157,5 @@
|
|||||||
|
|
||||||
@stop
|
@stop
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
|
<?php echo javascript_include_tag('transactions'); ?>
|
||||||
<script type="text/javascript" src="assets/javascript/withdrawal.js"></script>
|
|
||||||
@stop
|
@stop
|
Reference in New Issue
Block a user