-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Component: InventoryFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentProgress: PR CreatedIndicates that Pull Request has been created to fix issueIndicates that Pull Request has been created to fix issueReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
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
Component: InventoryFixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineThe issue has been fixed in 2.3 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentProgress: PR CreatedIndicates that Pull Request has been created to fix issueIndicates that Pull Request has been created to fix issueReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release