Skip to content

Commit 7cf30e9

Browse files
committed
Merge remote-tracking branch 'origin/2.2.8-develop' into 2.2.8-develop-pr71
2 parents 6518bcf + c33b1af commit 7cf30e9

File tree

80 files changed

+2462
-184
lines changed

Some content is hidden

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

80 files changed

+2462
-184
lines changed

app/code/Magento/Backend/Model/Search/Customer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function load()
8989

9090
$this->searchCriteriaBuilder->setCurrentPage($this->getStart());
9191
$this->searchCriteriaBuilder->setPageSize($this->getLimit());
92-
$searchFields = ['firstname', 'lastname', 'company'];
92+
$searchFields = ['firstname', 'lastname', 'billing_company'];
9393
$filters = [];
9494
foreach ($searchFields as $field) {
9595
$filters[] = $this->filterBuilder

app/code/Magento/Backend/Test/Mftf/Section/AdminMainActionsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
<element name="save" type="button" selector="#save" timeout="30"/>
1313
<element name="delete" type="button" selector="#delete"/>
1414
<element name="add" type="button" selector="#add" timeout="30"/>
15+
<element name="back" type="button" selector="#back" timeout="30"/>
1516
</section>
1617
</sections>

app/code/Magento/Backend/Test/Mftf/Section/AdminMessagesSection.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
*/
77
-->
88

9-
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1011
<section name="AdminMessagesSection">
1112
<element name="test" type="input" selector=".test"/>
1213
<element name="success" type="text" selector="#messages div.message-success"/>
1314
<element name="successMessageByIndex" type="text" selector=".message.message-success.success:nth-of-type({{n}})>div" parameterized="true"/>
1415
<element name="error" type="text" selector="#messages div.message-error"/>
16+
<element name="notice" type="text" selector=".message.message-notice.notice"/>
1517
</section>
1618
</sections>

app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ private function getProductIdsByActions(array $actions)
138138
$productIds = [];
139139

140140
foreach ($actions as $action) {
141-
$productIds[] = $action['product_id'];
141+
if (isset($action['product_id']) && is_int($action['product_id'])) {
142+
$productIds[] = $action['product_id'];
143+
}
142144
}
143145

144146
return $productIds;
@@ -159,33 +161,37 @@ public function syncActions(array $productsData, $typeId)
159161
$customerId = $this->session->getCustomerId();
160162
$visitorId = $this->visitor->getId();
161163
$collection = $this->getActionsByType($typeId);
162-
$collection->addFieldToFilter('product_id', $this->getProductIdsByActions($productsData));
163-
164-
/**
165-
* Note that collection is also filtered by visitor id and customer id
166-
* This collection shouldnt be flushed when visitor has products and then login
167-
* It can remove only products for visitor, or only products for customer
168-
*
169-
* ['product_id' => 'added_at']
170-
* @var ProductFrontendActionInterface $item
171-
*/
172-
foreach ($collection as $item) {
173-
$this->entityManager->delete($item);
174-
}
175-
176-
foreach ($productsData as $productId => $productData) {
177-
/** @var ProductFrontendActionInterface $action */
178-
$action = $this->productFrontendActionFactory->create([
179-
'data' => [
180-
'visitor_id' => $customerId ? null : $visitorId,
181-
'customer_id' => $this->session->getCustomerId(),
182-
'added_at' => $productData['added_at'],
183-
'product_id' => $productId,
184-
'type_id' => $typeId
185-
]
186-
]);
187-
188-
$this->entityManager->save($action);
164+
$productIds = $this->getProductIdsByActions($productsData);
165+
166+
if ($productIds) {
167+
$collection->addFieldToFilter('product_id', $productIds);
168+
169+
/**
170+
* Note that collection is also filtered by visitor id and customer id
171+
* This collection shouldnt be flushed when visitor has products and then login
172+
* It can remove only products for visitor, or only products for customer
173+
*
174+
* ['product_id' => 'added_at']
175+
* @var ProductFrontendActionInterface $item
176+
*/
177+
foreach ($collection as $item) {
178+
$this->entityManager->delete($item);
179+
}
180+
181+
foreach ($productsData as $productId => $productData) {
182+
/** @var ProductFrontendActionInterface $action */
183+
$action = $this->productFrontendActionFactory->create([
184+
'data' => [
185+
'visitor_id' => $customerId ? null : $visitorId,
186+
'customer_id' => $this->session->getCustomerId(),
187+
'added_at' => $productData['added_at'],
188+
'product_id' => $productId,
189+
'type_id' => $typeId
190+
]
191+
]);
192+
193+
$this->entityManager->save($action);
194+
}
189195
}
190196
}
191197

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductToCartActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<waitForElementNotVisible selector="{{StorefrontProductPageSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
2828
<waitForElementVisible selector="{{StorefrontProductPageSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/>
2929
<waitForPageLoad stepKey="waitForPageLoad"/>
30+
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProductAddedMessage"/>
3031
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
3132
</actionGroup>
3233

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@
5252
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
5353
</actionGroup>
5454

55+
<actionGroup name="DeleteProductByName" extends="deleteProductUsingProductGrid">
56+
<arguments>
57+
<argument name="product" type="string"/>
58+
</arguments>
59+
<remove keyForRemoval="fillProductSkuFilter"/>
60+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{product}}" stepKey="fillProductSkuFilter" after="openProductFilters"/>
61+
<remove keyForRemoval="seeProductSkuInGrid"/>
62+
<see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{product}}" stepKey="seeProductNameInGrid" after="clickApplyFilters"/>
63+
</actionGroup>
64+
5565
<!--Disabled a product by filtering grid and using change status action-->
5666
<actionGroup name="ChangeStatusProductUsingProductGridActionGroup">
5767
<arguments>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/SearchForProductOnBackendActionGroup.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="SearchForProductOnBackendActionGroup">
1212
<arguments>
1313
<argument name="product" defaultValue="product"/>
@@ -19,4 +19,11 @@
1919
<fillField stepKey="fillSkuFieldOnFiltersSection" userInput="{{product.sku}}" selector="{{AdminProductFiltersSection.SkuInput}}"/>
2020
<click stepKey="clickApplyFiltersButton" selector="{{AdminProductFiltersSection.Apply}}"/>
2121
</actionGroup>
22+
<actionGroup name="SearchForProductOnBackendByNameActionGroup" extends="SearchForProductOnBackendActionGroup">
23+
<arguments>
24+
<argument name="productName" type="string"/>
25+
</arguments>
26+
<remove keyForRemoval="fillSkuFieldOnFiltersSection"/>
27+
<fillField userInput="{{productName}}" selector="{{AdminProductFiltersSection.NameInput}}" after="cleanFiltersIfTheySet" stepKey="fillNameFieldOnFiltersSection"/>
28+
</actionGroup>
2229
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridSection.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductGridSection">
12+
<element name="productRowBySku" type="block" selector="//div[@id='container']//tr//td[count(../../..//th[./*[.='SKU']]/preceding-sibling::th) + 1][./*[.='{{sku}}']]" parameterized="true" />
1213
<element name="loadingMask" type="text" selector=".admin__data-grid-loading-mask[data-component*='product_listing']"/>
1314
<element name="columnHeader" type="button" selector="//div[@data-role='grid-wrapper']//table[contains(@class, 'data-grid')]/thead/tr/th[contains(@class, 'data-grid-th')]/span[text() = '{{label}}']" parameterized="true" timeout="30"/>
1415
<element name="productGridElement1" type="input" selector="#addselector" />

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,9 +2997,7 @@ private function formatStockDataForRow(array $rowData)
29972997
)
29982998
) {
29992999
$stockItemDo->setData($row);
3000-
$row['is_in_stock'] = $stockItemDo->getBackorders() && isset($row['is_in_stock'])
3001-
? $row['is_in_stock']
3002-
: $this->stockStateProvider->verifyStock($stockItemDo);
3000+
$row['is_in_stock'] = $row['is_in_stock'] ?? $this->stockStateProvider->verifyStock($stockItemDo);
30033001
if ($this->stockStateProvider->verifyNotification($stockItemDo)) {
30043002
$row['low_stock_date'] = $this->dateTime->gmDate(
30053003
'Y-m-d H:i:s',

app/code/Magento/CatalogInventory/Observer/CancelOrderItemObserver.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@
66

77
namespace Magento\CatalogInventory\Observer;
88

9-
use Magento\Framework\Event\ObserverInterface;
109
use Magento\CatalogInventory\Api\StockManagementInterface;
10+
use Magento\CatalogInventory\Model\Configuration;
1111
use Magento\Framework\Event\Observer as EventObserver;
12+
use Magento\Framework\Event\ObserverInterface;
1213

1314
/**
1415
* Catalog inventory module observer
1516
*/
1617
class CancelOrderItemObserver implements ObserverInterface
1718
{
19+
/**
20+
* @var \Magento\CatalogInventory\Model\Configuration
21+
*/
22+
protected $configuration;
23+
1824
/**
1925
* @var StockManagementInterface
2026
*/
@@ -26,13 +32,16 @@ class CancelOrderItemObserver implements ObserverInterface
2632
protected $priceIndexer;
2733

2834
/**
35+
* @param Configuration $configuration
2936
* @param StockManagementInterface $stockManagement
3037
* @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer
3138
*/
3239
public function __construct(
40+
Configuration $configuration,
3341
StockManagementInterface $stockManagement,
3442
\Magento\Catalog\Model\Indexer\Product\Price\Processor $priceIndexer
3543
) {
44+
$this->configuration = $configuration;
3645
$this->stockManagement = $stockManagement;
3746
$this->priceIndexer = $priceIndexer;
3847
}
@@ -49,7 +58,8 @@ public function execute(EventObserver $observer)
4958
$item = $observer->getEvent()->getItem();
5059
$children = $item->getChildrenItems();
5160
$qty = $item->getQtyOrdered() - max($item->getQtyShipped(), $item->getQtyInvoiced()) - $item->getQtyCanceled();
52-
if ($item->getId() && $item->getProductId() && empty($children) && $qty) {
61+
if ($item->getId() && $item->getProductId() && empty($children) && $qty && $this->configuration
62+
->getCanBackInStock()) {
5363
$this->stockManagement->backItemQty($item->getProductId(), $qty, $item->getStore()->getWebsiteId());
5464
}
5565
$this->priceIndexer->reindexRow($item->getProductId());

0 commit comments

Comments
 (0)