Skip to content

Commit 532edee

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-64716' into BUGS
2 parents b80c495 + 9bb7a03 commit 532edee

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

app/code/Magento/Catalog/Setup/UpgradeData.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public function __construct(CategorySetupFactory $categorySetupFactory, EavSetup
4949
/**
5050
* {@inheritdoc}
5151
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
52+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
53+
* @SuppressWarnings(PHPMD.NPathComplexity)
5254
*/
5355
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
5456
{
@@ -360,9 +362,36 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
360362
$this->changePriceAttributeDefaultScope($categorySetup);
361363
}
362364

365+
if (version_compare($context->getVersion(), '2.1.5') < 0) {
366+
$this->dissallowUsingHtmlForProductName($setup);
367+
}
368+
363369
$setup->endSetup();
364370
}
365371

372+
/**
373+
* Set to 'No' 'Is Allowed Html on Store Front' option on product name attribute, because product name
374+
* is multi entity field (used in order, quote) and cannot be conditionally escaped in all places
375+
*
376+
* @param ModuleDataSetupInterface $categorySetup
377+
* @return void
378+
*/
379+
private function dissallowUsingHtmlForProductName(ModuleDataSetupInterface $setup)
380+
{
381+
/** @var CategorySetup $categorySetup */
382+
$categorySetup = $this->categorySetupFactory->create(['setup' => $setup]);
383+
$entityTypeId = $categorySetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
384+
$attribute = $categorySetup->getAttribute($entityTypeId, 'name');
385+
386+
$setup->getConnection()
387+
->update(
388+
$setup->getTable('catalog_eav_attribute'),
389+
['is_html_allowed_on_front' => 0],
390+
$setup->getConnection()->quoteInto('attribute_id = ?', $attribute['attribute_id'])
391+
);
392+
393+
}
394+
366395
/**
367396
* @param \Magento\Catalog\Setup\CategorySetup $categorySetup
368397
* @return void

app/code/Magento/Catalog/etc/eav_attributes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<attribute code="price_type">
3030
<field code="is_searchable" locked="true" />
3131
</attribute>
32+
<attribute code="name">
33+
<field code="is_html_allowed_on_front" locked="true"/>
34+
</attribute>
3235
<attribute code="category_ids">
3336
<field code="is_global" locked="true" />
3437
<field code="is_searchable" locked="true" />

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Catalog" setup_version="2.1.4">
9+
<module name="Magento_Catalog" setup_version="2.1.5">
1010
<sequence>
1111
<module name="Magento_Eav"/>
1212
<module name="Magento_Cms"/>

lib/web/mage/adminhtml/form.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,13 @@ define([
488488

489489
if (isAnInputOrSelect && !isInheritCheckboxChecked) {
490490
if (target) {
491-
target.disabled = false;
491+
if (target.getAttribute('readonly')) {
492+
target.disabled = true;
493+
} else {
494+
target.disabled = false;
495+
}
492496
}
497+
493498
jQuery('#' + idTo).removeClass('ignore-validate');
494499
}
495500
}

0 commit comments

Comments
 (0)