Skip to content

Commit 294c09e

Browse files
author
Oleksii Korshenko
authored
Merge branch '2.2-develop' into feature-newsletter-subscribe-button-title-wrapped
2 parents f83956b + dc4e82c commit 294c09e

File tree

53 files changed

+455
-115
lines changed

Some content is hidden

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

53 files changed

+455
-115
lines changed

Diff for: COPYING.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright © 2013-2017 Magento, Inc.
1+
Copyright © 2013-2018 Magento, Inc.
22

33
Each Magento source file included in this distribution is licensed under OSL 3.0 or the Magento Enterprise Edition (MEE) license
44

Diff for: app/code/Magento/Backend/etc/adminhtml/system.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@
215215
<label>European Union Countries</label>
216216
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
217217
</field>
218-
<field id="destinations" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
218+
<field id="destinations" translate="label" type="multiselect" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
219219
<label>Top destinations</label>
220220
<source_model>Magento\Directory\Model\Config\Source\Country</source_model>
221221
</field>

Diff for: app/code/Magento/Backup/Model/Db.php

+1
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ public function createBackup(\Magento\Framework\Backup\Db\BackupInterface $backu
173173
}
174174
}
175175
$backup->write($this->getResource()->getTableForeignKeysSql());
176+
$backup->write($this->getResource()->getTableTriggersSql());
176177
$backup->write($this->getResource()->getFooter());
177178

178179
$this->getResource()->commitTransaction();

Diff for: app/code/Magento/Backup/Model/ResourceModel/Db.php

+24
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,30 @@ public function getTableForeignKeysSql($tableName = null)
114114
return $fkScript;
115115
}
116116

117+
/**
118+
* Return triggers fro table(s)
119+
*
120+
* @param string|null $tableName
121+
* @param bool $addDropIfExists
122+
* @return string
123+
*/
124+
public function getTableTriggersSql($tableName = null, $addDropIfExists = true)
125+
{
126+
$triggerScript = '';
127+
if (!$tableName) {
128+
$tables = $this->getTables();
129+
foreach ($tables as $table) {
130+
$tableTriggerScript = $this->_resourceHelper->getTableTriggersSql($table, $addDropIfExists);
131+
if (!empty($tableTriggerScript)) {
132+
$triggerScript .= "\n" . $tableTriggerScript;
133+
}
134+
}
135+
} else {
136+
$triggerScript = $this->getTableTriggersSql($tableName, $addDropIfExists);
137+
}
138+
return $triggerScript;
139+
}
140+
117141
/**
118142
* Retrieve table status
119143
*

Diff for: app/code/Magento/Backup/Model/ResourceModel/Helper.php

+36
Original file line numberDiff line numberDiff line change
@@ -337,4 +337,40 @@ public function restoreTransactionIsolationLevel()
337337
{
338338
$this->getConnection()->query('SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ');
339339
}
340+
341+
/**
342+
* Get create script for triggers
343+
*
344+
* @param string $tableName
345+
* @param boolean $addDropIfExists
346+
* @param boolean $stripDefiner
347+
* @return string
348+
*/
349+
public function getTableTriggersSql($tableName, $addDropIfExists = false, $stripDefiner = true)
350+
{
351+
$script = "--\n-- Triggers structure for table `{$tableName}`\n--\n";
352+
$triggers = $this->getConnection()->query('SHOW TRIGGERS LIKE \''. $tableName . '\'')->fetchAll();
353+
354+
if (!$triggers) {
355+
return '';
356+
}
357+
foreach ($triggers as $trigger) {
358+
if ($addDropIfExists) {
359+
$script .= 'DROP TRIGGER IF EXISTS ' . $trigger['Trigger'] . ";\n";
360+
}
361+
$script .= "delimiter ;;\n";
362+
363+
$triggerData = $this->getConnection()->query('SHOW CREATE TRIGGER '. $trigger['Trigger'])->fetch();
364+
if ($stripDefiner) {
365+
$cleanedScript = preg_replace('/DEFINER=[^\s]*/', '', $triggerData['SQL Original Statement']);
366+
$script .= $cleanedScript . "\n";
367+
} else {
368+
$script .= $triggerData['SQL Original Statement'] . "\n";
369+
}
370+
$script .= ";;\n";
371+
$script .= "delimiter ;\n";
372+
}
373+
374+
return $script;
375+
}
340376
}

