Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #10308
James Cole01800a353448
diff --git a/resources/assets/v1/mix-manifest.json b/resources/assets/v1/mix-manifest.jsonindex ff2938f703..145eaf58f2 100644--- a/resources/assets/v1/mix-manifest.json+++ b/resources/assets/v1/mix-manifest.json@@ -20,8 +20,12 @@"/public/v1/js/app.js.LICENSE.txt": "/public/v1/js/app.js.LICENSE.txt","/public/v1/js/app_vue.js": "/public/v1/js/app_vue.js","/public/v1/js/app_vue.js.LICENSE.txt": "/public/v1/js/app_vue.js.LICENSE.txt",+ "/public/v1/js/create.js": "/public/v1/js/create.js",+ "/public/v1/js/create.js.LICENSE.txt": "/public/v1/js/create.js.LICENSE.txt","/public/v1/js/create_transaction.js": "/public/v1/js/create_transaction.js","/public/v1/js/create_transaction.js.LICENSE.txt": "/public/v1/js/create_transaction.js.LICENSE.txt",+ "/public/v1/js/edit.js": "/public/v1/js/edit.js",+ "/public/v1/js/edit.js.LICENSE.txt": "/public/v1/js/edit.js.LICENSE.txt","/public/v1/js/edit_transaction.js": "/public/v1/js/edit_transaction.js","/public/v1/js/edit_transaction.js.LICENSE.txt": "/public/v1/js/edit_transaction.js.LICENSE.txt","/public/v1/js/exchange-rates/index.js": "/public/v1/js/exchange-rates/index.js",@@ -96,6 +100,8 @@"/public/v1/js/ff/transactions/mass/edit-bulk.js": "/public/v1/js/ff/transactions/mass/edit-bulk.js","/public/v1/js/ff/transactions/mass/edit.js": "/public/v1/js/ff/transactions/mass/edit.js","/public/v1/js/ff/transactions/show.js": "/public/v1/js/ff/transactions/show.js",+ "/public/v1/js/index.js": "/public/v1/js/index.js",+ "/public/v1/js/index.js.LICENSE.txt": "/public/v1/js/index.js.LICENSE.txt","/public/v1/js/lib/Chart.bundle.min.js": "/public/v1/js/lib/Chart.bundle.min.js","/public/v1/js/lib/accounting.min.js": "/public/v1/js/lib/accounting.min.js","/public/v1/js/lib/bootstrap-multiselect.js": "/public/v1/js/lib/bootstrap-multiselect.js",@@ -120,6 +126,7 @@"/public/v1/js/lib/moment/en_US.js": "/public/v1/js/lib/moment/en_US.js","/public/v1/js/lib/moment/es_ES.js": "/public/v1/js/lib/moment/es_ES.js","/public/v1/js/lib/moment/es_MX.js": "/public/v1/js/lib/moment/es_MX.js",+ "/public/v1/js/lib/moment/fa_IR.js": "/public/v1/js/lib/moment/fa_IR.js","/public/v1/js/lib/moment/fi_FI.js": "/public/v1/js/lib/moment/fi_FI.js","/public/v1/js/lib/moment/fr_FR.js": "/public/v1/js/lib/moment/fr_FR.js","/public/v1/js/lib/moment/hu_HU.js": "/public/v1/js/lib/moment/hu_HU.js",@@ -143,6 +150,7 @@"/public/v1/js/lib/moment/vi_VN.js": "/public/v1/js/lib/moment/vi_VN.js","/public/v1/js/lib/moment/zh_CN.js": "/public/v1/js/lib/moment/zh_CN.js","/public/v1/js/lib/moment/zh_TW.js": "/public/v1/js/lib/moment/zh_TW.js",+ "/public/v1/js/lib/moment-tz.js": "/public/v1/js/lib/moment-tz.js","/public/v1/js/lib/moment.min.js": "/public/v1/js/lib/moment.min.js","/public/v1/js/lib/respond.min.js": "/public/v1/js/lib/respond.min.js","/public/v1/js/lib/typeahead/bloodhound.js": "/public/v1/js/lib/typeahead/bloodhound.js",@@ -154,6 +162,8 @@"/public/v1/js/lib/vue.js": "/public/v1/js/lib/vue.js","/public/v1/js/profile.js": "/public/v1/js/profile.js","/public/v1/js/profile.js.LICENSE.txt": "/public/v1/js/profile.js.LICENSE.txt",+ "/public/v1/js/show.js": "/public/v1/js/show.js",+ "/public/v1/js/show.js.LICENSE.txt": "/public/v1/js/show.js.LICENSE.txt","/public/v1/js/webhooks/create.js": "/public/v1/js/webhooks/create.js","/public/v1/js/webhooks/create.js.LICENSE.txt": "/public/v1/js/webhooks/create.js.LICENSE.txt","/public/v1/js/webhooks/edit.js": "/public/v1/js/webhooks/edit.js",diff --git a/resources/assets/v1/src/components/transactions/EditTransaction.vue b/resources/assets/v1/src/components/transactions/EditTransaction.vueindex cdab12ba1f..42a0ce300f 100644--- a/resources/assets/v1/src/components/transactions/EditTransaction.vue+++ b/resources/assets/v1/src/components/transactions/EditTransaction.vue@@ -337,6 +337,7 @@ export default {this.transactions[index].destination_account.name = model;return;}+ // console.log('selectedDestinationAccount');this.transactions[index].destination_account = {id: model.id,name: model.name,@@ -353,6 +354,7 @@ export default {this.transactions[index].destination_account.currency_code = model.account_currency_code;this.transactions[index].destination_account.currency_decimal_places = model.account_currency_decimal_places;}+ // console.log('Selected destination account currency ID = ' + this.transactions[index].destination_account.currency_id);},clearSource(index) {// reset source account:@@ -540,7 +542,9 @@ export default {allowed_types: window.expectedSourceTypes.destination[this.ucFirst(transaction.type)]}};+ // console.log('Source currency id is ' + result.source_account.currency_id);// console.log('Destination currency id is ' + result.destination_account.currency_id);+// if transaction type is transfer, the destination currency_id etc. MUST match the actual account currency info.// OR if the transaction type is a withdrawal, and the destination account is a liability account, same as above.if (@@ -553,6 +557,16 @@ export default {result.destination_account.currency_decimal_places = transaction.foreign_currency_decimal_places;// console.log('Set destination currency_id to ' + result.destination_account.currency_id);}+ // if the transaction type is a deposit, but the source account is a liability, the source+ // account currency must not be overruled.++ if('deposit' === transaction.type && ['Loan', 'Debt', 'Mortgage'].includes(transaction.source_type)) {+ // console.log('Overrule for deposit from liability to ' + transaction.foreign_currency_id);+ result.destination_account.currency_id = transaction.foreign_currency_id;+ result.destination_account.currency_name = transaction.foreign_currency_name;+ result.destination_account.currency_code = transaction.foreign_currency_code;+ result.destination_account.currency_decimal_places = transaction.foreign_currency_decimal_places;+ }if (null === transaction.foreign_amount) {@@ -611,7 +625,12 @@ export default {if ('deposit' === transactionType) {currencyId = this.transactions[0].destination_account.currency_id;}- // console.log('Overruled currency ID to ' + currencyId);+ // if transaction type is deposit BUT the source account is a liability, the currency ID must be the SOURCE account ID.+ if ('deposit' === transactionType && ['Loan', 'Debt', 'Mortgage'].includes(firstSource)) {+ // console.log('Overruled currency ID to ' + this.transactions[0].source_account.currency_id);+ currencyId = this.transactions[0].source_account.currency_id;+ }+ // console.log('Final currency ID = ' + currencyId);for (let key in this.transactions) {if (this.transactions.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {@@ -691,6 +710,7 @@ export default {foreignCurrency = row.foreign_amount.currency_id;}if (foreignCurrency === row.currency_id) {+ // console.log('reset foreign currencyto NULL because ' + foreignCurrency + ' = ' + row.currency_id);foreignAmount = null;foreignCurrency = null;}diff --git a/resources/views/reports/partials/balance.twig b/resources/views/reports/partials/balance.twigindex a2b4c93f47..36dc3bb0ca 100644--- a/resources/views/reports/partials/balance.twig+++ b/resources/views/reports/partials/balance.twig@@ -38,7 +38,7 @@{% endfor %}<td style="text-align: right;">{% for sum in report.sums[budget.budget_id] %}- {{ formatAmountBySymbol(sum.sum, sum.currency_symbol, sum.currency_decimal_places) }}+ {{ formatAmountBySymbol(sum.sum, sum.currency_symbol, sum.currency_decimal_places) }}<br/>{% endfor %}</td>