This commit is contained in:
James Cole
2018-02-28 07:22:11 +01:00
parent 3bd9e0bcd4
commit 9f9feea159
2 changed files with 16 additions and 8 deletions

View File

@@ -109,7 +109,7 @@ class SingleController extends Controller
$budgetId = $this->repository->getJournalBudgetId($journal);
$categoryName = $this->repository->getJournalCategoryName($journal);
$tags = join(',',$this->repository->getTags($journal));
$tags = join(',', $this->repository->getTags($journal));
// todo less direct database access. Use collector?
/** @var Transaction $transaction */
$transaction = $journal->transactions()->first();
@@ -171,6 +171,14 @@ class SingleController extends Controller
$subTitle = trans('form.add_new_' . $what);
$subTitleIcon = 'fa-plus';
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$source = intval($request->get('source'));
if (($what === 'withdrawal' || $what === 'transfer') && $source > 0) {
$preFilled['source_account_id'] = $source;
}
if ($what === 'deposit' && $source > 0) {
$preFilled['destination_account_id'] = $source;
}
Session::put('preFilled', $preFilled);

View File

@@ -61,11 +61,11 @@
<div class="btn-group">
<button class="btn btn-box-tool dropdown-toggle" data-toggle="dropdown"><i class="fa fa-ellipsis-v"></i></button>
<ul class="dropdown-menu" role="menu">
<li><a href="{{ route('transactions.create','withdrawal') }}"><i
<li><a href="{{ route('transactions.create','withdrawal') }}?source={{ data[1].id }}"><i
class="fa fa-long-arrow-left fa-fw"></i> {{ 'newWithdrawal'|_ }}</a></li>
<li><a href="{{ route('transactions.create','deposit') }}"><i
<li><a href="{{ route('transactions.create','deposit') }}?source={{ data[1].id }}"><i
class="fa fa-long-arrow-right fa-fw"></i> {{ 'newDeposit'|_ }}</a></li>
<li><a href="{{ route('transactions.create','transfer') }}"><i
<li><a href="{{ route('transactions.create','transfer') }}?source={{ data[1].id }}"><i
class="fa fa-fw fa-exchange"></i> {{ 'newTransfer'|_ }}</a></li>
</ul>
</div>
@@ -95,7 +95,7 @@
<div class="btn-group" role="group" aria-label="...">
<div class="btn-group" role="group">
<a href="{{ route('transactions.create','withdrawal') }}" class="btn btn-success"><i
<a href="{{ route('transactions.create','withdrawal') }}?source={{ data[1].id }}" class="btn btn-success"><i
class="fa fa-plus fa-fw"></i> {{ 'create_new_transaction'|_ }}</a>
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
@@ -103,11 +103,11 @@
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu">
<li><a href="{{ route('transactions.create','withdrawal') }}"><i
<li><a href="{{ route('transactions.create','withdrawal') }}?source={{ data[1].id }}"><i
class="fa fa-long-arrow-left fa-fw"></i> {{ 'newWithdrawal'|_ }}</a></li>
<li><a href="{{ route('transactions.create','deposit') }}"><i
<li><a href="{{ route('transactions.create','deposit') }}?source={{ data[1].id }}"><i
class="fa fa-long-arrow-right fa-fw"></i> {{ 'newDeposit'|_ }}</a></li>
<li><a href="{{ route('transactions.create','transfer') }}"><i
<li><a href="{{ route('transactions.create','transfer') }}?source={{ data[1].id }}"><i
class="fa fa-fw fa-exchange"></i> {{ 'newTransfer'|_ }}
</a></li>
</ul>