Diff for: app/code/Magento/Bundle/view/frontend/templates/sales/order/creditmemo/items/renderer.phtml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
<?php $items = $block->getChildren($parentItem) ?>
1414
<?php $_order = $block->getItem()->getOrderItem()->getOrder() ?>
15-
<?php $_count = count($items) ?>
1615
<?php $_index = 0 ?>
1716

1817
<?php $_prevOptionId = '' ?>

Diff for: app/code/Magento/Bundle/view/frontend/templates/sales/order/invoice/items/renderer.phtml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<?php $_order = $block->getItem()->getOrderItem()->getOrder() ?>
1313

1414
<?php $items = $block->getChildren($parentItem) ?>
15-
<?php $_count = count($items) ?>
1615
<?php $_index = 0 ?>
1716

1817
<?php $_prevOptionId = '' ?>

Diff for: app/code/Magento/Bundle/view/frontend/templates/sales/order/items/renderer.phtml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
?>
1111
<?php $parentItem = $block->getItem() ?>
1212
<?php $items = array_merge([$parentItem], $parentItem->getChildrenItems()); ?>
13-
<?php $_count = count($items) ?>
1413
<?php $_index = 0 ?>
1514

1615
<?php $_prevOptionId = '' ?>

Diff for: app/code/Magento/Bundle/view/frontend/templates/sales/order/shipment/items/renderer.phtml

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<?php $parentItem = $block->getItem() ?>
1313
<?php $items = array_merge([$parentItem->getOrderItem()], $parentItem->getOrderItem()->getChildrenItems()) ?>
1414
<?php $shipItems = $block->getChildren($parentItem) ?>
15-
<?php $_count = count($items) ?>
1615
<?php $_index = 0 ?>
1716

1817
<?php $_prevOptionId = '' ?>

