Skip to content

Commit bb3873c

Browse files
committed
Merge remote-tracking branch 'mainline/2.3-develop' into MQE-1596
2 parents 6e23001 + c3f29ce commit bb3873c

File tree

88 files changed

+1264
-377
lines changed

Some content is hidden

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

88 files changed

+1264
-377
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="ChangedCookieDomainForMainWebsiteConfigData">
12+
<data key="path">web/cookie/cookie_domain</data>
13+
<data key="scope">website</data>
14+
<data key="scope_code">base</data>
15+
<data key="value">testDomain.com</data>
16+
</entity>
17+
<entity name="EmptyCookieDomainForMainWebsiteConfigData">
18+
<data key="path">web/cookie/cookie_domain</data>
19+
<data key="scope">website</data>
20+
<data key="scope_code">base</data>
21+
<data key="value">''</data>
22+
</entity>
23+
</entities>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminLoginAfterChangeCookieDomainTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Login on the Admin Backend"/>
15+
<title value="Admin user can login after changing cookie domain on main website scope without changing cookie domain on default scope"/>
16+
<description value="Admin user can login after changing cookie domain on main website scope without changing cookie domain on default scope"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-17847"/>
19+
<useCaseId value="MC-17275"/>
20+
<group value="backend"/>
21+
</annotations>
22+
<before>
23+
<magentoCLI command="config:set {{ChangedCookieDomainForMainWebsiteConfigData.path}} --scope={{ChangedCookieDomainForMainWebsiteConfigData.scope}} --scope-code={{ChangedCookieDomainForMainWebsiteConfigData.scope_code}} {{ChangedCookieDomainForMainWebsiteConfigData.value}}" stepKey="changeDomainForMainWebsiteBeforeTestRun"/>
24+
<magentoCLI command="cache:flush config" stepKey="flushCacheBeforeTestRun"/>
25+
</before>
26+
<after>
27+
<magentoCLI command="config:set {{EmptyCookieDomainForMainWebsiteConfigData.path}} --scope={{EmptyCookieDomainForMainWebsiteConfigData.scope}} --scope-code={{EmptyCookieDomainForMainWebsiteConfigData.scope_code}} {{EmptyCookieDomainForMainWebsiteConfigData.value}}" stepKey="changeDomainForMainWebsiteAfterTestComplete"/>
28+
<magentoCLI command="cache:flush config" stepKey="flushCacheAfterTestComplete"/>
29+
</after>
30+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
31+
<actionGroup ref="AssertAdminDashboardPageIsVisibleActionGroup" stepKey="seeDashboardPage"/>
32+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
33+
</test>
34+
</tests>

app/code/Magento/Backend/etc/adminhtml/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
<arguments>
8787
<argument name="lifetimePath" xsi:type="const">Magento\Backend\Model\Auth\Session::XML_PATH_SESSION_LIFETIME</argument>
8888
<argument name="sessionName" xsi:type="const">Magento\Backend\Model\Session\AdminConfig::SESSION_NAME_ADMIN</argument>
89+
<argument name="scopeType" xsi:type="const">Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT</argument>
8990
</arguments>
9091
</type>
9192
<type name="Magento\Framework\View\Result\PageFactory">

