Fixed zero decimals handling (fixes #1213)

This commit is contained in:
Bernd Bestel 2020-12-23 19:56:37 +01:00
parent bd185cfa32
commit 2e3c237648
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
24 changed files with 54 additions and 34 deletions

View File

@ -4,7 +4,7 @@
> >
> [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0 > [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0
> >
> _PHP 7.2 with SQLite 3.8.3 was the currently in [README mentioned](https://github.com/grocy/grocy#how-to-install) minimum runtime requirement, any future release will only be tested against a reasonable recent runtime (currently PHP 7.4 with SQLite 3.27.2) - supporting those (very) old runtime stuff is too time consuming..._ > _PHP 7.2 with SQLite 3.8.3 was the formerly in [README mentioned](https://github.com/grocy/grocy#how-to-install) minimum runtime requirement, any future release will only be tested against a reasonable recent runtime (currently PHP 7.4 with SQLite 3.27.2) - supporting those (very) old runtime stuff is too time consuming..._
> ❗ If some pages/tables doesn't load at all, please check that your `/data/config.php` setting `CURRENCY` is a valid ISO 4217 currency code - that's most probably the issue then. > ❗ If some pages/tables doesn't load at all, please check that your `/data/config.php` setting `CURRENCY` is a valid ISO 4217 currency code - that's most probably the issue then.

View File

@ -2,10 +2,11 @@
> >
> [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0 > [Here](https://github.com/grocy/grocy/issues/1209#issuecomment-749760765) is a workaround if you still run a SQLite version >= 3.8.3 < 3.9.0
> >
> _PHP 7.2 with SQLite 3.8.3 was the currently in [README mentioned](https://github.com/grocy/grocy#how-to-install) minimum runtime requirement, any future release will only be tested against a reasonable recent runtime (currently PHP 7.4 with SQLite 3.27.2) - supporting those (very) old runtime stuff is too time consuming..._ > _PHP 7.2 with SQLite 3.8.3 was the formerly in [README mentioned](https://github.com/grocy/grocy#how-to-install) minimum runtime requirement, any future release will only be tested against a reasonable recent runtime (currently PHP 7.4 with SQLite 3.27.2) - supporting those (very) old runtime stuff is too time consuming..._
- Improved the prerequisites checker (added missing required PHP extension `ctype`) (thanks @Forceu) - Improved the prerequisites checker (added missing required PHP extension `ctype`) (thanks @Forceu)
- Added validation checks for most `data/config.php` settings to prevent using invalid ones (thanks @Forceu) - Added validation checks for most `data/config.php` settings to prevent using invalid ones (thanks @Forceu)
- Fixed that browser camera barcode scanning did not work on the product edit page - Fixed that some number inputs were broken when the new decimal places setting were set to `0`
- Fixed that browser camera barcode scanning did not work on the product edit page for adding product barcodes
- Fixed that the new product option "Never show on stock overview" was unintentionally set by default for new products - Fixed that the new product option "Never show on stock overview" was unintentionally set by default for new products
- Fixed that the success message on purchase displayed not amount when `FEATURE_FLAG_STOCK_PRICE_TRACKING` was disabled - Fixed that the success message on purchase displayed no amount when `FEATURE_FLAG_STOCK_PRICE_TRACKING` was disabled

View File

@ -159,6 +159,17 @@ class BaseController
$this->View->set('permissions', User::PermissionList()); $this->View->set('permissions', User::PermissionList());
} }
$decimalPlacesAmounts = intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts'));
if ($decimalPlacesAmounts <= 0)
{
$defaultMinAmount = 1;
}
else
{
$defaultMinAmount = '0.' . str_repeat('0', $decimalPlacesAmounts - 1) . '1';
}
$this->View->set('DEFAULT_MIN_AMOUNT', $defaultMinAmount);
return $this->View->render($response, $page, $data); return $this->View->render($response, $page, $data);
} }
@ -168,7 +179,6 @@ class BaseController
try try
{ {
$usersService = $this->getUsersService(); $usersService = $this->getUsersService();
if (defined('GROCY_USER_ID')) if (defined('GROCY_USER_ID'))
{ {
$this->View->set('userSettings', $usersService->GetUserSettings(GROCY_USER_ID)); $this->View->set('userSettings', $usersService->GetUserSettings(GROCY_USER_ID));

View File

@ -92,7 +92,7 @@
Grocy.Components.ProductPicker.FinishFlow(); Grocy.Components.ProductPicker.FinishFlow();
Grocy.Components.ProductAmountPicker.Reset(); Grocy.Components.ProductAmountPicker.Reset();
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", Grocy.DefaultMinAmount);
$("#display_amount").removeAttr("max"); $("#display_amount").removeAttr("max");
if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount)) if (BoolVal(Grocy.UserSettings.stock_default_consume_amount_use_quick_consume_amount))
{ {
@ -366,7 +366,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
} }
else else
{ {
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", Grocy.DefaultMinAmount);
$("#tare-weight-handling-info").addClass("d-none"); $("#tare-weight-handling-info").addClass("d-none");
} }
@ -598,7 +598,7 @@ function RefreshForm()
{ {
$("#tare-weight-handling-info").addClass("d-none"); $("#tare-weight-handling-info").addClass("d-none");
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", Grocy.DefaultMinAmount);
$('#display_amount').attr('max', sumValue * $("#qu_id option:selected").attr("data-qu-factor")); $('#display_amount').attr('max', sumValue * $("#qu_id option:selected").attr("data-qu-factor"));
if (sumValue == 0) if (sumValue == 0)

View File

@ -144,7 +144,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
} }
else else
{ {
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", "0");
$("#tare-weight-handling-info").addClass("d-none"); $("#tare-weight-handling-info").addClass("d-none");
} }
@ -346,3 +346,5 @@ function UndoStockTransaction(transactionId)
} }
); );
}; };
$("#display_amount").attr("min", "0");

