Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSI-1486: Create new infrastructure for StockItem Configuration #1553

Closed
wants to merge 72 commits into from

Conversation

seruymt
Copy link
Contributor

@seruymt seruymt commented Aug 10, 2018

@seruymt seruymt added the WIP label Aug 10, 2018
@seruymt seruymt added this to the MSI Part II milestone Aug 10, 2018
@seruymt seruymt self-assigned this Aug 10, 2018
->where('config_option = ?', $configOption)
->limit(1);

if (isset($stockId)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @seruymt, I don't understand why, when $stockId, $sourceCode, and $sku are set you add the IS NULL clause.
I may be wrong but shouldn't it be the opposite?
Or am I missing something?
Thank you

Copy link
Contributor Author

@seruymt seruymt Aug 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @aleron75, thanks for your comment. This is a way how we divide config option on scopes (Stock, StockItem, Source, SourceItem and Global). You can read more about it here - https://github.com/magento-engcom/msi/wiki/Inventory-configuration-Design-and-DB-structure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @seruymt I've read the document you pointed out. There, for example, I read:

To retrieve Source level configuration options we need to execute next query:
select * from inventory_configuration where source_code = %source_code% and sku is NULL and stock_id is NULL

as far as I understand by the example above, to retrieve a value at source level we only use the following match: source_code = %source_code%

so I still miss the point in committed code when, for example at line 61 of GetConfigurationValue class, if $sourceCode is set, we generate a $select->where('source_code IS NULL'); statement instead of a $select->where('source_code = ?', $sourceCode);

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aleron75 oh, it's my fault.. you're totally right.. (in previous version I've used "empty" instead of "isset"). I'll fix it, thanks:)

-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\InventoryAdminUi\Ui\DataProvider\StockDataProvider">
<plugin name="inventory_stock_configuration" type="Magento\InventoryConfigurationAdminUi\Plugin\InventoryAdminUi\Ui\StockDataProvider\StockConfigurationPlugin" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should choose plugin names that convey the idea of what they do; in this case what about using name="add_stock_configuration_data"?

<plugin name="inventory_stock_configuration" type="Magento\InventoryConfigurationAdminUi\Plugin\InventoryAdminUi\Ui\StockDataProvider\StockConfigurationPlugin" />
</type>
<type name="Magento\InventoryAdminUi\Ui\DataProvider\SourceDataProvider">
<plugin name="inventory_source_configuration" type="Magento\InventoryConfigurationAdminUi\Plugin\InventoryAdminUi\Ui\SourceDataProvider\SourceConfigurationPlugin" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should choose plugin names that convey the idea of what they do; in this case what about using name="add_source_configuration_data"?

*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_InventoryConfigurationAdminUi" setup_version="1.0.0"/>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to use the setup_version since we are using declarative schema definition

@seruymt
Copy link
Contributor Author

seruymt commented Aug 16, 2018

@aleron75 Also, this is just a prototype, we still work on it:) If you have any ideas how to improve interfaces or other parts of InventoryConfiguration feel free to share with us

@lorikrell
Copy link

I am working on documentation drafts for the new options, and have a question.

The custom Source and Stock pages and Product Advanced Options have checkboxes for Use Config Settings. Is this the default config options set on Source and Stock? Or the default System Configs set in Stores > Configuration > Catalog > Inventory? Or was this just a naming issue for the checkbox, and it should be Use system value?

image

@nmalevanec
Copy link
Contributor

@lorikrell, There are several layers of configuration.
Magento configuration consist of system values configuration(stored in system.xml and it's basically default magento configuration after install and cannot be changed from admin ui) and system configuration(stored in DB) and may be changed by admin user on magento configuration page.
So, if we check "use config settings" on Stock page configuration tab, it means Magento will fall back to system configuration to get the value. And if won't find value in DB("use system value" checked on configuration page for instance) will fall back to system value configuration, stored in different system.xml files.

So, the longest chain currently may be:
On Product Page "Advanced Inventory" panel for "Only X Left Threshold" field "use config settings" is checked.
Magento will fall back to corresponding stock configuration for given product.
If on Stock Page configuration tab for "Only X Left Threshold" field "use config settings" also is checked, magento will fall back to system configuration.
If on Configuration page for "Only X Left Threshold" field "use system value" is checked - value will be retrieved from system.xml file.

@lorikrell
Copy link

Thank you for the info, @nmalevanec! That's great info!

I understand the fall back relationship of Product setting > Source settings / Stock settings > System settings. The naming of the option was different than the setting everywhere else. Just wanted to make sure it was intended.

I'll add detailed info based on your feedback, and give a diagram to users for understanding it. And will update the docs with the checkbox name.

maghamed and others added 2 commits October 3, 2018 12:33
Wrong database isolation between tests or missing cleanups
maghamed and others added 9 commits October 4, 2018 06:19
MSI-1486: Create new infrastructure for StockItem Configuration (fix …
The applied settings were equivalent to default settings, so they are useless.
Isolation is not needed anymore in the modified tests and it is causing issues with DDL operations
@maghamed
Copy link
Contributor

maghamed commented Oct 6, 2018

@maghamed
Copy link
Contributor

maghamed commented Oct 8, 2018

@maghamed
Copy link
Contributor

maghamed commented Oct 9, 2018

tests on 2.3-develop for comparison https://m2build-ur.devops.magento.com/job/All-User-Requested-Tests/6340/

@magento-engcom-team magento-engcom-team deleted the MSI-1486 branch November 9, 2018 11:22
@maghamed maghamed restored the MSI-1486 branch November 14, 2018 07:51
@maghamed maghamed reopened this Nov 14, 2018
@aleron75
Copy link
Contributor

aleron75 commented Apr 6, 2019

@magento-engcom-team give me test instance

@maghamed maghamed modified the milestones: MSI Part III, MSI Part IV Apr 10, 2019
@okorshenko okorshenko removed this from the MSI Part IV milestone May 30, 2019
@aleron75 aleron75 mentioned this pull request Jun 4, 2019
4 tasks
@ishakhsuvarov
Copy link
Contributor

Unfortunately we have to close this PR now as it seems very outdated and in a state beyond repair. Another effort to implement the same feature is now happening in #2297

Thanks

@sidolov sidolov deleted the MSI-1486 branch February 20, 2020 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants