Skip to content

Commit 53865cc

Browse files
committed
ACP2E-3392: Broken validation for “Maximum Qty Allowed in Shopping Cart”
- Initial solution without test
1 parent 651928c commit 53865cc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
<scopeLabel>[GLOBAL]</scopeLabel>
294294
<validation>
295295
<rule name="validate-number" xsi:type="boolean">true</rule>
296-
<rule name="validate-greater-than-zero" xsi:type="boolean">true</rule>
296+
<rule name="validate-nonempty-number-greater-than-zero" xsi:type="boolean">true</rule>
297297
</validation>
298298
<label translate="true">Maximum Qty Allowed in Shopping Cart</label>
299299
<dataScope>max_sale_qty</dataScope>

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,13 @@ define([
626626
},
627627
$.mage.__('Please enter a number greater than 0, without comma in this field.')
628628
],
629+
'validate-nonempty-number-greater-than-zero': [
630+
function (value) {
631+
return !isNaN(utils.parseNumber(value))
632+
&& value > 0 && (/^\s*-?\d+([,.]\d+)*\s*%?\s*$/).test(value);
633+
},
634+
$.mage.__('Please enter a number greater than 0, without comma in this field.')
635+
],
629636
'validate-css-length': [
630637
function (value) {
631638
if (value !== '') {

0 commit comments

Comments
 (0)