Skip to content

Commit 79f7572

Browse files
merge magento/2.3-develop into magento-epam/EPAM-PR-64
2 parents dbc1a8f + a102409 commit 79f7572

File tree

18 files changed

+368
-220
lines changed

18 files changed

+368
-220
lines changed

app/code/Magento/AuthorizenetAcceptjs/view/adminhtml/templates/payment/script.phtml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,19 @@
66

77
/** @var Magento\AuthorizenetAcceptjs\Block\Payment $block */
88
?>
9-
<script type="text/x-magento-init">
10-
{
11-
"#payment_form_<?= $block->escapeJs($block->escapeHtml($block->getMethodCode())) ?>": {
12-
"Magento_AuthorizenetAcceptjs/js/payment-form": {
13-
"config": <?= /* @noEscape */ $block->getPaymentConfig() ?>
14-
}
15-
}
16-
}
17-
</script>
9+
<script>
10+
//<![CDATA[
11+
require(
12+
[
13+
'Magento_AuthorizenetAcceptjs/js/authorizenet',
14+
'jquery',
15+
'domReady!'
16+
], function(AuthorizenetAcceptjs, $) {
17+
var config = <?= /* @noEscape */ $block->getPaymentConfig() ?>,
18+
form = $('#payment_form_<?= /* @noEscape */ $block->escapeJs($block->escapeHtml($block->getMethodCode())) ?>');
19+
20+
config.active = form.length > 0 && !form.is(':hidden');
21+
new AuthorizenetAcceptjs(config);
22+
});
23+
//]]>
24+
</script>

app/code/Magento/CatalogInventory/Model/ResourceModel/Indexer/Stock/DefaultStock.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,6 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f
230230
{
231231
$connection = $this->getConnection();
232232
$qtyExpr = $connection->getCheckSql('cisi.qty > 0', 'cisi.qty', 0);
233-
$metadata = $this->getMetadataPool()->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class);
234-
$linkField = $metadata->getLinkField();
235233

236234
$select = $connection->select()->from(
237235
['e' => $this->getTable('catalog_product_entity')],
@@ -245,12 +243,6 @@ protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = f
245243
['cisi' => $this->getTable('cataloginventory_stock_item')],
246244
'cisi.stock_id = cis.stock_id AND cisi.product_id = e.entity_id',
247245
[]
248-
)->joinInner(
249-
['mcpei' => $this->getTable('catalog_product_entity_int')],
250-
'e.' . $linkField . ' = mcpei.' . $linkField
251-
. ' AND mcpei.attribute_id = ' . $this->_getAttribute('status')->getId()
252-
. ' AND mcpei.value = ' . ProductStatus::STATUS_ENABLED,
253-
[]
254246
)->columns(
255247
['qty' => $qtyExpr]
256248
)->where(

app/code/Magento/Customer/Model/Data/Address.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(
4242
}
4343

4444
/**
45-
* {@inheritdoc}
45+
* @inheritdoc
4646
*/
4747
protected function getCustomAttributesCodes()
4848
{
@@ -327,7 +327,7 @@ public function setCompany($company)
327327
*/
328328
public function setTelephone($telephone)
329329
{
330-
return $this->setData(self::TELEPHONE, $telephone);
330+
return $this->setData(self::TELEPHONE, trim($telephone));
331331
}
332332

333333
/**
@@ -452,7 +452,7 @@ public function setIsDefaultBilling($isDefaultBilling)
452452
}
453453

454454
/**
455-
* {@inheritdoc}
455+
* @inheritdoc
456456
*
457457
* @return \Magento\Customer\Api\Data\AddressExtensionInterface|null
458458
*/
@@ -462,7 +462,7 @@ public function getExtensionAttributes()
462462
}
463463

464464
/**
465-
* {@inheritdoc}
465+
* @inheritdoc
466466
*
467467
* @param \Magento\Customer\Api\Data\AddressExtensionInterface $extensionAttributes
468468
* @return $this
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="SearchByEmailInCustomerGridTest">
11+
<annotations>
12+
<features value="Customer"/>
13+
<stories value="Customer grid search"/>
14+
<title value="Admin customer grid email searching"/>
15+
<description value="Admin customer grid searching by email in keyword"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MC-17985"/>
18+
<useCaseId value="MC-17947"/>
19+
<group value="customer"/>
20+
</annotations>
21+
<before>
22+
<createData entity="Simple_US_Customer" stepKey="createFirstCustomer"/>
23+
<createData entity="Simple_US_Customer" stepKey="createSecondCustomer"/>
24+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
25+
</before>
26+
<after>
27+
<deleteData createDataKey="createFirstCustomer" stepKey="deleteFirstCustomer"/>
28+
<deleteData createDataKey="createSecondCustomer" stepKey="deleteSecondCustomer"/>
29+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/>
30+
<actionGroup ref="AdminResetFilterInCustomerAddressGrid" stepKey="clearCustomerGridFilter"/>
31+
<actionGroup ref="logout" stepKey="logout"/>
32+
</after>
33+
<!--Step 1: Go to Customers > All Customers-->
34+
<amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/>
35+
<!--Step 2: On Customers grid page search customer by keyword-->
36+
<actionGroup ref="searchAdminDataGridByKeyword" stepKey="searchCustomer">
37+
<argument name="keyword" value="$$createSecondCustomer.email$$"/>
38+
</actionGroup>
39+
<!--Step 3: Check if customer is placed in a first row and clear grid filter-->
40+
<actionGroup ref="AdminAssertCustomerInCustomersGrid" stepKey="checkCustomerInGrid">
41+
<argument name="text" value="$$createSecondCustomer.email$$"/>
42+
<argument name="row" value="1"/>
43+
</actionGroup>
44+
</test>
45+
</tests>

app/code/Magento/Eav/Model/Attribute/Data/Text.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function __construct(
4545
*/
4646
public function extractValue(RequestInterface $request)
4747
{
48-
$value = $this->_getRequestValue($request);
48+
$value = trim($this->_getRequestValue($request));
4949
return $this->_applyInputFilter($value);
5050
}
5151

@@ -168,7 +168,7 @@ private function validateLength(\Magento\Eav\Model\Attribute $attribute, string
168168
*/
169169
private function validateInputRule(string $value): array
170170
{
171-
$result = $this->_validateInputRule(trim($value));
171+
$result = $this->_validateInputRule($value);
172172
return \is_array($result) ? $result : [];
173173
}
174174
}

app/code/Magento/Eav/Test/Unit/Model/Attribute/Data/TextTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ public function alphanumDataProvider(): array
138138
['QazWsx12345', [
139139
__('"%1" length must be equal or less than %2 characters.', 'Test', 10)]
140140
],
141-
[' 12345 ', true],
142141
];
143142
}
144143

