diff --git a/assets/src/js/functions/numbers.js b/assets/src/js/functions/numbers.js
index 2a9cf0a36..e0def09c1 100644
--- a/assets/src/js/functions/numbers.js
+++ b/assets/src/js/functions/numbers.js
@@ -2,8 +2,8 @@ function initNumbers() {
$('.decimal-number').not('.bound').each(function () {
let $this = $(this);
- let min = $this.attr('min-value') && $this.attr('min-value') !== "undefined" ? $this.attr('min-value') : "-10000000000000";
- let max = $this.attr('max-value') && $this.attr('max-value') !== "undefined" ? $this.attr('max-value') : "10000000000000";
+ let min = $this.attr('min-value') && $this.attr('min-value') !== "undefined" ? $this.attr('min-value') : null;
+ let max = $this.attr('max-value') && $this.attr('max-value') !== "undefined" ? $this.attr('max-value') : null;
let decimals = $this.attr('decimals') ? $this.attr('decimals') : globals.cifre_decimali;
@@ -15,13 +15,14 @@ function initNumbers() {
decimalCharacter: globals.decimals,
decimalCharacterAlternative: ".",
digitGroupSeparator: globals.thousands,
- emptyInputBehavior: "zero",
+ emptyInputBehavior: min ? min : "zero",
+ overrideMinMaxLimits: "ignore",
modifyValueOnWheel: false,
outputFormat: "string",
unformatOnSubmit: true,
watchExternalChanges: true,
- minimumValue: min,
- maximumValue: max,
+ minimumValue: min ? min : "-10000000000000",
+ maximumValue: max ? max : "10000000000000",
decimalPlaces: decimals,
});
diff --git a/include/common/riga.php b/include/common/riga.php
index 607b0cef4..786019cb3 100755
--- a/include/common/riga.php
+++ b/include/common/riga.php
@@ -33,7 +33,7 @@ echo '
// Quantità
echo '
- {[ "type": "number", "label": "'.tr('Q.tà').'", "name": "qta", "required": 1, "value": "'.$result['qta'].'", "decimals": "qta"'.(isset($result['max_qta']) ? ', "icon-after": "/ '.numberFormat($result['max_qta'], 'qta').' "' : '').', "min-value": "'.Translator::numberToLocale($result['qta_evasa']).'" ]}
+ {[ "type": "number", "label": "'.tr('Q.tà').'", "name": "qta", "required": 1, "value": "'.$result['qta'].'", "decimals": "qta"'.(isset($result['max_qta']) ? ', "icon-after": "/ '.numberFormat($result['max_qta'], 'qta').' "' : '').', "min-value": "'.$result['qta_evasa'].'" ]}
';
// Unità di misura
diff --git a/src/HTMLBuilder/Handler/DefaultHandler.php b/src/HTMLBuilder/Handler/DefaultHandler.php
index 39fd21ac8..a6639de5e 100755
--- a/src/HTMLBuilder/Handler/DefaultHandler.php
+++ b/src/HTMLBuilder/Handler/DefaultHandler.php
@@ -245,20 +245,16 @@ class DefaultHandler implements HandlerInterface
if (is_numeric($values['decimals'])) {
$decimals = $values['decimals'];
} elseif (starts_with($values['decimals'], 'qta')) {
- // Se non è previsto un valore minimo, lo imposta a 1
- $values['min-value'] = isset($values['min-value']) ? $values['min-value'] : 0;
-
$decimals = setting('Cifre decimali per quantità');
$values['decimals'] = $decimals;
+
+ // Se non è previsto un valore minimo, lo imposta a 1
+ $values['min-value'] = isset($values['min-value']) ? $values['min-value'] : '0.'.str_repeat('0', $decimals - 1).'1';
}
}
-
- // Controllo sulla correttezza sintattica del valore impostato
- $values['value'] = (formatter()->isStandardNumber($values['value'])) ? \Translator::numberToLocale($values['value'], $decimals) : $values['value'];
-
- $values['type'] = 'text';
-
+
// Delega al metodo "text", per la generazione del codice HTML
+ $values['type'] = 'text';
return $this->text($values, $extras);
}