Closed
Description
Preconditions (*)
- Install Magento Open Source 2.3.1
Steps to reproduce (*)
- Go to admin area
- Go to Stores->Configuration->Catalog->Inventory->Product Stock Options
- Edit the global default to be 0
- Save the config
- Open create a simple product form and fill in minimum required data
- Open the advanced inventory popup
- Uncheck the checkbox "use_config_max_sale_qty"
- Observe the default value of 0 in max_sale_qty field
- Do not edit the default provided
- Click Save
Expected result (*)
- Product is successfully saved
Actual result (*)
- Save is not happening, validation is failed due to validate-grater-then-0 on max_sale_qty field.
This value however comes from the cataloginventory's db_schema (module-catalog-inventory/etc/db_schema.xml):
<table name="cataloginventory_stock_item" resource="default" engine="innodb" comment="Cataloginventory Stock Item">
...
<column xsi:type="decimal" name="max_sale_qty" scale="4" precision="12" unsigned="false" **nullable="false"
default="0"** comment="Max Sale Qty"/>
...
</table>
While in the same module, in magento/module-catalog-inventory/view/adminhtml/ui_component/product_form.xml:
<field name="max_sale_qty" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="value" xsi:type="object">Magento\CatalogInventory\Model\Source\StockConfiguration</item>
</item>
</argument>
<settings>
<scopeLabel>[GLOBAL]</scopeLabel>
<validation>
<rule name="**validate-greater-than-zero**" xsi:type="boolean">true</rule>
</validation>
<label translate="true">Maximum Qty Allowed in Shopping Cart</label>
<dataScope>max_sale_qty</dataScope>
</settings>
</field>
And in the same module, inmodule-catalog-inventory/etc/adminhtml/system.xml:
<section id="cataloginventory" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
...
<group id="item_options" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
...
<field id="max_sale_qty" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1">
<label>Maximum Qty Allowed in Shopping Cart</label>
<validate>**validate-number**</validate>
</field>
So, there is inconsistency - if 0 is allowed as value for max_sale_qty. If 0 is set from the start as default, there shouldn't be validation that would forbid it on the frontend.
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.2 release lineThe issue has been fixed in 2.3 release lineGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 1 Passed. Automatic verification of issue format passedGate 4. Acknowledged. Issue is added to backlog and ready for developmentIndicates that Pull Request has been created to fix issueThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.3 release