Skip to content

Commit

Permalink
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Browse files Browse the repository at this point in the history
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
  • Loading branch information
magento-engcom-team authored Sep 5, 2019
2 parents f62adcc + 0f9a187 commit 54244f7
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<dataScope>identifier</dataScope>
</settings>
</field>
<field name="storeviews" formElement="multiselect">
<field name="storeviews" formElement="multiselect" class="Magento\Store\Ui\Component\Form\Field\StoreView">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">block</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected function _prepareForm()
'name' => 'generate_random',
'label' => __('Auto-generate a Key'),
'options' => [0 => __('No'), 1 => __('Yes')],
'onclick' => "var cryptKey = jQuery('#crypt_key'); var cryptKeyBlock = cryptKey.parent().parent(); ".
'onchange' => "var cryptKey = jQuery('#crypt_key'); var cryptKeyBlock = cryptKey.parent().parent(); ".
"cryptKey.prop('disabled', this.value === '1'); " .
"if (cryptKey.prop('disabled')) { cryptKeyBlock.hide() } " .
"else { cryptKeyBlock.show() }",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ protected function _addGeneralFieldset($form, $integrationData)
'label' => __('Callback URL'),
'name' => self::DATA_ENDPOINT,
'disabled' => $disabled,
'class' => 'validate-url',
// @codingStandardsIgnoreStart
'note' => __(
'Enter URL where Oauth credentials can be sent when using Oauth for token exchange. We strongly recommend using https://.'
Expand Down
10 changes: 7 additions & 3 deletions app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\Sales\Model\Order\Pdf;

/**
* Sales Order Creditmemo PDF model
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Creditmemo extends AbstractPdf
Expand Down Expand Up @@ -180,11 +184,11 @@ public function getPdf($creditmemos = [])
}
/* Add totals */
$this->insertTotals($page, $creditmemo);
if ($creditmemo->getStoreId()) {
$this->_localeResolver->revert();
}
}
$this->_afterGetPdf();
if ($creditmemo->getStoreId()) {
$this->_localeResolver->revert();
}
return $pdf;
}

Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/Sitemap/etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@
<label>Sitemap File Limits</label>
<field id="max_lines" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Maximum No of URLs Per File</label>
<validate>validate-number validate-greater-than-zero</validate>
</field>
<field id="max_file_size" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
<label>Maximum File Size</label>
<comment>File size in bytes.</comment>
<validate>validate-number validate-greater-than-zero</validate>
</field>
</group>
<group id="search_engines" translate="label" type="text" sortOrder="6" showInDefault="1" showInWebsite="1" showInStore="1">
Expand Down
61 changes: 61 additions & 0 deletions app/code/Magento/Store/Ui/Component/Form/Field/StoreView.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Store\Ui\Component\Form\Field;

use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Store\Model\StoreManagerInterface as StoreManager;
use Magento\Ui\Component\Form\Field;

/**
* Check to disable store view field
*
* Class \Magento\Store\Ui\Component\Form\Field\StoreView
*/
class StoreView extends Field
{
/**
* Store manager
*
* @var StoreManager
*/
private $storeManager;

/**
* StoreView constructor.
*
* @param ContextInterface $context
* @param UiComponentFactory $uiComponentFactory
* @param StoreManager $storeManager
* @param array $components
* @param array $data
*/
public function __construct(
ContextInterface $context,
UiComponentFactory $uiComponentFactory,
StoreManager $storeManager,
array $components = [],
array $data = []
) {
parent::__construct($context, $uiComponentFactory, $components, $data);
$this->storeManager = $storeManager;
}

/**
* Prepare component configuration
*
* @return void
*/
public function prepare()
{
parent::prepare();
if ($this->storeManager->isSingleStoreMode()) {
$this->_data['config']['componentDisabled'] = true;
}
}
}
14 changes: 0 additions & 14 deletions app/code/Magento/Theme/view/base/layout/default.xml

This file was deleted.

1 change: 1 addition & 0 deletions app/code/Magento/Ui/view/base/layout/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<body>
<referenceContainer name="after.body.start">
<block class="Magento\Ui\Block\Logger" name="logger" template="Magento_Ui::logger.phtml"/>
<block class="Magento\Ui\Block\Wysiwyg\ActiveEditor" name="theme.active.editor" template="Magento_Ui::wysiwyg/active_editor.phtml" />
</referenceContainer>
</body>
</page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Integration\Test\Constraint;

use Magento\Integration\Test\Page\Adminhtml\IntegrationNew;
use Magento\Integration\Test\Fixture\Integration;
use Magento\Mtf\Constraint\AbstractConstraint;
use PHPUnit\Framework\Assert;

