Skip to content

Commit cf9877d

Browse files
committed
Merge branch 'develop' into pre-release-sync
2 parents e708f7a + 1b9a283 commit cf9877d

File tree

158 files changed

+2269
-660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

158 files changed

+2269
-660
lines changed

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ For more detailed information on contribution please read our [beginners guide](
1515

1616
## Contribution requirements
1717

18-
1. Contributions must adhere to the [Magento coding standards](https://devdocs.magento.com/guides/v2.4/coding-standards/bk-coding-standards.html).
18+
1. Contributions must adhere to the [Magento coding standards](https://developer.adobe.com/commerce/php/coding-standards/).
1919
1. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests.
2020
1. Commits must be accompanied by meaningful commit messages. Please see the [Magento Inventory Pull Request Template](https://github.com/magento/inventory/blob/1.1-develop/.github/PULL_REQUEST_TEMPLATE.md) for more information.
2121
1. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Inventory\Model;
9+
10+
use Magento\Framework\Api\SearchCriteriaBuilder;
11+
use Magento\InventoryApi\Api\Data\StockSourceLinkInterface;
12+
use Magento\InventoryApi\Api\GetStockSourceLinksInterface;
13+
use Magento\InventoryApi\Model\GetSourceCodesBySkusInterface;
14+
use Magento\InventoryApi\Model\GetStockIdsBySkusInterface;
15+
16+
class GetStockIdsBySkus implements GetStockIdsBySkusInterface
17+
{
18+
/**
19+
* @var GetSourceCodesBySkusInterface
20+
*/
21+
private $getSourceCodesBySkus;
22+
23+
/**
24+
* @var GetStockSourceLinksInterface
25+
*/
26+
private $getStockSourceLinks;
27+
28+
/**
29+
* @var SearchCriteriaBuilder
30+
*/
31+
private $searchCriteriaBuilder;
32+
33+
/**
34+
* @param GetSourceCodesBySkusInterface $getSourceCodesBySkus
35+
* @param GetStockSourceLinksInterface $getStockSourceLinks
36+
* @param SearchCriteriaBuilder $searchCriteriaBuilder
37+
*/
38+
public function __construct(
39+
GetSourceCodesBySkusInterface $getSourceCodesBySkus,
40+
GetStockSourceLinksInterface $getStockSourceLinks,
41+
SearchCriteriaBuilder $searchCriteriaBuilder
42+
) {
43+
$this->getSourceCodesBySkus = $getSourceCodesBySkus;
44+
$this->getStockSourceLinks = $getStockSourceLinks;
45+
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
46+
}
47+
48+
/**
49+
* @inheritdoc
50+
*/
51+
public function execute(array $skus): array
52+
{
53+
$sourceCodes = $this->getSourceCodesBySkus->execute($skus);
54+
$this->searchCriteriaBuilder->addFilter(StockSourceLinkInterface::SOURCE_CODE, $sourceCodes, 'in');
55+
$searchCriteria = $this->searchCriteriaBuilder->create();
56+
$stockSourceLinks = $this->getStockSourceLinks->execute($searchCriteria)->getItems();
57+
$stockIds = [];
58+
foreach ($stockSourceLinks as $stockSourceLink) {
59+
$stockIds[] = $stockSourceLink->getStockId();
60+
}
61+
62+
return array_unique($stockIds);
63+
}
64+
}

Inventory/Test/Mftf/Test/AdminCanSetOnlyXLeftThresholdForVirtualProductWithTestSourceTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<argument name="Customer" value="$$customer$$"/>
8686
</actionGroup>
8787

88-
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrderForCustomer">
88+
<actionGroup ref="AdminNavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrderForCustomer">
8989
<argument name="customer" value="$$customer$$"/>
9090
</actionGroup>
9191

Inventory/Test/Mftf/Test/AdminCanSetOnlyXLeftTresholdForVirtualProductWithDefaultSourceTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<argument name="Customer" value="$$customer$$"/>
8888
</actionGroup>
8989

90-
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrderForCustomer">
90+
<actionGroup ref="AdminNavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrderForCustomer">
9191
<argument name="customer" value="$$customer$$"/>
9292
</actionGroup>
9393

Inventory/Test/Mftf/Test/AdminOutOfStockThresholdOnVirtualProductPageTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveVirtualProduct1"/>
5555

56-
<actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="newOrderExistingCustomer1">
56+
<actionGroup ref="AdminNavigateToNewOrderPageExistingCustomerActionGroup" stepKey="newOrderExistingCustomer1">
5757
<argument name="customer" value="Simple_US_Customer"/>
5858
</actionGroup>
5959

Inventory/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<preference for="Magento\Inventory\Model\Source\Command\GetInterface" type="Magento\Inventory\Model\Source\Command\Get"/>
1919
<preference for="Magento\Inventory\Model\Source\Command\GetListInterface" type="Magento\Inventory\Model\Source\Command\GetList"/>
2020
<preference for="Magento\Inventory\Model\Source\Command\SaveInterface" type="Magento\Inventory\Model\Source\Command\Save"/>
21+
<preference for="Magento\InventoryApi\Model\GetStockIdsBySkusInterface" type="Magento\Inventory\Model\GetStockIdsBySkus"/>
2122
<type name="Magento\InventoryApi\Model\SourceValidatorChain">
2223
<arguments>
2324
<argument name="validators" xsi:type="array">

InventoryAdminUi/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<!--Navigate to create order page (New Order -> Select Customer)-->
12-
<actionGroup name="NavigateToNewOrderPageExistingCustomerActionGroup">
12+
<actionGroup name="NavigateToNewOrderPageExistingCustomerActionGroup" deprecated="This Action Group is deprecated. Please use AdminNavigateToNewOrderPageExistingCustomerActionGroup.">
1313
<arguments>
1414
<argument name="customer"/>
1515
</arguments>

InventoryAdminUi/Test/Mftf/Test/AddProductToCartAfterCancelOrderDownloadableProductCustomStockTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<severity value="MAJOR"/>
1818
<group value="msi"/>
1919
<group value="multi_mode"/>
20+
<group value="cloud"/>
2021
</annotations>
2122

2223
<before>

InventoryAdminUi/Test/Mftf/Test/AddSimpleProductWithCustomOptionsToCartDefaultStockTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<severity value="CRITICAL"/>
1818
<group value="msi"/>
1919
<group value="multi_mode"/>
20+
<group value="cloud"/>
2021
</annotations>
2122

2223
<before>

InventoryAdminUi/Test/Mftf/Test/AdminAddMultipleSourcesToProductTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<severity value="CRITICAL"/>
1818
<group value="msi"/>
1919
<group value="multi_mode"/>
20+
<group value="cloud"/>
2021
</annotations>
2122

2223
<before>

0 commit comments

Comments
 (0)