Skip to content

Commit 54244f7

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - magento#24447: magento/magento2#: Incorrect annotation in the Magento/Framework/MessageQueue/etc/queue.xsd schema (by @atwixfirster) - magento#24434: [Integration] Adding the integration callback url validation (by @eduard13) - magento#24437: [EncryptionKey] Fixing the encryption key switching field (by @eduard13) - magento#24397: Resolve "New Block" form still show "Store View" field in "Single Store Mode" issue24387 (by @edenduong) - magento#24336: magento#2228; Encode xml entities in tag attributes (by @sergey-solo) - magento#24093: Move WYSIWYG adapter to adminhtml theme Ui module (by @sankalpshekhar) - magento#24358: Add number validation for sitemap file limits (by @ravi-chandra3197) - magento#24282: Resolve undefined variable when call getPdf() in app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php (by @edenduong) Fixed GitHub Issues: - magento#24436: Autogenerating encryption key requires manually entering the key (reported by @eduard13) has been fixed in magento#24437 by @eduard13 in 2.3-develop branch Related commits: 1. c413b69 - magento#24387: "New Block" form still show "Store View" field in "Single Store Mode" (reported by @edenduong) has been fixed in magento#24397 by @edenduong in 2.3-develop branch Related commits: 1. 24c022e 2. aaa7379 - magento#2228: Problem with adding google fonts with ampersand into default_head_blocks.xml (reported by @luckyraul) has been fixed in magento#24336 by @sergey-solo in 2.3-develop branch Related commits: 1. de8028e 2. 781e7bb 3. ada83e4 4. 5eaef76
2 parents f62adcc + 0f9a187 commit 54244f7

File tree

12 files changed

+144
-42
lines changed

12 files changed

+144
-42
lines changed

app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
<dataScope>identifier</dataScope>
112112
</settings>
113113
</field>
114-
<field name="storeviews" formElement="multiselect">
114+
<field name="storeviews" formElement="multiselect" class="Magento\Store\Ui\Component\Form\Field\StoreView">
115115
<argument name="data" xsi:type="array">
116116
<item name="config" xsi:type="array">
117117
<item name="source" xsi:type="string">block</item>

app/code/Magento/EncryptionKey/Block/Adminhtml/Crypt/Key/Form.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function _prepareForm()
4545
'name' => 'generate_random',
4646
'label' => __('Auto-generate a Key'),
4747
'options' => [0 => __('No'), 1 => __('Yes')],
48-
'onclick' => "var cryptKey = jQuery('#crypt_key'); var cryptKeyBlock = cryptKey.parent().parent(); ".
48+
'onchange' => "var cryptKey = jQuery('#crypt_key'); var cryptKeyBlock = cryptKey.parent().parent(); ".
4949
"cryptKey.prop('disabled', this.value === '1'); " .
5050
"if (cryptKey.prop('disabled')) { cryptKeyBlock.hide() } " .
5151
"else { cryptKeyBlock.show() }",

app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ protected function _addGeneralFieldset($form, $integrationData)
146146
'label' => __('Callback URL'),
147147
'name' => self::DATA_ENDPOINT,
148148
'disabled' => $disabled,
149+
'class' => 'validate-url',
149150
// @codingStandardsIgnoreStart
150151
'note' => __(
151152
'Enter URL where Oauth credentials can be sent when using Oauth for token exchange. We strongly recommend using https://.'

app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Sales\Model\Order\Pdf;
710

811
/**
912
* Sales Order Creditmemo PDF model
13+
*
1014
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1115
*/
1216
class Creditmemo extends AbstractPdf
@@ -180,11 +184,11 @@ public function getPdf($creditmemos = [])
180184
}
181185
/* Add totals */
182186
$this->insertTotals($page, $creditmemo);
187+
if ($creditmemo->getStoreId()) {
188+
$this->_localeResolver->revert();
189+
}
183190
}
184191
$this->_afterGetPdf();
185-
if ($creditmemo->getStoreId()) {
186-
$this->_localeResolver->revert();
187-
}
188192
return $pdf;
189193
}
190194

