Skip to content

Commit 4df631b

Browse files
authored
Merge pull request #4232 from magento-tsg/2.2.9-develop-pr97
[TSG] Fixes for 2.2.9 (pr97) (2.2.9-develop)
2 parents 433fea7 + 6850877 commit 4df631b

File tree

6 files changed

+59
-17
lines changed

6 files changed

+59
-17
lines changed

app/code/Magento/Sales/Controller/Guest/View.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,10 @@ public function __construct(
5353
*/
5454
public function execute()
5555
{
56-
if (!$this->getRequest()->isPost()) {
57-
throw new \Magento\Framework\Exception\NotFoundException(__('Page not found.'));
58-
}
59-
if (!$this->formKeyValidator->validate($this->getRequest())) {
60-
return $this->resultRedirectFactory->create()->setPath('*/*/form/');
56+
if ($this->getRequest()->isPost()) {
57+
if (!$this->formKeyValidator->validate($this->getRequest())) {
58+
return $this->resultRedirectFactory->create()->setPath('*/*/form/');
59+
}
6160
}
6261

6362
$result = $this->guestHelper->loadValidOrder($this->getRequest());

app/code/Magento/Sales/Helper/Admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ public function escapeHtmlWithLinks($data, $allowedTags = null)
165165

166166
$internalErrors = libxml_use_internal_errors(true);
167167

168+
$data = mb_convert_encoding($data, 'HTML-ENTITIES', 'UTF-8');
168169
$domDocument->loadHTML(
169170
'<html><body id="' . $wrapperElementId . '">' . $data . '</body></html>'
170171
);

app/code/Magento/Swatches/view/adminhtml/web/css/swatches.css

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,12 @@
153153
min-width: 65px;
154154
}
155155

156-
[class^=swatch-col],
157-
[class^=col-]:not(.col-draggable):not(.col-default) {
158-
min-width: 150px;
159-
}
160-
161-
#swatch-visual-options-panel,
162-
#swatch-text-options-panel,
163-
#manage-options-panel {
164-
overflow: auto;
165-
width: 100%;
156+
.data-table .col-swatch-min-width input[type="text"] {
157+
padding: inherit;
166158
}
167159

168160
.swatches-visual-col.unavailable:after {
161+
content: '';
169162
position: absolute;
170163
width: 35px;
171164
height: 2px;

app/code/Magento/Ups/view/adminhtml/templates/system/shipping/carrier_config.phtml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ require(["prototype"], function(){
6767
upsXml.prototype = {
6868
initialize: function()
6969
{
70+
this.carriersUpsActiveId = 'carriers_ups_active';
7071
this.carriersUpsTypeId = 'carriers_ups_type';
7172
if (!$(this.carriersUpsTypeId)) {
7273
return;
@@ -94,6 +95,7 @@ require(["prototype"], function(){
9495

9596
this.setFormValues();
9697
Event.observe($(this.carriersUpsTypeId), 'change', this.setFormValues.bind(this));
98+
Event.observe($(this.carriersUpsActiveId), 'change', this.setFormValues.bind(this));
9799
},
98100
updateAllowedMethods: function(originShipmentTitle)
99101
{
@@ -148,7 +150,8 @@ require(["prototype"], function(){
148150
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');
149151
}
150152
for (a = 0; a < this.checkingUpsId.length; a++) {
151-
$(this.checkingUpsXmlId[a]).addClassName('required-entry');
153+
$(this.checkingUpsId[a]).addClassName('required-entry');
154+
this.changeFieldsDisabledState(this.checkingUpsId, a);
152155
}
153156
Event.stopObserving($('carriers_ups_origin_shipment'), 'change', this.changeOriginShipment.bind(this));
154157
showRowArrayElements(this.onlyUpsElements);
@@ -157,9 +160,10 @@ require(["prototype"], function(){
157160
} else {
158161
for (a = 0; a < this.checkingUpsXmlId.length; a++) {
159162
$(this.checkingUpsXmlId[a]).addClassName('required-entry');
163+
this.changeFieldsDisabledState(this.checkingUpsXmlId, a);
160164
}
161165
for (a = 0; a < this.checkingUpsId.length; a++) {
162-
$(this.checkingUpsXmlId[a]).removeClassName('required-entry');
166+
$(this.checkingUpsId[a]).removeClassName('required-entry');
163167
}
164168
Event.observe($('carriers_ups_origin_shipment'), 'change', this.changeOriginShipment.bind(this));
165169
showRowArrayElements(this.onlyUpsXmlElements);
@@ -171,6 +175,16 @@ require(["prototype"], function(){
171175
{
172176
this.originShipmentTitle = key ? key : $F('carriers_ups_origin_shipment');
173177
this.updateAllowedMethods(this.originShipmentTitle);
178+
},
179+
changeFieldsDisabledState: function (fields, key) {
180+
$(fields[key]).disabled = $F(this.carriersUpsActiveId) !== '1'
181+
|| $(fields[key] + '_inherit') !== null
182+
&& $F(fields[key] + '_inherit') === '1';
183+
184+
if ($(fields[key]).next() !== undefined) {
185+
$(fields[key]).removeClassName('mage-error').next().remove();
186+
$(fields[key]).removeAttribute('style');
187+
}
174188
}
175189
};
176190
xml = new upsXml();
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Sales\Controller\Guest;
9+
10+
use Magento\TestFramework\Request;
11+
use Magento\TestFramework\TestCase\AbstractController;
12+
13+
/**
14+
* Test for \Magento\Sales\Controller\Guest\View class.
15+
*/
16+
class ViewTest extends AbstractController
17+
{
18+
/**
19+
* Check that controller applied GET requests.
20+
*/
21+
public function testExecuteWithGetRequest()
22+
{
23+
$this->getRequest()->setMethod(Request::METHOD_GET);
24+
$this->dispatch('sales/guest/view/');
25+
26+
$this->assertRedirect($this->stringContains('sales/guest/form'));
27+
}
28+
}

dev/tests/integration/testsuite/Magento/Sales/Helper/AdminTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ public function escapeHtmlWithLinksDataProvider(): array
5252
'&lt;a&gt;some text in tags&lt;/a&gt;',
5353
'allowedTags' => null,
5454
],
55+
[
56+
// @codingStandardsIgnoreStart
57+
'Authorized amount of €30.00. Transaction ID: "<a target="_blank" href="https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&id=123456789QWERTY">123456789QWERTY</a>"',
58+
'Authorized amount of €30.00. Transaction ID: &quot;<a href="https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_view-a-trans&amp;id=123456789QWERTY">123456789QWERTY</a>&quot;',
59+
// @codingStandardsIgnoreEnd
60+
'allowedTags' => ['b', 'br', 'strong', 'i', 'u', 'a'],
61+
],
5562
[
5663
'Transaction ID: "<a target="_blank" href="https://www.paypal.com/?id=XX123XX">XX123XX</a>"',
5764
'Transaction ID: &quot;<a href="https://www.paypal.com/?id=XX123XX">XX123XX</a>&quot;',

0 commit comments

Comments
 (0)