Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Translations.
James Colec9f14da2946e
diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.phpindex 4b47b22714..c66f5421c5 100644--- a/app/Http/Controllers/Transaction/ConvertController.php+++ b/app/Http/Controllers/Transaction/ConvertController.php@@ -64,30 +64,35 @@ class ConvertController extends Controller$positiveAmount = TransactionJournal::amountPositive($journal);$assetAccounts = ExpandedForm::makeSelectList($this->accounts->getActiveAccountsByType([AccountType::DEFAULT, AccountType::ASSET]));$sourceType = $journal->transactionType;+ $subTitle = trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]);+ $subTitleIcon = 'fa-exchange';- $subTitle = trans('firefly.convert_to_' . $destinationType->type, ['description' => $journal->description]);- $subTitleIcon = 'fa-exchange';-+ // cannot convert to its own type.if ($sourceType->type === $destinationType->type) {Session::flash('info', trans('firefly.convert_is_already_type_' . $destinationType->type));return redirect(route('transactions.show', [$journal->id]));}++ // cannot convert split.if ($journal->transactions()->count() > 2) {Session::flash('error', trans('firefly.cannot_convert_split_journl'));return redirect(route('transactions.show', [$journal->id]));}++ // get source and destination account:$sourceAccount = TransactionJournal::sourceAccountList($journal)->first();$destinationAccount = TransactionJournal::destinationAccountList($journal)->first();return view(- 'transactions.convert', compact(- 'sourceType', 'destinationType', 'journal', 'assetAccounts',- 'positiveAmount', 'sourceAccount', 'destinationAccount', 'sourceType',- 'subTitle', 'subTitleIcon'+ 'transactions.convert',+ compact(+ 'sourceType', 'destinationType', 'journal', 'assetAccounts',+ 'positiveAmount', 'sourceAccount', 'destinationAccount', 'sourceType',+ 'subTitle', 'subTitleIcon'- )+ ));@@ -95,8 +100,35 @@ class ConvertController extends Controller// or to transfer requires}- public function submit(Request $request)+ /**+ * @param Request $request+ * @param TransactionType $destinationType+ * @param TransactionJournal $journal+ */+ public function submit(Request $request, TransactionType $destinationType, TransactionJournal $journal){+ $sourceType = $journal->transactionType;++ // cannot convert to its own type.+ if ($sourceType->type === $destinationType->type) {+ Session::flash('info', trans('firefly.convert_is_already_type_' . $destinationType->type));++ return redirect(route('transactions.show', [$journal->id]));+ }++ // cannot convert split.+ if ($journal->transactions()->count() > 2) {+ Session::flash('error', trans('firefly.cannot_convert_split_journl'));++ return redirect(route('transactions.show', [$journal->id]));+ }++ // try the conversion with the given data:+++++echo '<pre>';var_dump($request->all());diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.phpindex b1d1d18a1a..1db69759c3 100644--- a/resources/lang/en_US/firefly.php+++ b/resources/lang/en_US/firefly.php@@ -366,8 +366,23 @@ return ['convert_options_DepositWithdrawal' => 'Convert a deposit into a withdrawal','convert_options_TransferWithdrawal' => 'Convert a transfer into a withdrawal','convert_options_TransferDeposit' => 'Convert a transfer into a deposit',--+ 'transaction_journal_convert_options' => 'Convert this transaction',+ 'convert_Withdrawal_to_deposit' => 'Convert this withdrawal to a deposit',+ 'convert_Withdrawal_to_transfer' => 'Convert this withdrawal to a transfer',+ 'convert_Deposit_to_withdrawal' => 'Convert this deposit to a withdrawal',+ 'convert_Deposit_to_transfer' => 'Convert this deposit to a transfer',+ 'convert_Transfer_to_deposit' => 'Convert this transfer to a deposit',+ 'convert_Transfer_to_withdrawal' => 'Convert this transfer to a withdrawal',+ 'convert_please_set_revenue_source' => 'Please pick the revenue account where the money will come from.',+ 'convert_please_set_asset_destination' => 'Please pick the asset account where the money will go to.',+ 'convert_please_set_expense_destination' => 'Please pick the expense account where the money will go to.',+ 'convert_please_set_asset_source' => 'Please pick the asset account where the money will come from.',+ 'convert_explanation_withdrawal_deposit' => 'If you convert this withdrawal into a deposit, :amount will be deposited into <a href=":sourceRoute">:sourceName</a> instead of taken from it.',+ 'convert_explanation_withdrawal_transfer' => 'If you convert this withdrawal into a transfer, :amount will be transferred from <a href=":sourceRoute">:sourceName</a> to a new asset account, instead of being paid to <a href=":destinationRoute">:destinationName</a>.',+ 'convert_explanation_deposit_withdrawal' => 'If you convert this deposit into a withdrawal, :amount will be removed from <a href=":destinationRoute">:destinationName</a> instead of added to it.',+ 'convert_explanation_deposit_transfer' => 'If you convert this deposit into a transfer, :amount will be transferred from an asset account of your choice into <a href=":destinationRoute">:destinationName</a>.',+ 'convert_explanation_transfer_withdrawal' => 'If you convert this transfer into a withdrawal, :amount will go from <a href=":sourceRoute">:sourceName</a> to a new destination as an expense, instead of to <a href=":destinationRoute">:destinationName</a> as a transfer.',+ 'convert_explanation_transfer_deposit' => 'If you convert this transfer into a deposit, :amount will be deposited into account <a href=":destinationRoute">:destinationName</a> instead of being transferred there.',// create new stuff:'create_new_withdrawal' => 'Create new withdrawal','create_new_deposit' => 'Create new deposit',diff --git a/resources/views/transactions/convert.twig b/resources/views/transactions/convert.twigindex c7617480a6..c5c7c95429 100644--- a/resources/views/transactions/convert.twig+++ b/resources/views/transactions/convert.twig@@ -40,13 +40,19 @@{# ONE #}{% if sourceType.type == 'Withdrawal' and destinationType.type == 'Deposit' %}<p><em>- If you convert this withdrawal into a deposit, {{ positiveAmount|formatAmount }}- will be deposited into <a href="{{ route('accounts.show',[sourceAccount.id]) }}">{{ sourceAccount.name }}</a>- instead of taken from it.+ {{ trans('firefly.convert_explanation_withdrawal_deposit',+ {+ amount: positiveAmount|formatAmount,+ sourceRoute: route('accounts.show', [sourceAccount.id]),+ sourceName: sourceAccount.name,+ destinationRoute: route('accounts.show', [destinationAccount.id]),+ destinationName: destinationAccount.name,+ })|raw+ }}</em></p><p><em>- Please pick the revenue account where the money will come from.+ {{ 'convert_please_set_revenue_source'|_ }}</em></p>@@ -56,15 +62,21 @@{# TWO #}{% if sourceType.type == 'Withdrawal' and destinationType.type == 'Transfer' %}<p><em>- If you convert this withdrawal into a transfer, {{ positiveAmount|formatAmount }}- will be transferred from <a href="{{ route('accounts.show',[sourceAccount.id]) }}">{{ sourceAccount.name }}</a>- to a new asset account, instead of being paid to- <a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>.+ {{ trans('firefly.convert_explanation_withdrawal_transfer',+ {+ amount: positiveAmount|formatAmount,+ sourceRoute: route('accounts.show', [sourceAccount.id]),+ sourceName: sourceAccount.name,+ destinationRoute: route('accounts.show', [destinationAccount.id]),+ destinationName: destinationAccount.name,+ })|raw+ }}</em></p><p><em>- Please pick the asset account where the money will go to.+ {{ 'convert_please_set_asset_destination'|_ }}+</em></p>{{ ExpandedForm.select('destination_account_asset', assetAccounts) }}@@ -76,14 +88,21 @@{% if sourceType.type == 'Deposit' and destinationType.type == 'Withdrawal' %}<p><em>- If you convert this deposit into a withdrawal, {{ positiveAmount|formatAmount }}- will be removed from <a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>- instead of added to it.+ {{ trans('firefly.convert_explanation_deposit_withdrawal',+ {+ amount: positiveAmount|formatAmount,+ sourceRoute: route('accounts.show', [sourceAccount.id]),+ sourceName: sourceAccount.name,+ destinationRoute: route('accounts.show', [destinationAccount.id]),+ destinationName: destinationAccount.name,+ })|raw+ }}</em></p><p><em>- Please pick the expense account where the money will go to.+ {{ 'convert_please_set_expense_destination'|_ }}+</em></p>{{ ExpandedForm.text('destination_account_expense', destinationAccount.name) }}@@ -95,14 +114,21 @@<p><em>- If you convert this deposit into a transfer, {{ positiveAmount|formatAmount }} will be transferred- from an asset account of your choice into- <a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>.+ {{ trans('firefly.convert_explanation_deposit_transfer',+ {+ amount: positiveAmount|formatAmount,+ sourceRoute: route('accounts.show', [sourceAccount.id]),+ sourceName: sourceAccount.name,+ destinationRoute: route('accounts.show', [destinationAccount.id]),+ destinationName: destinationAccount.name,+ })|raw+ }}</em></p><p><em>- Please pick the asset account where the money will come from.+ {{ 'convert_please_set_asset_source'|_ }}+</em></p>@@ -114,17 +140,21 @@<p><em>- If you convert this transfer into a withdrawal, {{ positiveAmount|formatAmount }}- will go from <a href="{{ route('accounts.show',[sourceAccount.id]) }}">{{ sourceAccount.name }}</a>- to a new destination as an expense, instead of to- <a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>- as a transfer.+ {{ trans('firefly.convert_explanation_transfer_withdrawal',+ {+ amount: positiveAmount|formatAmount,+ sourceRoute: route('accounts.show', [sourceAccount.id]),+ sourceName: sourceAccount.name,+ destinationRoute: route('accounts.show', [destinationAccount.id]),+ destinationName: destinationAccount.name,+ })|raw+ }}</em></p><p><em>- Please pick the expense account where the money will go to.+ {{ 'convert_please_set_expense_destination'|_ }}</em></p>@@ -135,17 +165,24 @@{# SIX #}{% if sourceType.type == 'Transfer' and destinationType.type == 'Deposit' %}+<p><em>- If you convert this transfer into a deposit, {{ positiveAmount|formatAmount }}- will be deposited into account <a href="{{ route('accounts.show',[destinationAccount.id]) }}">{{ destinationAccount.name }}</a>- instead of being transferred there.+ {{ trans('firefly.convert_explanation_transfer_deposit',+ {+ amount: positiveAmount|formatAmount,+ sourceRoute: route('accounts.show', [sourceAccount.id]),+ sourceName: sourceAccount.name,+ destinationRoute: route('accounts.show', [destinationAccount.id]),+ destinationName: destinationAccount.name,+ })|raw+ }}</em></p><p><em>- Please pick the revenue account where the money will come from.+ {{ 'convert_please_set_revenue_source'|_ }}</em></p>diff --git a/resources/views/transactions/show.twig b/resources/views/transactions/show.twigindex 5a146f26be..f4928d89f4 100644--- a/resources/views/transactions/show.twig+++ b/resources/views/transactions/show.twig@@ -218,7 +218,7 @@<p><i class="fa fa-exchange" aria-hidden="true"></i><a href="{{ route('transactions.convert', ['withdrawal', journal.id]) }}">- Convert this {{ journal.transactionType.type }} to a withdrawal.+ {{ ('convert_'~journal.transactionType.type~'_to_withdrawal')|_ }}</a></p>{% endif %}@@ -226,7 +226,7 @@<p><i class="fa fa-exchange" aria-hidden="true"></i><a href="{{ route('transactions.convert', ['deposit', journal.id]) }}">- Convert this {{ journal.transactionType.type }} to a deposit.+ {{ ('convert_'~journal.transactionType.type~'_to_deposit')|_ }}</a></p>{% endif %}@@ -235,7 +235,7 @@<p><i class="fa fa-exchange" aria-hidden="true"></i><a href="{{ route('transactions.convert', ['transfer', journal.id]) }}">- Convert this {{ journal.transactionType.type }} to a transfer.+ {{ ('convert_'~journal.transactionType.type~'_to_transfer')|_ }}</a></p>{% endif %}@@ -251,7 +251,7 @@<div class="box"><div class="box-header with-border">- <h3 class="box-title">Transactions</h3>+ <h3 class="box-title">{{ 'transactions'|_ }}</h3></div><table class="table table-bordered table-striped"><thead>