app/code/Magento/GroupedCatalogInventory/Plugin/OutOfStockFilter.php

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,77 +10,51 @@
1010

1111
use Magento\Catalog\Model\Product;
1212
use Magento\CatalogInventory\Api\Data\StockStatusInterface;
13-
use Magento\CatalogInventory\Api\StockStatusCriteriaInterfaceFactory;
14-
use Magento\CatalogInventory\Api\StockStatusRepositoryInterface;
1513
use Magento\GroupedProduct\Model\Product\Type\Grouped;
14+
use Magento\CatalogInventory\Api\StockRegistryInterface;
15+
use Magento\Framework\DataObject;
1616

1717
/**
18-
* Removes out of stock products from cart candidates when appropriate
18+
* Removes out of stock products from cart candidates when appropriate.
1919
*/
2020
class OutOfStockFilter
2121
{
2222
/**
23-
* @var StockStatusRepositoryInterface
23+
* @var StockRegistryInterface
2424
*/
25-
private $stockStatusRepository;
25+
private $stockRegistry;
2626

2727
/**
28-
* @var StockStatusCriteriaInterfaceFactory
28+
* @param StockRegistryInterface $stockRegistry
2929
*/
30-
private $criteriaInterfaceFactory;
31-
32-
/**
33-
* @param StockStatusRepositoryInterface $stockStatusRepository
34-
* @param StockStatusCriteriaInterfaceFactory $criteriaInterfaceFactory
35-
*/
36-
public function __construct(
37-
StockStatusRepositoryInterface $stockStatusRepository,
38-
StockStatusCriteriaInterfaceFactory $criteriaInterfaceFactory
39-
) {
40-
$this->stockStatusRepository = $stockStatusRepository;
41-
$this->criteriaInterfaceFactory = $criteriaInterfaceFactory;
30+
public function __construct(StockRegistryInterface $stockRegistry)
31+
{
32+
$this->stockRegistry = $stockRegistry;
4233
}
4334

4435
/**
45-
* Removes out of stock products for requests that don't specify the super group
36+
* Removes out of stock products for requests that don't specify the super group.
4637
*
4738
* @param Grouped $subject
4839
* @param array|string $result
49-
* @param \Magento\Framework\DataObject $buyRequest
40+
* @param DataObject $buyRequest
5041
* @return string|array
5142
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5243
*/
53-
public function afterPrepareForCartAdvanced(
54-
Grouped $subject,
55-
$result,
56-
\Magento\Framework\DataObject $buyRequest
57-
) {
44+
public function afterPrepareForCartAdvanced(Grouped $subject, $result, DataObject $buyRequest)
45+
{
5846
if (!is_array($result) && $result instanceof Product) {
5947
$result = [$result];
6048
}
6149

6250
// Only remove out-of-stock products if no quantities were specified
6351
if (is_array($result) && !empty($result) && !$buyRequest->getData('super_group')) {
64-
$productIds = [];
65-
$productIdMap = [];
66-
6752
foreach ($result as $index => $cartItem) {
68-
$productIds[] = $cartItem->getId();
69-
$productIdMap[$cartItem->getId()] = $index;
70-
}
71-
72-
$criteria = $this->criteriaInterfaceFactory->create();
73-
$criteria->setProductsFilter($productIds);
74-
75-
$stockStatusCollection = $this->stockStatusRepository->getList($criteria);
76-
foreach ($stockStatusCollection->getItems() as $status) {
77-
/** @var $status StockStatusInterface */
78-
if ($status->getStockStatus() == StockStatusInterface::STATUS_OUT_OF_STOCK) {
79-
unset($result[$productIdMap[$status->getProductId()]]);
53+
$productStockStatus = $this->stockRegistry->getProductStockStatus($cartItem->getId());
54+
if ($productStockStatus == StockStatusInterface::STATUS_OUT_OF_STOCK) {
55+
unset($result[$index]);
8056
}
8157
}
82-
83-
unset($productIdMap);
8458
}
8559

8660
return $result;

0 commit comments

Comments
 (0)