Diff for: app/code/Magento/Checkout/view/frontend/web/js/model/shipping-save-processor/payload-extender.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
2+
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
55
define(function () {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Api;
7+
8+
/**
9+
* Utility Cms Pages
10+
*
11+
* @api
12+
*/
13+
interface GetUtilityPageIdentifiersInterface
14+
{
15+
/**
16+
* Get List Page Identifiers
17+
* @return array
18+
*/
19+
public function execute();
20+
}
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cms\Model;
7+
8+
use Magento\Cms\Api\GetUtilityPageIdentifiersInterface;
9+
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Store\Model\ScopeInterface;
11+
12+
/**
13+
* Utility Cms Pages
14+
*/
15+
class GetUtilityPageIdentifiers implements GetUtilityPageIdentifiersInterface
16+
{
17+
/**
18+
* @var ScopeConfigInterface
19+
*/
20+
private $scopeConfig;
21+
22+
/**
23+
* UtilityCmsPage constructor.
24+
* @param ScopeConfigInterface $scopeConfig
25+
*/
26+
public function __construct(
27+
ScopeConfigInterface $scopeConfig
28+
) {
29+
$this->scopeConfig = $scopeConfig;
30+
}
31+
32+
/**
33+
* Get List Page Identifiers
34+
* @return array
35+
*/
36+
public function execute()
37+
{
38+
$homePageIdentifier = $this->scopeConfig->getValue(
39+
'web/default/cms_home_page',
40+
ScopeInterface::SCOPE_STORE
41+
);
42+
$noRouteIdentifier = $this->scopeConfig->getValue(
43+
'web/default/cms_no_route',
44+
ScopeInterface::SCOPE_STORE
45+
);
46+
47+
$noCookieIdentifier = $this->scopeConfig->getValue(
48+
'web/default/cms_no_cookies',
49+
ScopeInterface::SCOPE_STORE
50+
);
51+
52+
return [$homePageIdentifier, $noRouteIdentifier, $noCookieIdentifier];
53+
}
54+
}

Diff for: app/code/Magento/Cms/etc/di.xml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<preference for="Magento\Cms\Api\Data\BlockInterface" type="Magento\Cms\Model\Block" />
1515
<preference for="Magento\Cms\Api\BlockRepositoryInterface" type="Magento\Cms\Model\BlockRepository" />
1616
<preference for="Magento\Cms\Api\PageRepositoryInterface" type="Magento\Cms\Model\PageRepository" />
17+
<preference for="Magento\Cms\Api\GetUtilityPageIdentifiersInterface" type="Magento\Cms\Model\GetUtilityPageIdentifiers" />
1718
<type name="Magento\Cms\Model\Wysiwyg\Config">
1819
<arguments>
1920
<argument name="windowSize" xsi:type="array">

Diff for: app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php

+6
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ public function getSelect(AbstractAttribute $superAttribute, int $productId, Sco
9191
]
9292
),
9393
[]
94+
)->joinInner(
95+
['attribute_option' => $this->attributeResource->getTable('eav_attribute_option')],
96+
'attribute_option.option_id = entity_value.value',
97+
[]
98+
)->order(
99+
'attribute_option.sort_order ASC'
94100
)->where(
95101
'super_attribute.product_id = ?',
96102
$productId

Diff for: app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php

+38-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function setUp()
6666
->disableOriginalConstructor()
6767
->getMockForAbstractClass();
6868
$this->select = $this->getMockBuilder(Select::class)
69-
->setMethods(['from', 'joinInner', 'joinLeft', 'where', 'columns'])
69+
->setMethods(['from', 'joinInner', 'joinLeft', 'where', 'columns', 'order'])
7070
->disableOriginalConstructor()
7171
->getMock();
7272
$this->connectionMock->expects($this->atLeastOnce())
@@ -112,10 +112,28 @@ public function testGetSelect()
112112
{
113113
$this->select->expects($this->exactly(1))->method('from')->willReturnSelf();
114114
$this->select->expects($this->exactly(1))->method('columns')->willReturnSelf();
115-
$this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf();
115+
$this->select->expects($this->exactly(6))->method('joinInner')->willReturnSelf();
116116
$this->select->expects($this->exactly(3))->method('joinLeft')->willReturnSelf();
117+
$this->select->expects($this->exactly(1))->method('order')->willReturnSelf();
117118
$this->select->expects($this->exactly(2))->method('where')->willReturnSelf();
118119

120+
$this->attributeResourceMock->expects($this->exactly(9))
121+
->method('getTable')
122+
->will(
123+
$this->returnValueMap(
124+
[
125+
['catalog_product_super_attribute', 'catalog_product_super_attribute value'],
126+
['catalog_product_entity', 'catalog_product_entity value'],
127+
['catalog_product_super_link', 'catalog_product_super_link value'],
128+
['eav_attribute', 'eav_attribute value'],
129+
['catalog_product_entity', 'catalog_product_entity value'],
130+
['catalog_product_super_attribute_label', 'catalog_product_super_attribute_label value'],
131+
['eav_attribute_option', 'eav_attribute_option value'],
132+
['eav_attribute_option_value', 'eav_attribute_option_value value']
133+
]
134+
)
135+
);
136+
119137
$this->abstractAttributeMock->expects($this->atLeastOnce())
120138
->method('getAttributeId')
121139
->willReturn('getAttributeId value');
@@ -138,10 +156,27 @@ public function testGetSelectWithBackendModel()
138156
{
139157
$this->select->expects($this->exactly(1))->method('from')->willReturnSelf();
140158
$this->select->expects($this->exactly(0))->method('columns')->willReturnSelf();
141-
$this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf();
159+
$this->select->expects($this->exactly(6))->method('joinInner')->willReturnSelf();
142160
$this->select->expects($this->exactly(1))->method('joinLeft')->willReturnSelf();
161+
$this->select->expects($this->exactly(1))->method('order')->willReturnSelf();
143162
$this->select->expects($this->exactly(2))->method('where')->willReturnSelf();
144163

164+
$this->attributeResourceMock->expects($this->exactly(7))
165+
->method('getTable')
166+
->will(
167+
$this->returnValueMap(
168+
[
169+
['catalog_product_super_attribute', 'catalog_product_super_attribute value'],
170+
['catalog_product_entity', 'catalog_product_entity value'],
171+
['catalog_product_super_link', 'catalog_product_super_link value'],
172+
['eav_attribute', 'eav_attribute value'],
173+
['catalog_product_entity', 'catalog_product_entity value'],
174+
['catalog_product_super_attribute_label', 'catalog_product_super_attribute_label value'],
175+
['eav_attribute_option', 'eav_attribute_option value']
176+
]
177+
)
178+
);
179+
145180
$this->abstractAttributeMock->expects($this->atLeastOnce())
146181
->method('getAttributeId')
147182
->willReturn('getAttributeId value');

Diff for: app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
use Magento\Customer\Model\Metadata\Form;
1414
use Magento\Framework\Exception\LocalizedException;
1515

16+
/**
17+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
18+
*/
1619
class Save extends \Magento\Customer\Controller\Adminhtml\Index
1720
{
1821
/**
@@ -268,6 +271,15 @@ public function execute()
268271
$this->_addSessionErrorMessages($messages);
269272
$this->_getSession()->setCustomerFormData($originalRequestData);
270273
$returnToEdit = true;
274+
} catch (\Magento\Framework\Exception\AbstractAggregateException $exception) {
275+
$errors = $exception->getErrors();
276+
$messages = [];
277+
foreach ($errors as $error) {
278+
$messages[] = $error->getMessage();
279+
}
280+
$this->_addSessionErrorMessages($messages);
281+
$this->_getSession()->setCustomerFormData($originalRequestData);
282+
$returnToEdit = true;
271283
} catch (LocalizedException $exception) {
272284
$this->_addSessionErrorMessages($exception->getMessage());
273285
$this->_getSession()->setCustomerFormData($originalRequestData);

Diff for: app/code/Magento/Customer/Setup/UpgradeData.php

+36
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
159159
$this->upgradeVersionTwoZeroTwelve($customerSetup);
160160
}
161161

162+
if (version_compare($context->getVersion(), '2.0.13', '<')) {
163+
$this->upgradeVersionTwoZeroThirteen($customerSetup);
164+
}
165+
162166
$indexer = $this->indexerRegistry->get(Customer::CUSTOMER_GRID_INDEXER_ID);
163167
$indexer->reindexAll();
164168
$this->eavConfig->clear();
@@ -663,4 +667,36 @@ private function upgradeCustomerPasswordResetlinkExpirationPeriodConfig($setup)
663667
['path = ?' => \Magento\Customer\Model\Customer::XML_PATH_CUSTOMER_RESET_PASSWORD_LINK_EXPIRATION_PERIOD]
664668
);
665669
}
670+
671+
/**
672+
* @param CustomerSetup $customerSetup
673+
*/
674+
private function upgradeVersionTwoZeroThirteen(CustomerSetup $customerSetup)
675+
{
676+
$entityAttributes = [
677+
'customer_address' => [
678+
'firstname' => [
679+
'input_filter' => 'trim'
680+
],
681+
'lastname' => [
682+
'input_filter' => 'trim'
683+
],
684+
'middlename' => [
685+
'input_filter' => 'trim'
686+
],
687+
],
688+
'customer' => [
689+
'firstname' => [
690+
'input_filter' => 'trim'
691+
],
692+
'lastname' => [
693+
'input_filter' => 'trim'
694+
],
695+
'middlename' => [
696+
'input_filter' => 'trim'
697+
],
698+
],
699+
];
700+
$this->upgradeAttributes($entityAttributes, $customerSetup);
701+
}
666702
}

Diff for: app/code/Magento/Customer/etc/module.xml

+1-1
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_Customer" setup_version="2.0.12">
9+
<module name="Magento_Customer" setup_version="2.0.13">
1010
<sequence>
1111
<module name="Magento_Eav"/>
1212
<module name="Magento_Directory"/>

Diff for: app/code/Magento/Customer/view/frontend/web/js/invalidation-processor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
2+
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
55
define([

Diff for: app/code/Magento/Customer/view/frontend/web/js/invalidation-rules/website-rule.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
2+
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
55
define([

0 commit comments

Comments
 (0)