Skip to content

Commit 4204b5c

Browse files
Merge pull request #9659 from magento-cia/cia-2.4.8-develop-bugfix-03052025
Cia 2.4.8 develop bugfix 03052025
2 parents 20064fa + c340f37 commit 4204b5c

File tree

66 files changed

+2731
-414
lines changed

Some content is hidden

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

66 files changed

+2731
-414
lines changed

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
}
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+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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\Plugin\Model;
18+
19+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
20+
use Magento\OrderCancellationGraphQl\Model\Validator\ValidateOrderCancellationReason;
21+
use Magento\Sales\Model\Order;
22+
use Magento\OrderCancellation\Model\CancelOrder as Subject;
23+
24+
/**
25+
* Plugin for cancel order model
26+
*/
27+
class CancelOrder
28+
{
29+
/**
30+
* @var ValidateOrderCancellationReason $validateOrderCancellationReason
31+
*/
32+
private ValidateOrderCancellationReason $validateOrderCancellationReason;
33+
34+
/**
35+
* @param ValidateOrderCancellationReason $validateOrderCancellationReason
36+
*/
37+
public function __construct(
38+
ValidateOrderCancellationReason $validateOrderCancellationReason
39+
) {
40+
$this->validateOrderCancellationReason = $validateOrderCancellationReason;
41+
}
42+
43+
/**
44+
* Before plugin for reason validation
45+
*
46+
* @param Subject $subject
47+
* @param Order $order
48+
* @param string $reason
49+
* @return array
50+
* @throws GraphQlInputException
51+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
52+
*/
53+
public function beforeExecute(
54+
Subject $subject,
55+
Order $order,
56+
string $reason
57+
) {
58+
if (!empty($reason)) {
59+
if ($this->validateOrderCancellationReason->validateReason($order, $reason)) {
60+
throw new GraphQlInputException(__('Order cancellation reason is invalid.'));
61+
}
62+
}
63+
64+
return [$order, $reason];
65+
}
66+
}
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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\Plugin\Model;
18+
19+
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
20+
use Magento\OrderCancellationGraphQl\Model\Validator\ValidateOrderCancellationReason;
21+
use Magento\Sales\Model\Order;
22+
use Magento\OrderCancellationGraphQl\Model\CancelOrderGuest as Subject;
23+
24+
/**
25+
* Plugin for guest cancel order model
26+
*/
27+
class CancelOrderGuest
28+
{
29+
/**
30+
* @var ValidateOrderCancellationReason $validateOrderCancellationReason
31+
*/
32+
private ValidateOrderCancellationReason $validateOrderCancellationReason;
33+
34+
/**
35+
* @param ValidateOrderCancellationReason $validateOrderCancellationReason
36+
*/
37+
public function __construct(
38+
ValidateOrderCancellationReason $validateOrderCancellationReason
39+
) {
40+
$this->validateOrderCancellationReason = $validateOrderCancellationReason;
41+
}
42+
43+
/**
44+
* Before plugin for reason validation
45+
*
46+
* @param Subject $subject
47+
* @param Order $order
48+
* @param array $input
49+
* @return array
50+
* @throws GraphQlInputException
51+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
52+
*/
53+
public function beforeExecute(
54+
Subject $subject,
55+
Order $order,
56+
array $input
57+
) {
58+
if (!empty($input['reason'])) {
59+
if ($this->validateOrderCancellationReason->validateReason($order, $input['reason'])) {
60+
throw new GraphQlInputException(__('Order cancellation reason is invalid.'));
61+
}
62+
}
63+
64+
return [$order, $input];
65+
}
66+
}

app/code/Magento/OrderCancellationGraphQl/etc/graphql/di.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@
3232
</argument>
3333
</arguments>
3434
</type>
35+
<type name="Magento\OrderCancellation\Model\CancelOrder">
36+
<plugin name="validateCancelOrderReason" type="Magento\OrderCancellationGraphQl\Plugin\Model\CancelOrder"/>
37+
</type>
38+
<type name="Magento\OrderCancellationGraphQl\Model\CancelOrderGuest">
39+
<plugin name="validateCancelGuestOrderReason" type="Magento\OrderCancellationGraphQl\Plugin\Model\CancelOrderGuest"/>
40+
</type>
3541
</config>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
"Confirm Your %store_name Order Cancellation","Confirm Your %store_name Order Cancellation"
22
"It seems that you'd like to cancel your order #%order_id. If this is correct, please <a href=""%url_to_confirm"">click here</a> to confirm your cancellation request.","It seems that you'd like to cancel your order #%order_id. If this is correct, please <a href=""%url_to_confirm"">click here</a> to confirm your cancellation request."
3+
"Order cancellation reason is invalid.","Order cancellation reason is invalid."
34

0 commit comments

Comments
 (0)