Only apply stock_auto_decimal_separator_prices when value is not empty and not already contains a decimal separator (fixes #1917)

This commit is contained in:
Bernd Bestel 2022-06-11 13:25:52 +02:00
parent 9498dd9c67
commit 2de87eb446
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -98,6 +98,11 @@ $(".numberpicker.locale-number-input.locale-number-currency").on("blur", functio
if (BoolVal(Grocy.UserSettings.stock_auto_decimal_separator_prices))
{
var value = this.value.toString();
if (value == null || value.isEmpty() || value.includes(".") || value.includes(","))
{
return;
}
var decimalPlaces = parseInt(Grocy.UserSettings.stock_decimal_places_prices_input);
if (value.length <= decimalPlaces)