app/code/Magento/Sitemap/etc/adminhtml/system.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@
8383
<label>Sitemap File Limits</label>
8484
<field id="max_lines" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
8585
<label>Maximum No of URLs Per File</label>
86+
<validate>validate-number validate-greater-than-zero</validate>
8687
</field>
8788
<field id="max_file_size" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
8889
<label>Maximum File Size</label>
8990
<comment>File size in bytes.</comment>
91+
<validate>validate-number validate-greater-than-zero</validate>
9092
</field>
9193
</group>
9294
<group id="search_engines" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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\Store\Ui\Component\Form\Field;
9+
10+
use Magento\Framework\View\Element\UiComponent\ContextInterface;
11+
use Magento\Framework\View\Element\UiComponentFactory;
12+
use Magento\Store\Model\StoreManagerInterface as StoreManager;
13+
use Magento\Ui\Component\Form\Field;
14+
15+
/**
16+
* Check to disable store view field
17+
*
18+
* Class \Magento\Store\Ui\Component\Form\Field\StoreView
19+
*/
20+
class StoreView extends Field
21+
{
22+
/**
23+
* Store manager
24+
*
25+
* @var StoreManager
26+
*/
27+
private $storeManager;
28+
29+
/**
30+
* StoreView constructor.
31+
*
32+
* @param ContextInterface $context
33+
* @param UiComponentFactory $uiComponentFactory
34+
* @param StoreManager $storeManager
35+
* @param array $components
36+
* @param array $data
37+
*/
38+
public function __construct(
39+
ContextInterface $context,
40+
UiComponentFactory $uiComponentFactory,
41+
StoreManager $storeManager,
42+
array $components = [],
43+
array $data = []
44+
) {
45+
parent::__construct($context, $uiComponentFactory, $components, $data);
46+
$this->storeManager = $storeManager;
47+
}
48+
49+
/**
50+
* Prepare component configuration
51+
*
52+
* @return void
53+
*/
54+
public function prepare()
55+
{
56+
parent::prepare();
57+
if ($this->storeManager->isSingleStoreMode()) {
58+
$this->_data['config']['componentDisabled'] = true;
59+
}
60+
}
61+
}

app/code/Magento/Theme/view/base/layout/default.xml

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/code/Magento/Ui/view/base/layout/default.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<body>
1010
<referenceContainer name="after.body.start">
1111
<block class="Magento\Ui\Block\Logger" name="logger" template="Magento_Ui::logger.phtml"/>
12+
<block class="Magento\Ui\Block\Wysiwyg\ActiveEditor" name="theme.active.editor" template="Magento_Ui::wysiwyg/active_editor.phtml" />
1213
</referenceContainer>
1314
</body>
1415
</page>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Integration\Test\Constraint;
8+
9+
use Magento\Integration\Test\Page\Adminhtml\IntegrationNew;
10+
use Magento\Integration\Test\Fixture\Integration;
11+
use Magento\Mtf\Constraint\AbstractConstraint;
12+
use PHPUnit\Framework\Assert;
13+
14+
/**
15+
* Assert validation error generated when saving integration with invalid callback url.
16+
*/
17+
class AssertUrlValidationErrorGenerated extends AbstractConstraint
18+
{
19+
/**
20+
* Assert validation error generated when saving integration with invalid email.
21+
*
22+
* @param IntegrationNew $integrationNew
23+
* @param Integration $integration
24+
* @return void
25+
*/
26+
public function processAssert(
27+
IntegrationNew $integrationNew,
28+
Integration $integration
29+
) {
30+
$errors = $integrationNew->getIntegrationForm()->getJsErrors("integration_info");
31+
$urlJsError = false;
32+
foreach ($errors as $error) {
33+
if (strpos($error, 'Please enter a valid URL.') !== false) {
34+
$urlJsError = true;
35+
break;
36+
}
37+
}
38+
Assert::assertTrue(
39+
$urlJsError,
40+
'Failed to validate callback url (' . $integration->getEndpoint() . ') when saving integration.'
41+
);
42+
}
43+
44+
/**
45+
* Returns a string representation of successful assertion.
46+
*
47+
* @return string
48+
*/
49+
public function toString()
50+
{
51+
return 'Callback url is properly validated when saving integration.';
52+
}
53+
}