View File

@ -130,7 +130,7 @@ $('#save-purchase-button').on('click', function(e)
Grocy.Components.ProductAmountPicker.Reset(); Grocy.Components.ProductAmountPicker.Reset();
$("#purchase-form").removeAttr("data-used-barcode"); $("#purchase-form").removeAttr("data-used-barcode");
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", Grocy.DefaultMinAmount);
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount)); $('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_purchase_amount));
$(".input-group-productamountpicker").trigger("change"); $(".input-group-productamountpicker").trigger("change");
$('#price').val(''); $('#price').val('');
@ -247,7 +247,7 @@ if (Grocy.Components.ProductPicker !== undefined)
} }
else else
{ {
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", Grocy.DefaultMinAmount);
$("#tare-weight-handling-info").addClass("d-none"); $("#tare-weight-handling-info").addClass("d-none");
} }

View File

@ -140,7 +140,7 @@ $("#only_check_single_unit_in_stock").on("change", function()
{ {
if (this.checked) if (this.checked)
{ {
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", Grocy.DefaultMinAmount);
Grocy.Components.ProductAmountPicker.AllowAnyQu(true); Grocy.Components.ProductAmountPicker.AllowAnyQu(true);
Grocy.FrontendHelpers.ValidateForm("recipe-pos-form"); Grocy.FrontendHelpers.ValidateForm("recipe-pos-form");
} }

View File

@ -89,7 +89,7 @@
Grocy.Components.ProductAmountPicker.Reset(); Grocy.Components.ProductAmountPicker.Reset();
$("#location_id_from").find("option").remove().end().append("<option></option>"); $("#location_id_from").find("option").remove().end().append("<option></option>");
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", Grocy.DefaultMinAmount);
$("#display_amount").removeAttr("max"); $("#display_amount").removeAttr("max");
$('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount)); $('#display_amount').val(parseFloat(Grocy.UserSettings.stock_default_transfer_amount));
RefreshLocaleNumberInput(); RefreshLocaleNumberInput();
@ -194,7 +194,7 @@ Grocy.Components.ProductPicker.GetPicker().on('change', function(e)
} }
else else
{ {
$("#display_amount").attr("min", "0." + "0".repeat(parseInt(Grocy.UserSettings.stock_decimal_places_amounts) - 1) + "1"); $("#display_amount").attr("min", Grocy.DefaultMinAmount);
$("#tare-weight-handling-info").addClass("d-none"); $("#tare-weight-handling-info").addClass("d-none");
} }

View File

@ -921,9 +921,9 @@ class StockService extends BaseService
//If no entry was found with for this product, we return gracefully //If no entry was found with for this product, we return gracefully
if ($productRow != null && !empty($productRow)) if ($productRow != null && !empty($productRow))
{ {
$decimals = intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts'));
$newAmount = $productRow->amount - $amount; $newAmount = $productRow->amount - $amount;
if ($newAmount < floatval('0.' . str_repeat('0', $decimals - ($decimals <= 0 ? 0 : 1)) . '1'))
if ($newAmount < floatval('0.' . str_repeat('0', intval($this->getUsersService()->GetUserSetting(GROCY_USER_ID, 'stock_decimal_places_amounts')) - 1) . '1'))
{ {
$productRow->delete(); $productRow->delete();
} }

View File

@ -267,7 +267,7 @@
'id' => 'product_amount', 'id' => 'product_amount',
'label' => 'Amount', 'label' => 'Amount',
'contextInfoId' => 'amount_qu_unit', 'contextInfoId' => 'amount_qu_unit',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'isRequired' => false, 'isRequired' => false,
'value' => $value, 'value' => $value,

View File

@ -50,7 +50,7 @@
@if(!empty($max)) @if(!empty($max))
max="{{ number_format($max, $decimals, '.', '') }}" max="{{ number_format($max, $decimals, '.', '') }}"
@endif @endif
step="@if($decimals == 0){{1}}@else{{'.' . str_repeat('0', $decimals - 1) . '1'}}@endif" step="@if($decimals <= 0){{1}}@else{{'.' . str_repeat('0', $decimals - 1) . '1'}}@endif"
data-decimals="{{ $decimals }}" data-decimals="{{ $decimals }}"
@if($isRequired) @if($isRequired)
required required

View File

@ -18,7 +18,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'display_amount', 'id' => 'display_amount',
'label' => $label, 'label' => $label,
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $value, 'value' => $value,
'additionalGroupCssClasses' => 'col-sm-5 col-xs-12 my-0', 'additionalGroupCssClasses' => 'col-sm-5 col-xs-12 my-0',

View File

@ -12,6 +12,7 @@
<script> <script>
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!}; Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!}; Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
Grocy.DefaultMinAmount = '{{$DEFAULT_MIN_AMOUNT}}';
</script> </script>
<div class="row"> <div class="row">

View File

@ -8,6 +8,7 @@
<script> <script>
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!}; Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!}; Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
Grocy.DefaultMinAmount = '{{$DEFAULT_MIN_AMOUNT}}';
</script> </script>
<div class="row"> <div class="row">
@ -81,7 +82,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'price', 'id' => 'price',
'label' => 'Price', 'label' => 'Price',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_prices']),
'decimals' => $userSettings['stock_decimal_places_prices'], 'decimals' => $userSettings['stock_decimal_places_prices'],
'value' => '', 'value' => '',
'hint' => $__t('Per stock quantity unit', GROCY_CURRENCY), 'hint' => $__t('Per stock quantity unit', GROCY_CURRENCY),

View File

@ -62,7 +62,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'recipe_servings', 'id' => 'recipe_servings',
'label' => 'Servings', 'label' => 'Servings',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => '1', 'value' => '1',
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount' 'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'

View File

@ -287,7 +287,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'qu_factor_purchase_to_stock', 'id' => 'qu_factor_purchase_to_stock',
'label' => 'Factor purchase to stock quantity unit', 'label' => 'Factor purchase to stock quantity unit',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $value, 'value' => $value,
'additionalCssClasses' => 'input-group-qu locale-number-input locale-number-quantity-amount', 'additionalCssClasses' => 'input-group-qu locale-number-input locale-number-quantity-amount',
@ -314,7 +314,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'tare_weight', 'id' => 'tare_weight',
'label' => 'Tare weight', 'label' => 'Tare weight',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $value, 'value' => $value,
'additionalAttributes' => $additionalAttributes, 'additionalAttributes' => $additionalAttributes,
@ -387,7 +387,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'quick_consume_amount', 'id' => 'quick_consume_amount',
'label' => 'Quick consume amount', 'label' => 'Quick consume amount',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $value, 'value' => $value,
'hint' => $__t('This amount is used for the "quick consume/open buttons" on the stock overview page (related to quantity unit stock)'), 'hint' => $__t('This amount is used for the "quick consume/open buttons" on the stock overview page (related to quantity unit stock)'),

View File

@ -12,6 +12,7 @@
<script> <script>
Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!}; Grocy.QuantityUnits = {!! json_encode($quantityUnits) !!};
Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!}; Grocy.QuantityUnitConversionsResolved = {!! json_encode($quantityUnitConversionsResolved) !!};
Grocy.DefaultMinAmount = '{{$DEFAULT_MIN_AMOUNT}}';
</script> </script>
<div class="row"> <div class="row">
@ -101,7 +102,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'price', 'id' => 'price',
'label' => 'Price', 'label' => 'Price',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_prices'] - 1) . '1', 'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_prices']),
'decimals' => $userSettings['stock_decimal_places_prices'], 'decimals' => $userSettings['stock_decimal_places_prices'],
'value' => '', 'value' => '',
'contextInfoId' => 'price-hint', 'contextInfoId' => 'price-hint',

