Skip to content

Commit b9e66e4

Browse files
author
Stanislav Idolov
committed
Merge remote-tracking branch 'origin/1.1.5-develop' into sync_1.1-develop_with_1.1.5-develop
2 parents 4e0f152 + fe4aab0 commit b9e66e4

12 files changed

+122
-248
lines changed

InventoryAdminUi/Test/Mftf/Test/ElasticSearchLayeredNavigationCustomStockTest.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<severity value="CRITICAL"/>
1717
<group value="msi"/>
1818
<group value="multi_mode"/>
19+
<group value="SearchEngineElasticsearch"/>
1920
</annotations>
2021

2122
<before>
@@ -95,8 +96,6 @@
9596
<deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/>
9697
<deleteData createDataKey="customStock" stepKey="deleteCustomStock"/>
9798

98-
<!--Revert ElasticSearch as search engine.-->
99-
<actionGroup ref="ResetSearchEngineConfigurationActionGroup" stepKey="resetCatalogSearchConfiguration"/>
10099
<magentoCLI command="indexer:reindex" stepKey="performReindexAfterElasticSearchDisable"/>
101100
<magentoCLI command="cache:flush" stepKey="cleanCacheAfterElasticSearchDisable"/>
102101
<actionGroup ref="logout" stepKey="logoutOfAdmin1"/>

InventoryAdminUi/Test/Mftf/Test/ElasticSearchLayeredNavigationTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
<severity value="CRITICAL"/>
1717
<group value="msi"/>
1818
<group value="multi_mode"/>
19+
<group value="SearchEngineElasticsearch"/>
1920
</annotations>
20-
21+
2122
<before>
2223
<!-- Assign Main Website to Default Stock -->
2324
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
@@ -62,8 +63,7 @@
6263
<deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/>
6364
<deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/>
6465
<deleteData createDataKey="simpleCategory" stepKey="deleteCategory"/>
65-
<!--Revert ElasticSearch as search engine.-->
66-
<actionGroup ref="ResetSearchEngineConfigurationActionGroup" stepKey="resetCatalogSearchConfiguration"/>
66+
6767
<magentoCLI command="indexer:reindex" stepKey="performReindexAfterElasticSearchDisable"/>
6868
<magentoCLI command="cache:flush" stepKey="cleanCacheAfterElasticSearchDisable"/>
6969
<actionGroup ref="logout" stepKey="logoutOfAdmin1"/>

InventoryAdminUi/Test/Mftf/Test/ElasticSearchQuickAdvancedSearchAdditionalStockProductTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
<severity value="CRITICAL"/>
1717
<group value="msi"/>
1818
<group value="multi_mode"/>
19+
<group value="SearchEngineElasticsearch"/>
1920
</annotations>
20-
21+
2122
<before>
2223
<!--Create Simple Products.-->
2324
<createData entity="SimpleSubCategory" stepKey="simpleCategory"/>
@@ -75,8 +76,7 @@
7576
<deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/>
7677
<deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/>
7778
<deleteData createDataKey="simpleCategory" stepKey="deleteCategory"/>
78-
<!--Revert ElasticSearch as search engine.-->
79-
<actionGroup ref="ResetSearchEngineConfigurationActionGroup" stepKey="resetCatalogSearchConfiguration"/>
79+
8080
<magentoCLI command="indexer:reindex" stepKey="performReindexAfterElasticSearchDisable"/>
8181
<magentoCLI command="cache:flush" stepKey="cleanCacheAfterElasticSearchDisable"/>
8282
<actionGroup ref="logout" stepKey="logoutOfAdmin1"/>

InventoryAdminUi/Test/Mftf/Test/ElasticSearchQuickAdvancedSearchDefaultStockProductTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
<severity value="CRITICAL"/>
1717
<group value="msi"/>
1818
<group value="multi_mode"/>
19+
<group value="SearchEngineElasticsearch"/>
1920
</annotations>
20-
21+
2122
<before>
2223
<!-- Assign Main Website to Default Stock -->
2324
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
@@ -62,8 +63,7 @@
6263
<deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/>
6364
<deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/>
6465
<deleteData createDataKey="simpleCategory" stepKey="deleteCategory"/>
65-
<!--Revert ElasticSearch as search engine.-->
66-
<actionGroup ref="ResetSearchEngineConfigurationActionGroup" stepKey="resetCatalogSearchConfiguration"/>
66+
6767
<magentoCLI command="indexer:reindex" stepKey="performReindexAfterElasticSearchDisable"/>
6868
<magentoCLI command="cache:flush" stepKey="cleanCacheAfterElasticSearchDisable"/>
6969
<actionGroup ref="logout" stepKey="logoutOfAdmin1"/>

InventorySales/Model/AreProductsSalableForRequestedQty.php

Lines changed: 0 additions & 72 deletions
This file was deleted.

InventorySales/Model/AreProductsSalableForRequestedQty/ProductsSalableResult.php

Lines changed: 0 additions & 59 deletions
This file was deleted.

InventorySales/Model/CheckItemsQuantity.php

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,43 @@
77

88
namespace Magento\InventorySales\Model;
99