dev/tests/functional/tests/app/Magento/Integration/Test/TestCase/CreateIntegrationEntityTest.xml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@
4343
<data name="integration/data/identity_link_url" xsi:type="string">&lt;script&gt;alert(&apos;XSS&apos;)&lt;/script&gt;</data>
4444
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
4545
<data name="integration/data/resource_access" xsi:type="string">All</data>
46-
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
47-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
48-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
49-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
46+
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
47+
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
5048
</variation>
5149
<variation name="CreateIntegrationEntityTestVariation5" summary="Input fields with javascript tag" ticketId="MAGETWO-16819">
5250
<data name="integration/data/name" xsi:type="string">&lt;IMG SRC=javascript:alert(&apos;XSS-%isolation%&apos;)&gt;</data>
@@ -55,10 +53,8 @@
5553
<data name="integration/data/identity_link_url" xsi:type="string">&lt;IMG SRC=javascript:alert(&apos;XSS&apos;)&gt;</data>
5654
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
5755
<data name="integration/data/resource_access" xsi:type="string">All</data>
58-
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
59-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
60-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
61-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
56+
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
57+
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
6258
</variation>
6359
<variation name="CreateIntegrationEntityTestVariation6" summary="Input fields with single quote" ticketId="MAGETWO-16820">
6460
<data name="integration/data/name" xsi:type="string">name-%isolation%&apos; OR &apos;a&apos;=&apos;a</data>
@@ -67,10 +63,8 @@
6763
<data name="integration/data/identity_link_url" xsi:type="string">link&apos; OR &apos;a&apos;=&apos;a</data>
6864
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
6965
<data name="integration/data/resource_access" xsi:type="string">All</data>
70-
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
71-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
72-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
73-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
66+
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
67+
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
7468
</variation>
7569
<variation name="CreateIntegrationEntityTestVariation7" summary="Input fields with double quote" ticketId="MAGETWO-16820">
7670
<data name="integration/data/name" xsi:type="string">name-%isolation%&quot; OR &quot;a&quot;=&quot;a</data>
@@ -79,10 +73,8 @@
7973
<data name="integration/data/identity_link_url" xsi:type="string">link&quot; OR &quot;a&quot;=&quot;a</data>
8074
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
8175
<data name="integration/data/resource_access" xsi:type="string">All</data>
82-
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
83-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
84-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
85-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
76+
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
77+
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
8678
</variation>
8779
<variation name="CreateIntegrationEntityTestVariation8" summary="Input fields with single and double quote" ticketId="MAGETWO-16820">
8880
<data name="integration/data/name" xsi:type="string">name-%isolation%&quot; OR &apos;a&quot;=&apos;a</data>
@@ -91,10 +83,8 @@
9183
<data name="integration/data/identity_link_url" xsi:type="string">link&quot; OR &apos;a&quot;=&apos;a</data>
9284
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
9385
<data name="integration/data/resource_access" xsi:type="string">All</data>
94-
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
95-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
96-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
97-
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
86+
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
87+
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
9888
</variation>
9989
<variation name="CreateIntegrationEntityTestVariation9" summary="Invalid Email: abc.example.com" ticketId="MAGETWO-16755">
10090
<data name="integration/data/name" xsi:type="string">Integration%isolation%</data>

lib/internal/Magento/Framework/MessageQueue/etc/queue.xsd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<xs:annotation>
1212
<xs:documentation>
1313
@deprecated
14+
Deprecated for RabbitMQ connection.
1415
</xs:documentation>
1516
</xs:annotation>
1617
<xs:complexType>

lib/internal/Magento/Framework/Simplexml/Element.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ class Element extends \SimpleXMLElement
3030
* @param \Magento\Framework\Simplexml\Element $element
3131
* @return void
3232
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
33+
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
3334
*/
3435
public function setParent($element)
3536
{
36-
//$this->_parent = $element;
3737
}
38+
// phpcs:enable
3839

3940
/**
4041
* Returns parent node for the element
@@ -179,7 +180,8 @@ public function asArray()
179180
}
180181

181182
/**
182-
* asArray() analog, but without attributes
183+
* The asArray() analog, but without attributes
184+
*
183185
* @return array|string
184186
*/
185187
public function asCanonicalArray()
@@ -245,7 +247,7 @@ public function asNiceXml($filename = '', $level = 0)
245247
$attributes = $this->attributes();
246248
if ($attributes) {
247249
foreach ($attributes as $key => $value) {
248-
$out .= ' ' . $key . '="' . str_replace('"', '\"', (string)$value) . '"';
250+
$out .= ' ' . $key . '="' . str_replace('"', '\"', $this->xmlentities($value)) . '"';
249251
}
250252
}
251253

@@ -471,6 +473,7 @@ public function setNode($path, $value, $overwrite = true)
471473
* Unset self from the XML-node tree
472474
*
473475
* Note: trying to refer this object as a variable after "unsetting" like this will result in E_WARNING
476+
*
474477
* @return void
475478
*/
476479
public function unsetSelf()

0 commit comments

Comments
 (0)