mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 16:24:25 +08:00
fix transaction amount overflow bug
This commit is contained in:
@@ -251,11 +251,21 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (sourceAccount && destinationAccount && sourceAccount.currency !== destinationAccount.currency) {
|
if (sourceAccount && destinationAccount && sourceAccount.currency !== destinationAccount.currency) {
|
||||||
oldValue = Math.floor(this.$exchangeRates.getOtherCurrencyAmount(oldValue, sourceAccount.currency, destinationAccount.currency));
|
const exchangedOldValue = this.$exchangeRates.getOtherCurrencyAmount(oldValue, sourceAccount.currency, destinationAccount.currency);
|
||||||
newValue = Math.floor(this.$exchangeRates.getOtherCurrencyAmount(newValue, sourceAccount.currency, destinationAccount.currency));
|
const exchangedNewValue = this.$exchangeRates.getOtherCurrencyAmount(newValue, sourceAccount.currency, destinationAccount.currency);
|
||||||
|
|
||||||
|
if (this.$utilities.isNumber(exchangedOldValue)) {
|
||||||
|
oldValue = Math.floor(exchangedOldValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.$utilities.isNumber(exchangedNewValue)) {
|
||||||
|
newValue = Math.floor(exchangedNewValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sourceAccount || !destinationAccount || this.transaction.destinationAmount === oldValue) {
|
if ((!sourceAccount || !destinationAccount || this.transaction.destinationAmount === oldValue) &&
|
||||||
|
(this.$utilities.stringCurrencyToNumeric(this.$constants.transaction.minAmount) <= newValue &&
|
||||||
|
newValue <= this.$utilities.stringCurrencyToNumeric(this.$constants.transaction.maxAmount))) {
|
||||||
this.transaction.destinationAmount = newValue;
|
this.transaction.destinationAmount = newValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user