View File

@ -85,7 +85,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'factor', 'id' => 'factor',
'label' => 'Factor', 'label' => 'Factor',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $value, 'value' => $value,
'additionalHtmlElements' => '<p id="qu-conversion-info" 'additionalHtmlElements' => '<p id="qu-conversion-info"

View File

@ -40,7 +40,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'amount', 'id' => 'amount',
'label' => 'Amount', 'label' => 'Amount',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => 0,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'isRequired' => false, 'isRequired' => false,
'value' => 1, 'value' => 1,

View File

@ -55,7 +55,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'base_servings', 'id' => 'base_servings',
'label' => 'Servings', 'label' => 'Servings',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $value, 'value' => $value,
'hint' => $__t('The ingredients listed here result in this amount of servings'), 'hint' => $__t('The ingredients listed here result in this amount of servings'),
@ -351,7 +351,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'includes_servings', 'id' => 'includes_servings',
'label' => 'Servings', 'label' => 'Servings',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => '1', 'value' => '1',
'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount' 'additionalCssClasses' => 'locale-number-input locale-number-quantity-amount'

View File

@ -9,6 +9,10 @@
@section('viewJsName', 'recipeposform') @section('viewJsName', 'recipeposform')
@section('content') @section('content')
<script>
Grocy.DefaultMinAmount = '{{$DEFAULT_MIN_AMOUNT}}';
</script>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<div class="title-related-links"> <div class="title-related-links">
@ -111,7 +115,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'price_factor', 'id' => 'price_factor',
'label' => 'Price factor', 'label' => 'Price factor',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => '', 'value' => '',
'hint' => $__t('The resulting price of this ingredient will be multiplied by this factor'), 'hint' => $__t('The resulting price of this ingredient will be multiplied by this factor'),

