Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
This fixes part of #738 (not everything).
James Colebd924b993b31
diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.phpindex 23225eae8f..d8c8a872f9 100644--- a/app/Http/Controllers/Transaction/SplitController.php+++ b/app/Http/Controllers/Transaction/SplitController.php@@ -18,6 +18,7 @@ use ExpandedForm;use FireflyIII\Events\UpdatedTransactionJournal;use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;use FireflyIII\Http\Controllers\Controller;+use FireflyIII\Models\Account;use FireflyIII\Models\AccountType;use FireflyIII\Models\TransactionJournal;use FireflyIII\Repositories\Account\AccountRepositoryInterface;@@ -94,13 +95,22 @@ class SplitController extends Controller$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));$currencies = $this->currencies->get();- $assetAccounts = ExpandedForm::makeSelectList($this->accounts->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]));+ $accountList = $this->accounts->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);+ $assetAccounts = ExpandedForm::makeSelectList($accountList);$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets());$preFilled = $this->arrayFromJournal($request, $journal);$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);$subTitleIcon = 'fa-pencil';+ $accountArray = [];+ // account array to display currency info:+ /** @var Account $account */+ foreach ($accountList as $account) {+ $accountArray[$account->id] = $account;+ }++Session::flash('gaEventCategory', 'transactions');Session::flash('gaEventAction', 'edit-split-' . $preFilled['what']);@@ -115,7 +125,7 @@ class SplitController extends Controllercompact('subTitleIcon', 'currencies', 'optionalFields','preFilled', 'subTitle', 'uploadSize', 'assetAccounts',- 'budgets', 'journal'+ 'budgets', 'journal','accountArray'));}diff --git a/resources/views/transactions/split/edit.twig b/resources/views/transactions/split/edit.twigindex dfb69c7fcd..5266ee0be0 100644--- a/resources/views/transactions/split/edit.twig+++ b/resources/views/transactions/split/edit.twig@@ -56,9 +56,16 @@{% endif %}{# TOTAL AMOUNT IS STATIC TEXT #}- {# TODO this does not reflect the actual currency (currencies) #}- {{ ExpandedForm.staticText('journal_amount', preFilled.journal_amount|formatAmount ) }}- <input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>+ {% if preFilled.what == 'withdrawal' or preFilled.what == 'transfer' %}+ {{ ExpandedForm.staticText('journal_amount', formatAmountByAccount(accountArray[preFilled.journal_source_account_id], preFilled.journal_amount, true) ) }}+ <input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>+ {% endif %}++ {% if preFilled.what == 'deposit' %}+ {{ ExpandedForm.staticText('journal_amount', formatAmountByAccount(accountArray[preFilled.journal_destination_account_id], preFilled.journal_amount, true) ) }}+ <input type="hidden" name="journal_amount" value="{{ preFilled.journal_amount }}"/>+ {% endif %}+{# DATE #}{{ ExpandedForm.date('date', journal.date) }}