10-
use Magento\Framework\App\ObjectManager;
1110
use Magento\Framework\Exception\LocalizedException;
12-
use Magento\InventorySalesApi\Api\AreProductsSalableForRequestedQtyInterface;
13-
use Magento\InventorySalesApi\Api\Data\ProductSalabilityErrorInterface;
1411
use Magento\InventorySalesApi\Api\IsProductSalableForRequestedQtyInterface;
12+
use Magento\InventorySalesApi\Api\Data\ProductSalableResultInterface;
13+
use Magento\InventorySalesApi\Api\Data\ProductSalabilityErrorInterface;
1514

1615
/**
1716
* Verify items are salable for requested quantity.
1817
*/
1918
class CheckItemsQuantity
2019
{
2120
/**
22-
* @var AreProductsSalableForRequestedQtyInterface
21+
* @var IsProductSalableForRequestedQtyInterface
2322
*/
24-
private $areProductsSalableForRequestedQty;
23+
private $isProductSalableForRequestedQty;
2524

2625
/**
27-
* @param IsProductSalableForRequestedQtyInterface $isProductSalableForRequestedQty @deprecated
28-
* @param AreProductsSalableForRequestedQtyInterface $areProductsSalableForRequestedQty
26+
* @param IsProductSalableForRequestedQtyInterface $isProductSalableForRequestedQty
2927
*/
3028
public function __construct(
31-
IsProductSalableForRequestedQtyInterface $isProductSalableForRequestedQty,
32-
AreProductsSalableForRequestedQtyInterface $areProductsSalableForRequestedQty = null
29+
IsProductSalableForRequestedQtyInterface $isProductSalableForRequestedQty
3330
) {
34-
$this->areProductsSalableForRequestedQty = $areProductsSalableForRequestedQty ?: ObjectManager::getInstance()
35-
->get(AreProductsSalableForRequestedQtyInterface::class);
31+
$this->isProductSalableForRequestedQty = $isProductSalableForRequestedQty;
3632
}
3733

3834
/**
3935
* Check whether all items salable
4036
*
41-
* @param array $items ['sku' => 'qty', ...]
37+
* @param array $items [['sku' => 'qty'], ...]
4238
* @param int $stockId
4339
* @return void
4440
* @throws LocalizedException
4541
*/
4642
public function execute(array $items, int $stockId): void
4743
{
48-
$result = $this->areProductsSalableForRequestedQty->execute($items, $stockId);
49-
foreach ($result->getSalable() as $isSalable) {
44+
foreach ($items as $sku => $qty) {
45+
/** @var ProductSalableResultInterface $isSalable */
46+
$isSalable = $this->isProductSalableForRequestedQty->execute((string)$sku, $stockId, (float)$qty);
5047
if (false === $isSalable->isSalable()) {
5148
$errors = $isSalable->getErrors();
5249
/** @var ProductSalabilityErrorInterface $errorMessage */

InventorySales/etc/di.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@
8080
</type>
8181
<!-- IsProductSalableForRequestedQtyCondition -->
8282
<preference for="Magento\InventorySalesApi\Api\IsProductSalableForRequestedQtyInterface" type="IsProductSalableForRequestedQtyConditionChainOnAddToCart"/>
83-
<!-- AreProductsSalableForRequestedQtyCondition -->
84-
<preference for="Magento\InventorySalesApi\Api\AreProductsSalableForRequestedQtyInterface" type="Magento\InventorySales\Model\AreProductsSalableForRequestedQty"/>
8583
<!-- IsProductSalableForRequestedQtyConditionOnAddToCart -->
8684
<virtualType name="IsProductSalableForRequestedQtyConditionChainOnAddToCart" type="Magento\InventorySales\Model\IsProductSalableForRequestedQtyCondition\IsProductSalableForRequestedQtyConditionChain">
8785
<arguments>
@@ -132,7 +130,7 @@
132130
</argument>
133131
</arguments>
134132
</virtualType>
135-
<type name="Magento\InventorySales\Model\AreProductsSalableForRequestedQty">
133+
<type name="Magento\InventorySales\Model\CheckItemsQuantity">
136134
<arguments>
137135
<argument name="isProductSalableForRequestedQty" xsi:type="object">IsProductSalableForRequestedQtyConditionChainOnPlaceOrder</argument>
138136
</arguments>
@@ -184,5 +182,4 @@
184182
<plugin name="process_reservations_after_product_save" type="Magento\InventorySales\Plugin\Catalog\Model\ResourceModel\Product\UpdateReservationsPlugin"/>
185183
<plugin name="delete_reservations" type="Magento\InventorySales\Plugin\Catalog\Model\ResourceModel\Product\DeleteReservationsPlugin"/>
186184
</type>
187-
<preference for="Magento\InventorySalesApi\Api\Data\ProductsSalableResultInterface" type="Magento\InventorySales\Model\AreProductsSalableForRequestedQty\ProductsSalableResult"/>
188185
</config>

InventorySalesApi/Api/AreProductsSalableForRequestedQtyInterface.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

InventorySalesApi/Api/Data/ProductsSalableResultInterface.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)