mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix #9784
This commit is contained in:
parent
f9bcc4b1fa
commit
edab602bb7
@ -113,6 +113,11 @@ class AccountController extends Controller
|
||||
'currency_code' => $useCurrency->code,
|
||||
'currency_symbol' => $useCurrency->symbol,
|
||||
'currency_decimal_places' => $useCurrency->decimal_places,
|
||||
'account_currency_id' => (string) $currency->id,
|
||||
'account_currency_name' => $currency->name,
|
||||
'account_currency_code' => $currency->code,
|
||||
'account_currency_symbol' => $currency->symbol,
|
||||
'account_currency_decimal_places' => $currency->decimal_places,
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -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",
|
||||
@ -154,6 +160,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",
|
||||
|
@ -381,7 +381,7 @@ export default {
|
||||
this.totalPages = parseInt(response.data.meta.pagination.total_pages);
|
||||
this.loading = false;
|
||||
this.rates = Object.values(this.tempRates);
|
||||
console.log('Do not download more pages. Now on page ' + this.page + ' of ' + this.totalPages);
|
||||
// console.log('Do not download more pages. Now on page ' + this.page + ' of ' + this.totalPages);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -36,7 +36,6 @@
|
||||
class="form-control"
|
||||
data-role="input"
|
||||
type="text"
|
||||
v-on:keypress="handleEnter"
|
||||
v-on:submit.prevent>
|
||||
<span class="input-group-btn">
|
||||
<button
|
||||
@ -217,7 +216,7 @@ export default {
|
||||
}
|
||||
},
|
||||
selectedItem: function (e) {
|
||||
// console.log('In SelectedItem()');
|
||||
console.log('In SelectedItem()');
|
||||
if (typeof this.name === 'undefined') {
|
||||
// console.log('Is undefined');
|
||||
return;
|
||||
@ -239,12 +238,6 @@ export default {
|
||||
this.name = '';
|
||||
// some event?
|
||||
this.$emit('clear:value')
|
||||
},
|
||||
handleEnter: function (e) {
|
||||
// TODO feels sloppy. Can be removed.
|
||||
if (e.keyCode === 13) {
|
||||
//e.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -922,6 +922,12 @@ export default {
|
||||
allowed_types: this.transactions[index].source_account.allowed_types,
|
||||
default_allowed_types: ['Asset account', 'Revenue account', 'Loan', 'Debt', 'Mortgage']
|
||||
};
|
||||
if(model.hasOwnProperty('account_currency_id') && null !== model.account_currency_id) {
|
||||
this.transactions[index].source_account.currency_id = model.account_currency_id;
|
||||
this.transactions[index].source_account.currency_name = model.account_currency_name;
|
||||
this.transactions[index].source_account.currency_code = model.account_currency_code;
|
||||
this.transactions[index].source_account.currency_decimal_places = model.account_currency_decimal_places;
|
||||
}
|
||||
|
||||
// force types on destination selector.
|
||||
this.transactions[index].destination_account.allowed_types = window.allowedOpposingTypes.source[model.type];
|
||||
@ -946,6 +952,12 @@ export default {
|
||||
allowed_types: this.transactions[index].destination_account.allowed_types,
|
||||
default_allowed_types: ['Asset account', 'Expense account', 'Loan', 'Debt', 'Mortgage']
|
||||
};
|
||||
if(model.hasOwnProperty('account_currency_id') && null !== model.account_currency_id) {
|
||||
this.transactions[index].destination_account.currency_id = model.account_currency_id;
|
||||
this.transactions[index].destination_account.currency_name = model.account_currency_name;
|
||||
this.transactions[index].destination_account.currency_code = model.account_currency_code;
|
||||
this.transactions[index].destination_account.currency_decimal_places = model.account_currency_decimal_places;
|
||||
}
|
||||
|
||||
// force types on destination selector.
|
||||
this.transactions[index].source_account.allowed_types = window.allowedOpposingTypes.destination[model.type];
|
||||
|
@ -322,6 +322,12 @@ export default {
|
||||
currency_decimal_places: model.currency_decimal_places,
|
||||
allowed_types: this.transactions[index].source_account.allowed_types
|
||||
};
|
||||
if(model.hasOwnProperty('account_currency_id') && null !== model.account_currency_id) {
|
||||
this.transactions[index].source_account.currency_id = model.account_currency_id;
|
||||
this.transactions[index].source_account.currency_name = model.account_currency_name;
|
||||
this.transactions[index].source_account.currency_code = model.account_currency_code;
|
||||
this.transactions[index].source_account.currency_decimal_places = model.account_currency_decimal_places;
|
||||
}
|
||||
},
|
||||
selectedDestinationAccount(index, model) {
|
||||
if (typeof model === 'string') {
|
||||
@ -341,6 +347,12 @@ export default {
|
||||
currency_decimal_places: model.currency_decimal_places,
|
||||
allowed_types: this.transactions[index].destination_account.allowed_types
|
||||
};
|
||||
if(model.hasOwnProperty('account_currency_id') && null !== model.account_currency_id) {
|
||||
this.transactions[index].destination_account.currency_id = model.account_currency_id;
|
||||
this.transactions[index].destination_account.currency_name = model.account_currency_name;
|
||||
this.transactions[index].destination_account.currency_code = model.account_currency_code;
|
||||
this.transactions[index].destination_account.currency_decimal_places = model.account_currency_decimal_places;
|
||||
}
|
||||
},
|
||||
clearSource(index) {
|
||||
// reset source account:
|
||||
@ -528,6 +540,15 @@ export default {
|
||||
allowed_types: window.expectedSourceTypes.destination[this.ucFirst(transaction.type)]
|
||||
}
|
||||
};
|
||||
// if transaction type is transfer, the destination currency_id etc. MUST match the actual account currency info.
|
||||
if ('transfer' === transaction.type && null !== transaction.foreign_currency_code) {
|
||||
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) {
|
||||
result.foreign_amount.amount = '';
|
||||
}
|
||||
@ -801,10 +822,16 @@ export default {
|
||||
this.setDefaultErrors();
|
||||
// do message if update or new:
|
||||
if (this.storeAsNew) {
|
||||
this.success_message = this.$t('firefly.transaction_new_stored_link', {ID: groupId, title: this.escapeHtml(title)});
|
||||
this.success_message = this.$t('firefly.transaction_new_stored_link', {
|
||||
ID: groupId,
|
||||
title: this.escapeHtml(title)
|
||||
});
|
||||
this.error_message = '';
|
||||
} else {
|
||||
this.success_message = this.$t('firefly.transaction_updated_link', {ID: groupId, title: this.escapeHtml(title)});
|
||||
this.success_message = this.$t('firefly.transaction_updated_link', {
|
||||
ID: groupId,
|
||||
title: this.escapeHtml(title)
|
||||
});
|
||||
this.error_message = '';
|
||||
}
|
||||
} else {
|
||||
|
@ -42,7 +42,8 @@
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group">
|
||||
<input v-if="this.enabledCurrencies.length > 0" ref="amount" :placeholder="this.title" :title="this.title" :value="value.amount" autocomplete="off"
|
||||
<input v-if="this.enabledCurrencies.length > 0" ref="amount" :placeholder="this.title"
|
||||
:title="this.title" :value="value.amount" autocomplete="off"
|
||||
class="form-control" name="foreign_amount[]"
|
||||
step="any" type="number" @input="handleInput">
|
||||
<span class="input-group-btn">
|
||||
@ -67,15 +68,16 @@ export default {
|
||||
props: ['source', 'destination', 'transactionType', 'value', 'error', 'no_currency', 'title',],
|
||||
mounted() {
|
||||
this.liability = false;
|
||||
// console.log('I am mounted with a ' + this.transactionType + ' transaction type and currency id!');
|
||||
// console.log(this.value);
|
||||
this.loadCurrencies();
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currencies: [],
|
||||
enabledCurrencies: [],
|
||||
exclude: null,
|
||||
// liability overrules the drop down list if the source or dest is a liability
|
||||
// liability overrules the drop-down list if the source or dest is a liability
|
||||
liability: false
|
||||
}
|
||||
},
|
||||
@ -126,7 +128,7 @@ export default {
|
||||
|
||||
// console.log(srcType + ' (source) is a liability: ' + sourceIsLiability);
|
||||
// console.log(destType + ' (dest) is a liability: ' + destIsLiability);
|
||||
|
||||
// console.log('tType: ' + tType);
|
||||
if (tType === 'transfer' || destIsLiability || sourceIsLiability) {
|
||||
// console.log('Source is liability OR dest is liability, OR transfer. Lock list on currency of destination.');
|
||||
// console.log('Length of currencies is ' + this.currencies.length);
|
||||
@ -135,9 +137,13 @@ export default {
|
||||
// lock dropdown list on currencyID of destination.
|
||||
for (const key in this.currencies) {
|
||||
if (this.currencies.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) {
|
||||
// console.log('this.currencies[key].id = ' + this.currencies[key].id);
|
||||
// console.log('this.destination.currency_id = ' + this.destination.currency_id);
|
||||
if (parseInt(this.currencies[key].id) === parseInt(this.destination.currency_id)) {
|
||||
|
||||
if (
|
||||
parseInt(this.currencies[key].id) === parseInt(this.destination.currency_id)
|
||||
) {
|
||||
// console.log('Enable currency!!');
|
||||
// console.log(this.destination);
|
||||
// console.log(this.currencies[key]);
|
||||
this.enabledCurrencies.push(this.currencies[key]);
|
||||
}
|
||||
}
|
||||
@ -176,6 +182,7 @@ export default {
|
||||
}
|
||||
},
|
||||
loadCurrencies: function () {
|
||||
// console.log('loadCurrencies');
|
||||
// reset list of currencies:
|
||||
this.currencies = [
|
||||
{
|
||||
@ -200,7 +207,6 @@ export default {
|
||||
this.getCurrencies(1);
|
||||
},
|
||||
getCurrencies: function (page) {
|
||||
// console.log('loadCurrencies on page ' + page);
|
||||
let url = document.getElementsByTagName('base')[0].href + "api/v1/currencies?page=" + page;
|
||||
axios.get(url, {}).then((res) => {
|
||||
|
||||
@ -215,7 +221,9 @@ export default {
|
||||
}
|
||||
if (res.data.meta.pagination.current_page < res.data.meta.pagination.total_pages) {
|
||||
this.getCurrencies(res.data.meta.pagination.current_page + 1);
|
||||
return;
|
||||
}
|
||||
this.changeData();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user