app/code/Magento/Backend/view/adminhtml/templates/widget/form/renderer/fieldset.phtml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ if ($isField) {
5353

5454
<?php if (!$element->getNoContainer()) : ?>
5555
<fieldset class="<?= $block->escapeHtmlAttr($cssClass) ?>" id="<?= $block->escapeHtmlAttr($id) ?>">
56+
<?php if (strlen($element->getBeforeElementHtml())) : ?>
57+
<?= $element->getBeforeElementHtml() ?>
58+
<?php endif ?>
5659
<?php if ($element->getLegend() && !$isWrapped) : ?>
5760
<legend class="<?= /* @noEscape */ $isField ? 'label admin__field-label' : 'admin__legend legend' ?>">
5861
<span><?= $block->escapeHtml($element->getLegend()) ?></span>

app/code/Magento/Catalog/Model/Product/Visibility.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(
5555
/**
5656
* Retrieve visible in catalog ids array
5757
*
58-
* @return string[]
58+
* @return int[]
5959
*/
6060
public function getVisibleInCatalogIds()
6161
{
@@ -65,7 +65,7 @@ public function getVisibleInCatalogIds()
6565
/**
6666
* Retrieve visible in search ids array
6767
*
68-
* @return string[]
68+
* @return int[]
6969
*/
7070
public function getVisibleInSearchIds()
7171
{
@@ -75,7 +75,7 @@ public function getVisibleInSearchIds()
7575
/**
7676
* Retrieve visible in site ids array
7777
*
78-
* @return string[]
78+
* @return int[]
7979
*/
8080
public function getVisibleInSiteIds()
8181
{
@@ -86,6 +86,7 @@ public function getVisibleInSiteIds()
8686
* Retrieve option array
8787
*
8888
* @return array
89+
* phpcs:disable Magento2.Functions.StaticFunction
8990
*/
9091
public static function getOptionArray()
9192
{
@@ -134,6 +135,7 @@ public static function getOptionText($optionId)
134135
$options = self::getOptionArray();
135136
return isset($options[$optionId]) ? $options[$optionId] : null;
136137
}
138+
//phpcs:enable Magento2.Functions.StaticFunction
137139

138140
/**
139141
* Retrieve flat column definition
@@ -251,7 +253,7 @@ public function addValueSortToCollection($collection, $dir = 'asc')
251253
}
252254

253255
/**
254-
* {@inheritdoc}
256+
* @inheritdoc
255257
*/
256258
public function toOptionArray()
257259
{

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<element name="sectionHeader" type="button" selector="div[data-index='websites']" timeout="30"/>
8080
<element name="sectionHeaderOpened" type="button" selector="[data-index='websites']._show" timeout="30"/>
8181
<element name="website" type="checkbox" selector="//label[contains(text(), '{{var1}}')]/parent::div//input[@type='checkbox']" parameterized="true"/>
82+
<element name="websiteChecked" type="checkbox" selector="//label[contains(text(), '{{var1}}')]/parent::div//input[@type='checkbox'][@value='1']" parameterized="true"/>
8283
</section>
8384
<section name="ProductDesignSection">
8485
<element name="DesignTab" type="button" selector="//strong[@class='admin__collapsible-title']//span[text()='Design']"/>

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Websites.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,9 @@ protected function getFieldsForFieldset()
175175
$label = __('Websites');
176176

177177
$defaultWebsiteId = $this->websiteRepository->getDefault()->getId();
178-
$isOnlyOneWebsiteAvailable = count($websitesList) === 1;
179178
foreach ($websitesList as $website) {
180179
$isChecked = in_array($website['id'], $websiteIds)
181-
|| ($defaultWebsiteId == $website['id'] && $isNewProduct)
182-
|| $isOnlyOneWebsiteAvailable;
180+
|| ($defaultWebsiteId == $website['id'] && $isNewProduct);
183181
$children[$website['id']] = [
184182
'arguments' => [
185183
'data' => [

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* @SuppressWarnings(PHPMD.TooManyFields)
3939
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
4040
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
41+
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
4142
* @since 100.0.2
4243
*/
4344
class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
@@ -1508,6 +1509,7 @@ public function getImagesFromRow(array $rowData)
15081509
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
15091510
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
15101511
* @throws LocalizedException
1512+
* phpcs:disable Generic.Metrics.NestingLevel
15111513
*/
15121514
protected function _saveProducts()
15131515
{
@@ -2487,6 +2489,12 @@ public function validateRow(array $rowData, $rowNum)
24872489
*/
24882490
private function isNeedToValidateUrlKey($rowData)
24892491
{
2492+
if (!empty($rowData[self::COL_SKU]) && empty($rowData[self::URL_KEY])
2493+
&& $this->getBehavior() === Import::BEHAVIOR_APPEND
2494+
&& $this->isSkuExist($rowData[self::COL_SKU])) {
2495+
return false;
2496+
}
2497+
24902498
return (!empty($rowData[self::URL_KEY]) || !empty($rowData[self::COL_NAME]))
24912499
&& (empty($rowData[self::COL_VISIBILITY])
24922500
|| $rowData[self::COL_VISIBILITY]
@@ -2810,7 +2818,8 @@ protected function getUrlKey($rowData)
28102818
return trim(strtolower($urlKey));
28112819
}
28122820

2813-
if (!empty($rowData[self::COL_NAME])) {
2821+
if (!empty($rowData[self::COL_NAME])
2822+
&& (array_key_exists(self::URL_KEY, $rowData) || !$this->isSkuExist($rowData[self::COL_SKU]))) {
28142823
return $this->productUrl->formatUrlKey($rowData[self::COL_NAME]);
28152824
}
28162825

app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\CatalogSearch\Ui\DataProvider\Product;
77

8-
use Magento\Framework\Data\Collection;
98
use Magento\CatalogSearch\Model\ResourceModel\Search\Collection as SearchCollection;
9+
use Magento\Framework\Data\Collection;
1010
use Magento\Ui\DataProvider\AddFilterToCollectionInterface;
1111

1212
/**
@@ -30,14 +30,14 @@ public function __construct(SearchCollection $searchCollection)
3030
}
3131

3232
/**
33-
* {@inheritdoc}
33+
* @inheritdoc
3434
*
3535
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3636
*/
3737
public function addFilter(Collection $collection, $field, $condition = null)
3838
{
3939
/** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
40-
if (isset($condition['fulltext']) && !empty($condition['fulltext'])) {
40+
if (isset($condition['fulltext']) && (string)$condition['fulltext'] !== '') {
4141
$this->searchCollection->addBackendSearchFilter($condition['fulltext']);
4242
$productIds = $this->searchCollection->load()->getAllIds();
4343
$collection->addIdFilter($productIds);

app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,8 @@ public function execute(Observer $observer)
255255
protected function _populateForUrlGeneration($rowData)
256256
{
257257
$newSku = $this->import->getNewSku($rowData[ImportProduct::COL_SKU]);
258-
if (empty($newSku) || !isset($newSku['entity_id'])) {
259-
return null;
260-
}
261-
if ($this->import->getRowScope($rowData) == ImportProduct::SCOPE_STORE
262-
&& empty($rowData[self::URL_KEY_ATTRIBUTE_CODE])) {
258+
$oldSku = $this->import->getOldSku();
259+
if (!$this->isNeedToPopulateForUrlGeneration($rowData, $newSku, $oldSku)) {
263260
return null;
264261
}
265262
$rowData['entity_id'] = $newSku['entity_id'];
@@ -292,6 +289,27 @@ protected function _populateForUrlGeneration($rowData)
292289
return $this;
293290
}
294291

292+
/**
293+
* Check is need to populate data for url generation
294+
*
295+
* @param array $rowData
296+
* @param array $newSku
297+
* @param array $oldSku
298+
* @return bool
299+
*/
300+
private function isNeedToPopulateForUrlGeneration($rowData, $newSku, $oldSku): bool
301+
{
302+
if ((empty($newSku) || !isset($newSku['entity_id']))
303+
|| ($this->import->getRowScope($rowData) == ImportProduct::SCOPE_STORE
304+
&& empty($rowData[self::URL_KEY_ATTRIBUTE_CODE]))
305+
|| (array_key_exists($rowData[ImportProduct::COL_SKU], $oldSku)
306+
&& !isset($rowData[self::URL_KEY_ATTRIBUTE_CODE])
307+
&& $this->import->getBehavior() === ImportExport::BEHAVIOR_APPEND)) {
308+
return false;
309+
}
310+
return true;
311+
}
312+
295313
/**
296314
* Add store id to product data.
297315
*

0 commit comments

Comments
 (0)