Skip to content

Commit 03ef1fa

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-3399
2 parents 7fde3f7 + 082d981 commit 03ef1fa

File tree

423 files changed

+7966
-1920
lines changed

Some content is hidden

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

423 files changed

+7966
-1920
lines changed

app/code/Magento/Backend/Console/Command/MaintenanceAllowIpsCommand.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Backend\Console\Command;
77

@@ -22,9 +22,10 @@ class MaintenanceAllowIpsCommand extends AbstractSetupCommand
2222
/**
2323
* Names of input arguments or options
2424
*/
25-
const INPUT_KEY_IP = 'ip';
26-
const INPUT_KEY_NONE = 'none';
27-
const INPUT_KEY_ADD = 'add';
25+
public const INPUT_KEY_IP = 'ip';
26+
public const INPUT_KEY_NONE = 'none';
27+
public const INPUT_KEY_ADD = 'add';
28+
public const NAME = 'maintenance:allow-ips';
2829

2930
/**
3031
* @var MaintenanceMode
@@ -76,7 +77,7 @@ protected function configure(): void
7677
'Add the IP address to existing list'
7778
),
7879
];
79-
$this->setName('maintenance:allow-ips')
80+
$this->setName(self::NAME)
8081
->setDescription('Sets maintenance mode exempt IPs')
8182
->setDefinition(array_merge($arguments, $options));
8283

app/code/Magento/Backend/Console/Command/MaintenanceDisableCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Backend\Console\Command;
77

@@ -10,14 +10,16 @@
1010
*/
1111
class MaintenanceDisableCommand extends AbstractMaintenanceCommand
1212
{
13+
public const NAME = 'maintenance:disable';
14+
1315
/**
1416
* Initialization of the command
1517
*
1618
* @return void
1719
*/
1820
protected function configure()
1921
{
20-
$this->setName('maintenance:disable')->setDescription('Disables maintenance mode');
22+
$this->setName(self::NAME)->setDescription('Disables maintenance mode');
2123

2224
parent::configure();
2325
}

app/code/Magento/Backend/Console/Command/MaintenanceEnableCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Backend\Console\Command;
77

@@ -10,14 +10,16 @@
1010
*/
1111
class MaintenanceEnableCommand extends AbstractMaintenanceCommand
1212
{
13+
public const NAME = 'maintenance:enable';
14+
1315
/**
1416
* Initialization of the command
1517
*
1618
* @return void
1719
*/
1820
protected function configure(): void
1921
{
20-
$this->setName('maintenance:enable')->setDescription('Enables maintenance mode');
22+
$this->setName(self::NAME)->setDescription('Enables maintenance mode');
2123

2224
parent::configure();
2325
}

app/code/Magento/Backend/Console/Command/MaintenanceStatusCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Backend\Console\Command;
77

@@ -16,6 +16,8 @@
1616
*/
1717
class MaintenanceStatusCommand extends AbstractSetupCommand
1818
{
19+
public const NAME = 'maintenance:status';
20+
1921
/**
2022
* @var MaintenanceMode $maintenanceMode
2123
*/
@@ -40,7 +42,7 @@ public function __construct(MaintenanceMode $maintenanceMode)
4042
*/
4143
protected function configure(): void
4244
{
43-
$this->setName('maintenance:status')
45+
$this->setName(self::NAME)
4446
->setDescription('Displays maintenance mode status');
4547

4648
parent::configure();

app/code/Magento/Bundle/Test/Mftf/Test/AdminAddDefaultImageBundleProductTest.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -18,8 +18,6 @@
1818
<testCaseId value="MC-115"/>
1919
<group value="Bundle"/>
2020
<group value="cloud"/>
21-
<!-- Excluded from PR builds due to AC-12124 -->
22-
<group value="pr_exclude"/>
2321
</annotations>
2422
<before>
2523
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>

app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
33
*
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77

88
namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute;
@@ -269,6 +269,11 @@ public function execute()
269269

270270
unset($data['entity_type_id']);
271271

272+
if (array_key_exists('reset_is-default_option', $data) && $data['reset_is-default_option']) {
273+
unset($data['reset_is-default_option']);
274+
$data['default_value'] = null;
275+
}
276+
272277
$model->addData($data);
273278

274279
if (!$attributeId) {

app/code/Magento/Catalog/Model/Product/Price/Validation/TierPriceValidator.php

Lines changed: 27 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Catalog\Model\Product\Price\Validation;
@@ -10,10 +10,8 @@
1010
use Magento\Catalog\Api\ProductRepositoryInterface;
1111
use Magento\Catalog\Model\Product\Type;
1212
use Magento\Catalog\Model\ProductIdLocatorInterface;
13-
use Magento\Customer\Api\GroupRepositoryInterface;
1413
use Magento\Directory\Model\Currency;
15-
use Magento\Framework\Api\FilterBuilder;
16-
use Magento\Framework\Api\SearchCriteriaBuilder;
14+
use Magento\Framework\App\ResourceConnection;
1715
use Magento\Framework\Exception\LocalizedException;
1816
use Magento\Framework\ObjectManager\ResetAfterRequestInterface;
1917
use Magento\Store\Api\WebsiteRepositoryInterface;
@@ -35,21 +33,6 @@ class TierPriceValidator implements ResetAfterRequestInterface
3533
*/
3634
private $productIdLocator;
3735

38-
/**
39-
* @var SearchCriteriaBuilder
40-
*/
41-
private $searchCriteriaBuilder;
42-
43-
/**
44-
* @var FilterBuilder
45-
*/
46-
private $filterBuilder;
47-
48-
/**
49-
* @var GroupRepositoryInterface
50-
*/
51-
private $customerGroupRepository;
52-
5336
/**
5437
* @var WebsiteRepositoryInterface
5538
*/
@@ -60,13 +43,6 @@ class TierPriceValidator implements ResetAfterRequestInterface
6043
*/
6144
private $validationResult;
6245

63-
/**
64-
* Groups by code cache.
65-
*
66-
* @var array
67-
*/
68-
private $customerGroupsByCode = [];
69-
7046
/**
7147
* @var InvalidSkuProcessor
7248
*/
@@ -97,6 +73,16 @@ class TierPriceValidator implements ResetAfterRequestInterface
9773
*/
9874
private $productsCacheBySku = [];
9975

76+
/**
77+
* @var ResourceConnection
78+
*/
79+
private $resourceConnection;
80+
81+
/**
82+
* @var array Customer group check cache
83+
*/
84+
private $customerGroupCheck = [];
85+
10086
/**
10187
* @var ScopeConfigInterface
10288
*/
@@ -106,38 +92,32 @@ class TierPriceValidator implements ResetAfterRequestInterface
10692
* TierPriceValidator constructor.
10793
*
10894
* @param ProductIdLocatorInterface $productIdLocator
109-
* @param SearchCriteriaBuilder $searchCriteriaBuilder
110-
* @param FilterBuilder $filterBuilder
111-
* @param GroupRepositoryInterface $customerGroupRepository
11295
* @param WebsiteRepositoryInterface $websiteRepository
11396
* @param Result $validationResult
11497
* @param InvalidSkuProcessor $invalidSkuProcessor
11598
* @param ProductRepositoryInterface $productRepository
11699
* @param array $allowedProductTypes [optional]
100+
* @param ResourceConnection|null $resourceConnection
117101
* @param ScopeConfigInterface|null $scopeConfig
118102
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
119103
*/
120104
public function __construct(
121105
ProductIdLocatorInterface $productIdLocator,
122-
SearchCriteriaBuilder $searchCriteriaBuilder,
123-
FilterBuilder $filterBuilder,
124-
GroupRepositoryInterface $customerGroupRepository,
125106
WebsiteRepositoryInterface $websiteRepository,
126107
Result $validationResult,
127108
InvalidSkuProcessor $invalidSkuProcessor,
128109
ProductRepositoryInterface $productRepository,
129110
array $allowedProductTypes = [],
111+
?ResourceConnection $resourceConnection = null,
130112
?ScopeConfigInterface $scopeConfig = null
131113
) {
132114
$this->productIdLocator = $productIdLocator;
133-
$this->searchCriteriaBuilder = $searchCriteriaBuilder;
134-
$this->filterBuilder = $filterBuilder;
135-
$this->customerGroupRepository = $customerGroupRepository;
136115
$this->websiteRepository = $websiteRepository;
137116
$this->validationResult = $validationResult;
138117
$this->invalidSkuProcessor = $invalidSkuProcessor;
139118
$this->productRepository = $productRepository;
140119
$this->allowedProductTypes = $allowedProductTypes;
120+
$this->resourceConnection = $resourceConnection ?: ObjectManager::getInstance()->get(ResourceConnection::class);
141121
$this->scopeConfig = $scopeConfig ?: ObjectManager::getInstance()->get(ScopeConfigInterface::class);
142122
}
143123

@@ -504,32 +484,19 @@ private function checkGroup(TierPriceInterface $price, $key, Result $validationR
504484
*/
505485
private function retrieveGroupValue(string $code)
506486
{
507-
if (!isset($this->customerGroupsByCode[$code])) {
508-
$searchCriteria = $this->searchCriteriaBuilder->addFilters(
509-
[
510-
$this->filterBuilder->setField('customer_group_code')->setValue($code)->create()
511-
]
487+
if (!isset($this->customerGroupCheck[$code])) {
488+
$connection = $this->resourceConnection->getConnection();
489+
$select = $connection->select()->from(
490+
$this->resourceConnection->getTableName('customer_group'),
491+
'customer_group_id'
492+
)->where(
493+
'customer_group_code = ?',
494+
$code
512495
);
513-
$items = $this->customerGroupRepository->getList($searchCriteria->create())->getItems();
514-
$item = array_shift($items);
515-
516-
if (!$item) {
517-
$this->customerGroupsByCode[$code] = false;
518-
return false;
519-
}
520-
521-
$itemCode = $item->getCode();
522-
$itemId = $item->getId();
523-
524-
if (strtolower($itemCode) !== $code) {
525-
$this->customerGroupsByCode[$code] = false;
526-
return false;
527-
}
528-
529-
$this->customerGroupsByCode[strtolower($itemCode)] = $itemId;
496+
$this->customerGroupCheck[$code] = $connection->fetchOne($select);
530497
}
531498

532-
return $this->customerGroupsByCode[$code];
499+
return $this->customerGroupCheck[$code];
533500
}
534501

535502
/**
@@ -576,6 +543,6 @@ private function compareWebsiteValueNewPrice(TierPriceInterface $price, TierPric
576543
*/
577544
public function _resetState(): void
578545
{
579-
$this->customerGroupsByCode = [];
546+
$this->customerGroupCheck = [];
580547
}
581548
}
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 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminAddCustomOptionsActionGroup">
11+
<annotations>
12+
<description>Clicks on 'Add Option'. Adds the provided Options under the provided Custom Option Name to a Product on the Admin Product creation/edit page under the 'Customizable Options' section.</description>
13+
</annotations>
14+
<arguments>
15+
<argument name="title" type="string"/>
16+
<argument name="price" type="string"/>
17+
</arguments>
18+
<!-- Add option based on the parameter -->
19+
<click stepKey="clickAddValue" selector="{{AdminProductCustomizableOptionsSection.addValue}}"/>
20+
<fillField stepKey="fillInCustomOptionValueTitle" selector="{{AdminProductCustomizableOptionsSection.valueTitle}}" userInput="{{title}}"/>
21+
<fillField stepKey="fillInCustomOptionValuePrice" selector="{{AdminProductCustomizableOptionsSection.valuePrice}}" userInput="{{price}}"/>
22+
</actionGroup>
23+
</actionGroups>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminAddOptionsToSizeAttributeActionGroup">
12+
<annotations>
13+
<description>Adds size option to a new Attribute on the Configurable Product creation/edit page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="position" type="string" defaultValue="0"/>
17+
<argument name="size" type="string" defaultValue="S"/>
18+
</arguments>
19+
<!--Add option 1 to attribute-->
20+
<waitForElementVisible selector="{{AdminNewAttributePanel.optionAdminValue('position')}}" stepKey="waitForAdminTextBoxVisible"/>
21+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('position')}}" userInput="{{size}}" stepKey="fillAdminLabel"/>
22+
<waitForElementVisible selector="{{AdminNewAttributePanel.optionDefaultStoreValue('position')}}" stepKey="waitForDefaultStoreViewTextBoxVisible"/>
23+
<fillField selector="{{AdminNewAttributePanel.optionDefaultStoreValue('position')}}" userInput="{{size}}" stepKey="fillDefaultLabel"/>
24+
</actionGroup>
25+
</actionGroups>

0 commit comments

Comments
 (0)