Skip to content

Commit 820cace

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-67718
2 parents ed4a78a + 15d3681 commit 820cace

File tree

148 files changed

+3266
-1355
lines changed

Some content is hidden

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

148 files changed

+3266
-1355
lines changed

app/code/Magento/Braintree/view/frontend/templates/paypal/vault_token.phtml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,22 @@ use Magento\Vault\Api\Data\PaymentTokenInterface;
99

1010
/** @var VaultTokenRenderer $block */
1111

12-
$payerEmail = $block->escapeHtml($block->getPayerEmail());
12+
$payerEmail = $block->getPayerEmail();
13+
$confirmDeleteMessage = sprintf('%s: %s?', __('Are you sure you want to delete this PayPal account'), $payerEmail);
1314
?>
1415
<tr>
1516
<td data-th="<?php echo $block->escapeHtml(__('PayPal Account')); ?>" class="col paypal-account">
1617
<img src="<?php /* @noEscape */ echo $block->getIconUrl(); ?>"
1718
width="<?php /* @noEscape */ echo $block->getIconWidth(); ?>"
1819
height="<?php /* @noEscape */ echo $block->getIconHeight(); ?>"
19-
alt="<?php echo $block->escapeHtml(__('PayPal Logo')); ?>"
20-
>
21-
<span><?php /* @noEscape */ echo $payerEmail; ?></span>
20+
alt="<?php echo $block->escapeHtml(__('PayPal Logo')); ?>">
21+
<span><?php echo $block->escapeHtml($payerEmail); ?></span>
2222
</td>
2323
<td data-th="<?php echo $block->escapeHtml(__('Actions')); ?>" class="col actions">
2424
<form
2525
class="form"
2626
action="<?php echo $block->escapeUrl($block->getUrl('vault/cards/deleteaction')); ?>"
27-
method="post"
28-
>
27+
method="post">
2928
<?php echo $block->getBlockHtml('formkey'); ?>
3029
<input
3130
name="<?php /* @noEscape */ echo PaymentTokenInterface::PUBLIC_HASH; ?>"
@@ -34,15 +33,14 @@ $payerEmail = $block->escapeHtml($block->getPayerEmail());
3433
<button type="submit"
3534
class="action delete"
3635
data-mage-init='{
37-
"Magento_Vault/js/customer_account/deleteWidget":{
38-
"type": "popup",
39-
"modalClass": "my-credit-cards-popup",
40-
"toggleEvent": "click",
41-
"title": "<?php echo $block->escapeHtml(__('Delete')); ?>",
42-
"content": "Are you sure you want to delete this PayPal account:
43-
<?php /* @noEscape */ echo $payerEmail; ?>?"
44-
}
45-
}'>
36+
"Magento_Vault/js/customer_account/deleteWidget":{
37+
"type": "popup",
38+
"modalClass": "my-credit-cards-popup",
39+
"toggleEvent": "click",
40+
"title": "<?php echo $block->escapeHtml(__('Delete')); ?>",
41+
"content":"<?php echo $block->escapeHtml($confirmDeleteMessage); ?>"
42+
}
43+
}'>
4644
<span><?php echo $block->escapeHtml(__('Delete')); ?></span>
4745
</button>
4846
</form>

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ public function addPriceFilter($product, $searchMin, $useRegularPrice = false)
296296
if ($product->getPriceType() == \Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC) {
297297
$this->addPriceData();
298298
if ($useRegularPrice) {
299-
$minimalPriceExpression = 'price';
299+
$minimalPriceExpression = self::INDEX_TABLE_ALIAS . '.price';
300300
} else {
301301
$this->getCatalogRuleProcessor()->addPriceData($this, 'selection.product_id');
302302
$minimalPriceExpression = 'LEAST(minimal_price, IFNULL(catalog_rule_price, minimal_price))';

app/code/Magento/Bundle/Test/Unit/Block/Adminhtml/Sales/Order/View/Items/RendererTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function getSelectionAttributesDataProvider()
170170
{
171171
return [
172172
[[], null],
173-
[['bundle_selection_attributes' => 'a:1:{i:0;i:1;}'], [0 => 1]],
173+
[['bundle_selection_attributes' => 'serialized string'], [0 => 1]],
174174
];
175175
}
176176

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2288,7 +2288,7 @@ public function addMediaGalleryData()
22882288
return $this;
22892289
}
22902290

2291-
if (!$this->count()) {
2291+
if (!$this->getSize()) {
22922292
return $this;
22932293
}
22942294

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
/**
1717
* Upgrade Data script
18-
* @codeCoverageIgnore
18+
*
1919
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2020
*/
2121
class UpgradeData implements UpgradeDataInterface
@@ -35,15 +35,25 @@ class UpgradeData implements UpgradeDataInterface
3535
private $eavSetupFactory;
3636

3737
/**
38-
* Init
38+
* @var UpgradeWidgetData
39+
*/
40+
private $upgradeWidgetData;
41+
42+
/**
43+
* Constructor
3944
*
4045
* @param CategorySetupFactory $categorySetupFactory
4146
* @param EavSetupFactory $eavSetupFactory
47+
* @param UpgradeWidgetData $upgradeWidgetData
4248
*/
43-
public function __construct(CategorySetupFactory $categorySetupFactory, EavSetupFactory $eavSetupFactory)
44-
{
49+
public function __construct(
50+
CategorySetupFactory $categorySetupFactory,
51+
EavSetupFactory $eavSetupFactory,
52+
UpgradeWidgetData $upgradeWidgetData
53+
) {
4554
$this->categorySetupFactory = $categorySetupFactory;
4655
$this->eavSetupFactory = $eavSetupFactory;
56+
$this->upgradeWidgetData = $upgradeWidgetData;
4757
}
4858

4959
/**
@@ -366,6 +376,9 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
366376
$this->dissallowUsingHtmlForProductName($setup);
367377
}
368378

379+
if ($context->getVersion() && version_compare($context->getVersion(), '2.2.1') < 0) {
380+
$this->upgradeWidgetData->upgrade();
381+
}
369382
$setup->endSetup();
370383
}
371384

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Setup;
7+
8+
use Magento\Framework\DB\Select\QueryModifierFactory;
9+
use Magento\Widget\Setup\LayoutUpdateConverter;
10+
use Magento\Eav\Setup\EavSetup;
11+
use Magento\Framework\DB\FieldToConvert;
12+
use Magento\Framework\DB\AggregatedFieldDataConverter;
13+
14+
/**
15+
* Convert serialized widget data for categories and products tables to JSON
16+
*/
17+
class UpgradeWidgetData
18+
{
19+
/**
20+
* @var EavSetup
21+
*/
22+
private $eavSetup;
23+
24+
/**
25+
* @var QueryModifierFactory
26+
*/
27+
private $queryModifierFactory;
28+
29+
/**
30+
* Constructor
31+
*
32+
* @param EavSetup $eavSetup
33+
* @param QueryModifierFactory $queryModifierFactory
34+
* @param AggregatedFieldDataConverter $aggregatedFieldDataConverter
35+
*/
36+
public function __construct(
37+
EavSetup $eavSetup,
38+
QueryModifierFactory $queryModifierFactory,
39+
AggregatedFieldDataConverter $aggregatedFieldDataConverter
40+
) {
41+
$this->eavSetup = $eavSetup;
42+
$this->queryModifierFactory = $queryModifierFactory;
43+
$this->aggregatedFieldDataConverter = $aggregatedFieldDataConverter;
44+
}
45+
46+
/**
47+
* Convert category and product layout update
48+
*
49+
* @return void
50+
* @throws \InvalidArgumentException
51+
*/
52+
public function upgrade()
53+
{
54+
$categoryTypeId = $this->eavSetup->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY);
55+
$categoryLayoutUpdateAttribute = $this->eavSetup->getAttribute($categoryTypeId, 'custom_layout_update');
56+
$categoryLayoutUpdateAttributeModifier = $this->queryModifierFactory->create(
57+
'in',
58+
[
59+
'values' => [
60+
'attribute_id' => $categoryLayoutUpdateAttribute['attribute_id']
61+
]
62+
]
63+
);
64+
$layoutUpdateValueModifier = $this->queryModifierFactory->create(
65+
'like',
66+
[
67+
'values' => [
68+
'value' => '%conditions_encoded%'
69+
]
70+
]
71+
);
72+
$categoryLayoutUpdateModifier = $this->queryModifierFactory->create(
73+
'composite',
74+
[
75+
'queryModifiers' => [
76+
$categoryLayoutUpdateAttributeModifier,
77+
$layoutUpdateValueModifier
78+
]
79+
]
80+
);
81+
$productTypeId = $this->eavSetup->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY);
82+
$productLayoutUpdateAttribute = $this->eavSetup->getAttribute($productTypeId, 'custom_layout_update');
83+
$productLayoutUpdateAttributeModifier = $this->queryModifierFactory->create(
84+
'in',
85+
[
86+
'values' => [
87+
'attribute_id' => $productLayoutUpdateAttribute['attribute_id']
88+
]
89+
]
90+
);
91+
$productLayoutUpdateModifier = $this->queryModifierFactory->create(
92+
'composite',
93+
[
94+
'queryModifiers' => [
95+
$productLayoutUpdateAttributeModifier,
96+
$layoutUpdateValueModifier
97+
]
98+
]
99+
);
100+
$this->aggregatedFieldDataConverter->convert(
101+
[
102+
new FieldToConvert(
103+
LayoutUpdateConverter::class,
104+
$this->eavSetup->getSetup()->getTable('catalog_category_entity_text'),
105+
'value_id',
106+
'value',
107+
$categoryLayoutUpdateModifier
108+
),
109+
new FieldToConvert(
110+
LayoutUpdateConverter::class,
111+
$this->eavSetup->getSetup()->getTable('catalog_product_entity_text'),
112+
'value_id',
113+
'value',
114+
$productLayoutUpdateModifier
115+
),
116+
],
117+
$this->eavSetup->getSetup()->getConnection()
118+
);
119+
}
120+
}

app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ public function testAddMediaGalleryData()
258258
$this->metadataPoolMock->expects($this->once())->method('getMetadata')->willReturn($metadataMock);
259259
$metadataMock->expects($this->once())->method('getLinkField')->willReturn($linkField);
260260

261+
$this->connectionMock->expects($this->once())->method('fetchOne')->with($selectMock)->willReturn(42);
261262
$this->connectionMock->expects($this->once())->method('fetchAll')->with($selectMock)->willReturn(
262263
[['row_id' => $rowId]]
263264
);

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/Form/Modifier/TierPriceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testModifyMeta()
6969
'data' => [
7070
'config' => [
7171
'visible' => true,
72-
'validation' => ['validate-number' => true],
72+
'validation' => ['validate-zero-or-greater' => true],
7373
],
7474
],
7575
],

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/TierPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private function getUpdatedTierPriceStructure(array $priceMeta)
9797
$priceMeta['arguments']['data']['config']['visible'] = $firstOption
9898
&& $firstOption['value'] == ProductPriceOptionsInterface::VALUE_FIXED;
9999
$priceMeta['arguments']['data']['config']['validation'] = [
100-
'validate-number' => true,
100+
'validate-zero-or-greater' => true
101101
];
102102
return [
103103
'price_value' => [

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.2.0">
9+
<module name="Magento_Catalog" setup_version="2.2.1">
1010
<sequence>
1111
<module name="Magento_Eav"/>
1212
<module name="Magento_Cms"/>

0 commit comments

Comments
 (0)