/**
* Assert validation error generated when saving integration with invalid callback url.
*/
class AssertUrlValidationErrorGenerated extends AbstractConstraint
{
/**
* Assert validation error generated when saving integration with invalid email.
*
* @param IntegrationNew $integrationNew
* @param Integration $integration
* @return void
*/
public function processAssert(
IntegrationNew $integrationNew,
Integration $integration
) {
$errors = $integrationNew->getIntegrationForm()->getJsErrors("integration_info");
$urlJsError = false;
foreach ($errors as $error) {
if (strpos($error, 'Please enter a valid URL.') !== false) {
$urlJsError = true;
break;
}
}
Assert::assertTrue(
$urlJsError,
'Failed to validate callback url (' . $integration->getEndpoint() . ') when saving integration.'
);
}

/**
* Returns a string representation of successful assertion.
*
* @return string
*/
public function toString()
{
return 'Callback url is properly validated when saving integration.';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@
<data name="integration/data/identity_link_url" xsi:type="string">&lt;script&gt;alert(&apos;XSS&apos;)&lt;/script&gt;</data>
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
<data name="integration/data/resource_access" xsi:type="string">All</data>
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
</variation>
<variation name="CreateIntegrationEntityTestVariation5" summary="Input fields with javascript tag" ticketId="MAGETWO-16819">
<data name="integration/data/name" xsi:type="string">&lt;IMG SRC=javascript:alert(&apos;XSS-%isolation%&apos;)&gt;</data>
Expand All @@ -55,10 +53,8 @@
<data name="integration/data/identity_link_url" xsi:type="string">&lt;IMG SRC=javascript:alert(&apos;XSS&apos;)&gt;</data>
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
<data name="integration/data/resource_access" xsi:type="string">All</data>
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
</variation>
<variation name="CreateIntegrationEntityTestVariation6" summary="Input fields with single quote" ticketId="MAGETWO-16820">
<data name="integration/data/name" xsi:type="string">name-%isolation%&apos; OR &apos;a&apos;=&apos;a</data>
Expand All @@ -67,10 +63,8 @@
<data name="integration/data/identity_link_url" xsi:type="string">link&apos; OR &apos;a&apos;=&apos;a</data>
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
<data name="integration/data/resource_access" xsi:type="string">All</data>
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
</variation>
<variation name="CreateIntegrationEntityTestVariation7" summary="Input fields with double quote" ticketId="MAGETWO-16820">
<data name="integration/data/name" xsi:type="string">name-%isolation%&quot; OR &quot;a&quot;=&quot;a</data>
Expand All @@ -79,10 +73,8 @@
<data name="integration/data/identity_link_url" xsi:type="string">link&quot; OR &quot;a&quot;=&quot;a</data>
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
<data name="integration/data/resource_access" xsi:type="string">All</data>
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
</variation>
<variation name="CreateIntegrationEntityTestVariation8" summary="Input fields with single and double quote" ticketId="MAGETWO-16820">
<data name="integration/data/name" xsi:type="string">name-%isolation%&quot; OR &apos;a&quot;=&apos;a</data>
Expand All @@ -91,10 +83,8 @@
<data name="integration/data/identity_link_url" xsi:type="string">link&quot; OR &apos;a&quot;=&apos;a</data>
<data name="integration/data/current_password" xsi:type="string">%current_password%</data>
<data name="integration/data/resource_access" xsi:type="string">All</data>
<constraint name="Magento\Integration\Test\Constraint\AssertNoAlertPopup" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessage" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationForm" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationInGrid" />
<constraint name="Magento\Integration\Test\Constraint\AssertUrlValidationErrorGenerated" />
<constraint name="Magento\Integration\Test\Constraint\AssertIntegrationSuccessSaveMessageNotPresent" />
</variation>
<variation name="CreateIntegrationEntityTestVariation9" summary="Invalid Email: abc.example.com" ticketId="MAGETWO-16755">
<data name="integration/data/name" xsi:type="string">Integration%isolation%</data>
Expand Down
1 change: 1 addition & 0 deletions lib/internal/Magento/Framework/MessageQueue/etc/queue.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<xs:annotation>
<xs:documentation>
@deprecated
Deprecated for RabbitMQ connection.
</xs:documentation>
</xs:annotation>
<xs:complexType>
Expand Down
9 changes: 6 additions & 3 deletions lib/internal/Magento/Framework/Simplexml/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ class Element extends \SimpleXMLElement
* @param \Magento\Framework\Simplexml\Element $element
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* phpcs:disable Magento2.CodeAnalysis.EmptyBlock
*/
public function setParent($element)
{
//$this->_parent = $element;
}
// phpcs:enable

/**
* Returns parent node for the element
Expand Down Expand Up @@ -179,7 +180,8 @@ public function asArray()
}

/**
* asArray() analog, but without attributes
* The asArray() analog, but without attributes
*
* @return array|string
*/
public function asCanonicalArray()
Expand Down Expand Up @@ -245,7 +247,7 @@ public function asNiceXml($filename = '', $level = 0)
$attributes = $this->attributes();
if ($attributes) {
foreach ($attributes as $key => $value) {
$out .= ' ' . $key . '="' . str_replace('"', '\"', (string)$value) . '"';
$out .= ' ' . $key . '="' . str_replace('"', '\"', $this->xmlentities($value)) . '"';
}
}

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

0 comments on commit 54244f7

Please sign in to comment.