View File

@ -330,7 +330,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'servings-scale', 'id' => 'servings-scale',
'label' => 'Desired servings', 'label' => 'Desired servings',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'value' => $recipe->desired_servings, 'value' => $recipe->desired_servings,
'additionalAttributes' => 'data-recipe-id="' . $recipe->id . '"', 'additionalAttributes' => 'data-recipe-id="' . $recipe->id . '"',

View File

@ -72,7 +72,7 @@
@include('components.productamountpicker', array( @include('components.productamountpicker', array(
'value' => $value, 'value' => $value,
'initialQuId' => $initialQuId, 'initialQuId' => $initialQuId,
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'isRequired' => false 'isRequired' => false
)) ))

View File

@ -56,7 +56,7 @@
@include('components.numberpicker', array( @include('components.numberpicker', array(
'id' => 'amount', 'id' => 'amount',
'value' => $stockEntry->amount, 'value' => $stockEntry->amount,
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_amounts'] - 1) . '1', 'min' => $DEFAULT_MIN_AMOUNT,
'decimals' => $userSettings['stock_decimal_places_amounts'], 'decimals' => $userSettings['stock_decimal_places_amounts'],
'label' => 'Amount', 'label' => 'Amount',
'contextInfoId' => 'amount_qu_unit', 'contextInfoId' => 'amount_qu_unit',
@ -78,7 +78,7 @@
'id' => 'price', 'id' => 'price',
'value' => $price, 'value' => $price,
'label' => 'Price', 'label' => 'Price',
'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_prices'] - 1) . '1', 'min' => '0.' . str_repeat('0', $userSettings['stock_decimal_places_prices']),
'decimals' => $userSettings['stock_decimal_places_prices'], 'decimals' => $userSettings['stock_decimal_places_prices'],
'hint' => $__t('Per stock quantity unit'), 'hint' => $__t('Per stock quantity unit'),
'isRequired' => false, 'isRequired' => false,