Skip to content

Commit a6659ca

Browse files
committed
Merge branch '2.4.8-develop' of github.com:magento-commerce/magento2ce into graphql-api-enhancements
2 parents d758515 + fff88c4 commit a6659ca

File tree

80 files changed

+2907
-527
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

+2907
-527
lines changed

app/code/Magento/Backend/App/Area/FrontNameResolver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ public function getFrontName($checkHost = false)
117117
/**
118118
* Return whether the host from request is the backend host
119119
*
120+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
121+
* @SuppressWarnings(PHPMD.NPathComplexity)
122+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
120123
* @return bool
121124
*/
122125
public function isHostBackend()
@@ -128,10 +131,11 @@ public function isHostBackend()
128131
if ($this->scopeConfig->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE)) {
129132
$backendUrl = $this->scopeConfig->getValue(self::XML_PATH_CUSTOM_ADMIN_URL, ScopeInterface::SCOPE_STORE);
130133
} else {
131-
$backendUrl = $this->config->getValue(Store::XML_PATH_UNSECURE_BASE_URL);
134+
$xmlPath = $this->request->isSecure() ? Store::XML_PATH_SECURE_BASE_URL : Store::XML_PATH_UNSECURE_BASE_URL;
135+
$backendUrl = $this->config->getValue($xmlPath);
132136
if ($backendUrl === null) {
133137
$backendUrl = $this->scopeConfig->getValue(
134-
Store::XML_PATH_UNSECURE_BASE_URL,
138+
$xmlPath,
135139
ScopeInterface::SCOPE_STORE
136140
);
137141
}

app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public function testIsHostBackend(
129129
->willReturnMap(
130130
[
131131
[Store::XML_PATH_UNSECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url],
132+
[Store::XML_PATH_SECURE_BASE_URL, ScopeInterface::SCOPE_STORE, null, $url],
132133
[
133134
FrontNameResolver::XML_PATH_USE_CUSTOM_ADMIN_URL,
134135
ScopeInterface::SCOPE_STORE,
@@ -160,7 +161,6 @@ public function testIsHostBackend(
160161
->setHost(parse_url($url, PHP_URL_HOST))
161162
->setPort(parse_url($url, PHP_URL_PORT))
162163
);
163-
164164
$this->assertEquals($expectedValue, $this->model->isHostBackend());
165165
}
166166

app/code/Magento/Config/Block/System/Config/Form/Field/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected function _getDeleteCheckbox()
5555
$html .= '<input type="hidden" name="' .
5656
parent::getName() .
5757
'[value]" value="' .
58-
$this->_escaper->escapeHtml($this->getValue()) .
58+
$this->_escaper->escapeHtmlAttr($this->getValue()) .
5959
'" />';
6060
$html .= '</div>';
6161
}

app/code/Magento/Downloadable/Test/Fixture/DownloadableProduct.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Magento\TestFramework\Fixture\Api\DataMerger;
2020
use Magento\TestFramework\Fixture\Api\ServiceFactory;
2121
use Magento\TestFramework\Fixture\Data\ProcessorInterface;
22+
use Magento\Downloadable\Api\DomainManagerInterface;
2223

2324
class DownloadableProduct extends Product
2425
{
@@ -43,6 +44,8 @@ class DownloadableProduct extends Product
4344
],
4445
];
4546

47+
private const DOMAINS = ['example.com','www.example.com'];
48+
4649
/**
4750
* DownloadableProduct constructor
4851
*
@@ -61,7 +64,8 @@ public function __construct(
6164
private readonly ProductRepositoryInterface $productRepository,
6265
private readonly DirectoryList $directoryList,
6366
private readonly Link $link,
64-
private readonly File $file
67+
private readonly File $file,
68+
private readonly DomainManagerInterface $domainManager
6569
) {
6670
parent::__construct($serviceFactory, $dataProcessor, $dataMerger, $productRepository);
6771
}
@@ -74,9 +78,17 @@ public function __construct(
7478
*/
7579
public function apply(array $data = []): ?DataObject
7680
{
81+
$this->domainManager->addDomains(self::DOMAINS);
82+
7783
return parent::apply($this->prepareData($data));
7884
}
7985

86+
public function revert(DataObject $data): void
87+
{
88+
$this->domainManager->removeDomains(self::DOMAINS);
89+
parent::revert($data);
90+
}
91+
8092
/**
8193
* Prepare product data
8294
*
@@ -112,13 +124,22 @@ private function prepareLinksData(array $data): array
112124
{
113125
$links = [];
114126
foreach ($data['extension_attributes']['downloadable_product_links'] as $link) {
127+
128+
if ($link['link_type'] == 'url') {
129+
$link['link_url'] = 'http://example.com/downloadable.txt';
130+
$link['link_file'] = '';
131+
} else {
132+
$link['link_file'] = $this->generateDownloadableLink($link['link_file'] ?? 'test-' . uniqid() . '.txt');
133+
$link['link_url'] = '';
134+
}
135+
115136
$links[] = [
116137
'id' => null,
117138
'title' => $link['title'] ?? 'Test Link%uniqid%',
118139
'price' => $link['price'] ?? 0,
119140
'link_type' => $link['link_type'] ?? 'file',
120-
'link_url' => null,
121-
'link_file' => $this->generateDownloadableLink($link['link_file'] ?? 'test-' . uniqid() . '.txt'),
141+
'link_url' => $link['link_url'],
142+
'link_file' => $link['link_file'],
122143
'is_shareable' => $link['is_shareable'] ?? 0,
123144
'number_of_downloads' => $link['number_of_downloads'] ?? 5,
124145
'sort_order' => $link['sort_order'] ?? 10,

app/code/Magento/Indexer/Block/Backend/Grid/Column/Renderer/Scheduled.php

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

8-
use Magento\Customer\Model\Customer;
9-
108
/**
119
* Renderer for 'Scheduled' column in indexer grid
1210
*/
@@ -44,11 +42,10 @@ public function render(\Magento\Framework\DataObject $row)
4442
*
4543
* @param string $indexer
4644
* @return bool
45+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
4746
*/
4847
public function isPreferRealtime(string $indexer): bool
4948
{
50-
return in_array($indexer, [
51-
Customer::CUSTOMER_GRID_INDEXER_ID,
52-
]);
49+
return false;
5350
}
5451
}

app/code/Magento/Indexer/Test/Unit/Block/Backend/Grid/Column/Renderer/ScheduledTest.php

Lines changed: 5 additions & 5 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
declare(strict_types=1);
77

@@ -46,9 +46,9 @@ public function testRender($indexer, $rowValue, $class, $text)
4646
public static function typeProvider()
4747
{
4848
return [
49-
['customer_grid', true, 'grid-severity-major', __('Update by Schedule')],
50-
['customer_grid', false, 'grid-severity-notice', __('Update on Save')],
51-
['customer_grid', '', 'grid-severity-notice', __('Update on Save')],
49+
['customer_grid', true, 'grid-severity-notice', __('Update by Schedule')],
50+
['customer_grid', false, 'grid-severity-major', __('Update on Save')],
51+
['customer_grid', '', 'grid-severity-major', __('Update on Save')],
5252
['catalog_product_price', true, 'grid-severity-notice', __('Update by Schedule')],
5353
['catalog_product_price', false, 'grid-severity-major', __('Update on Save')],
5454
['catalog_product_price', '', 'grid-severity-major', __('Update on Save')],

app/code/Magento/Indexer/composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"php": "~8.2.0||~8.3.0||~8.4.0",
99
"magento/framework": "*",
1010
"magento/framework-amqp": "*",
11-
"magento/module-backend": "*",
12-
"magento/module-customer": "*"
11+
"magento/module-backend": "*"
1312
},
1413
"type": "magento2-module",
1514
"license": [

app/code/Magento/Indexer/etc/module.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2011 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
99
<module name="Magento_Indexer" >
1010
<sequence>
11-
<module name="Magento_Customer"/>
1211
<module name="Magento_Store"/>
1312
<module name="Magento_AdminNotification"/>
1413
</sequence>

app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php

Lines changed: 3 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 2011 Adobe
4+
* All Rights Reserved.
55
*/
66

77
namespace Magento\Multishipping\Model\Checkout\Type;
@@ -703,7 +703,7 @@ protected function _prepareOrder(\Magento\Quote\Model\Quote\Address $address)
703703
$store = $order->getStore();
704704
$amountPrice = $store->getBaseCurrency()
705705
->convert($shippingPrice, $store->getCurrentCurrencyCode());
706-
$order->setBaseShippingAmount($shippingPrice);
706+
$order->setBaseShippingAmount((float)$shippingPrice);
707707
$order->setShippingAmount($amountPrice);
708708

709709
$order->setQuote($quote);
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
/**
3+
* Copyright 2025 Adobe
4+
* All Rights Reserved.
5+
*
6+
* NOTICE: All information contained herein is, and remains
7+
* the property of Adobe and its suppliers, if any. The intellectual
8+
* and technical concepts contained herein are proprietary to Adobe
9+
* and its suppliers and are protected by all applicable intellectual
10+
* property laws, including trade secret and copyright laws.
11+
* Dissemination of this information or reproduction of this material
12+
* is strictly forbidden unless prior written permission is obtained
13+
* from Adobe.
14+
*/
15+
declare(strict_types=1);
16+
17+
namespace Magento\OrderCancellationGraphQl\Model\Validator;
18+
19+
use Magento\OrderCancellation\Model\Config\Config;
20+
use Magento\Sales\Model\Order;
21+
22+
/**
23+
* Validate cancellation reason of order
24+
*/
25+
class ValidateOrderCancellationReason
26+
{
27+
/**
28+
* @var Config $config
29+
*/
30+
private Config $config;
31+
32+
/**
33+
* ValidateOrderCancellationReason Constructor
34+
*
35+
* @param Config $config
36+
*/
37+
public function __construct(
38+
Config $config
39+
) {
40+
$this->config = $config;
41+
}
42+
43+
/**
44+
* Validate cancellation reason
45+
*
46+
* @param Order $order
47+
* @param string $reason
48+
* @return bool
49+
*/
50+
public function validateReason(
51+
Order $order,
52+
string $reason
53+
): bool {
54+
$cancellationReasons = array_map(
55+
'strtolower',
56+
$this->config->getCancellationReasons($order->getStore())
57+
);
58+
59+
return !in_array(strtolower(trim($reason)), $cancellationReasons);
60+
}
61+
}

0 commit comments

Comments
 (0)