Skip to content

Commit dc4e82c

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #13051: Fix JS error on cart from postcode validation when 'US' is deselected as an allowed country (by @codekipple) - #13076: Fix issues caused by using continue in loops (by @ihor-sviziev) - #12985: Fix jumping content on page reload in admin area (by @avoelkl) - #13041: Solution For Newsletter subscribe button title wrapped (by @monaemipro) - #13026: Feature space between category page (by @sanjay-wagento) - #12964: Add trim filter to first, middle and lastname. (by @wardcapp) - #12731: #12209: Substitution payment method - Incorrect message (by @zamoroka) - #11369: Database backup doesn't include triggers #9036 (by @denisristic) Fixed GitHub Issues: - #12320: Newsletter subscribe button title wrapped (reported by @Gvigner) has been fixed in #13041 by @monaemipro in 2.2-develop branch Related commits: 1. d9536c8 - #12601: A space between the category page and the main footer when applying specific settings (reported by @wd7080) has been fixed in #13026 by @sanjay-wagento in 2.2-develop branch Related commits: 1. 023fb1a 2. 7727086 - #10415: Customer First and Last names not being trimmed of leading and trailing spaces on save. (reported by @spyrule) has been fixed in #12964 by @wardcapp in 2.2-develop branch Related commits: 1. 207fdb0 2. 2a23a94 3. 1a77bfc - #12209: Substitution payment method - Incorrect message (reported by @ihor-sviziev) has been fixed in #12731 by @zamoroka in 2.2-develop branch Related commits: 1. 30b8293 - #9036: Database backup doesn't include triggers (reported by @domeglic) has been fixed in #11369 by @denisristic in 2.2-develop branch Related commits: 1. 3255857 2. f1bcf38
2 parents 0d04ec6 + 3553a8a commit dc4e82c

File tree

22 files changed

+210
-64
lines changed

22 files changed

+210
-64
lines changed

app/code/Magento/Backup/Model/Db.php

Lines changed: 1 addition & 0 deletions
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();

app/code/Magento/Backup/Model/ResourceModel/Db.php

Lines changed: 24 additions & 0 deletions
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
*

app/code/Magento/Backup/Model/ResourceModel/Helper.php

Lines changed: 36 additions & 0 deletions
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
}

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

Lines changed: 36 additions & 0 deletions
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
}

app/code/Magento/Customer/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_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"/>

app/code/Magento/Payment/view/adminhtml/templates/info/substitution.phtml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
*/
1111
?>
1212
<div>
13-
<?php $block->escapeHtml($block->getMethod()->getTitle());?>
13+
<?= $block->getMethod()->getTitle()
14+
? $block->escapeHtml($block->getMethod()->getTitle())
15+
: $block->escapeHtml(__('Payment method')); ?>
1416
<?= $block->escapeHtml(__(' is not available. You still can process offline actions.')) ?>
1517
</div>

app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
</tr>
2626
</thead>
2727
<?php foreach ($_creditmemo->getAllItems() as $_item): ?>
28-
<?php
29-
if ($_item->getOrderItem()->getParentItem()) {
30-
continue;
31-
}
32-
?>
33-
<tbody>
34-
<?= $block->getItemHtml($_item) ?>
35-
</tbody>
28+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
29+
<tbody>
30+
<?= $block->getItemHtml($_item) ?>
31+
</tbody>
32+
<?php endif; ?>
3633
<?php endforeach; ?>
3734
<tfoot class="order-totals">
3835
<?= $block->getChildHtml('creditmemo_totals') ?>

app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
</tr>
2626
</thead>
2727
<?php foreach ($_invoice->getAllItems() as $_item): ?>
28-
<?php
29-
if ($_item->getOrderItem()->getParentItem()) {
30-
continue;
31-
}
32-
?>
33-
<tbody>
34-
<?= $block->getItemHtml($_item) ?>
35-
</tbody>
28+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
29+
<tbody>
30+
<?= $block->getItemHtml($_item) ?>
31+
</tbody>
32+
<?php endif; ?>
3633
<?php endforeach; ?>
3734
<tfoot class="order-totals">
3835
<?= $block->getChildHtml('invoice_totals') ?>

app/code/Magento/Sales/view/frontend/templates/email/items.phtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
</tr>
2626
</thead>
2727
<?php foreach ($_items as $_item): ?>
28-
<?php
29-
if ($_item->getParentItem()) {
30-
continue;
31-
}
32-
?>
33-
<tbody>
34-
<?= $block->getItemHtml($_item) ?>
35-
</tbody>
28+
<?php if (!$_item->getParentItem()) : ?>
29+
<tbody>
30+
<?= $block->getItemHtml($_item) ?>
31+
</tbody>
32+
<?php endif; ?>
3633
<?php endforeach; ?>
3734
<tfoot class="order-totals">
3835
<?= $block->getChildHtml('order_totals') ?>

app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@
2222
</tr>
2323
</thead>
2424
<?php foreach ($_shipment->getAllItems() as $_item): ?>
25-
<?php
26-
if ($_item->getOrderItem()->getParentItem()) {
27-
continue;
28-
}
29-
?>
30-
<tbody>
31-
<?= $block->getItemHtml($_item) ?>
32-
</tbody>
25+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
26+
<tbody>
27+
<?= $block->getItemHtml($_item) ?>
28+
</tbody>
29+
<?php endif; ?>
3330
<?php endforeach; ?>
3431
</table>
3532
<?php endif; ?>

app/code/Magento/Sales/view/frontend/templates/order/creditmemo/items.phtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@
4141
</thead>
4242
<?php $_items = $_creditmemo->getAllItems(); ?>
4343
<?php foreach ($_items as $_item): ?>
44-
<?php if ($_item->getOrderItem()->getParentItem()) {
45-
continue;
46-
} ?>
47-
<tbody>
48-
<?= $block->getItemHtml($_item) ?>
49-
</tbody>
44+
<?php if (!$_item->getOrderItem()->getParentItem()): ?>
45+
<tbody>
46+
<?= $block->getItemHtml($_item) ?>
47+
</tbody>
48+
<?php endif; ?>
5049
<?php endforeach; ?>
5150
<tfoot>
5251
<?= $block->getTotalsHtml($_creditmemo) ?>

app/code/Magento/Sales/view/frontend/templates/order/invoice/items.phtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@
3838
</thead>
3939
<?php $_items = $_invoice->getAllItems(); ?>
4040
<?php foreach ($_items as $_item): ?>
41-
<?php if ($_item->getOrderItem()->getParentItem()) {
42-
continue;
43-
} ?>
44-
<tbody>
45-
<?= $block->getItemHtml($_item) ?>
46-
</tbody>
41+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
42+
<tbody>
43+
<?= $block->getItemHtml($_item) ?>
44+
</tbody>
45+
<?php endif; ?>
4746
<?php endforeach; ?>
4847
<tfoot>
4948
<?= $block->getInvoiceTotalsHtml($_invoice) ?>

app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@
3535
</thead>
3636
<?php $_items = $_creditmemo->getAllItems(); ?>
3737
<?php foreach ($_items as $_item): ?>
38-
<?php if ($_item->getOrderItem()->getParentItem()): ?>
39-
continue;
40-
<?php endif; ?>
41-
<tbody>
42-
<?= $block->getItemHtml($_item) ?>
43-
</tbody>
38+
<?php if (!$_item->getOrderItem()->getParentItem()): ?>
39+
<tbody>
40+
<?= $block->getItemHtml($_item) ?>
41+
</tbody>
42+
<?php endif; ?>
4443
<?php endforeach; ?>
4544
<tfoot>
4645
<?= $block->getTotalsHtml($_creditmemo) ?>

app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@
3333
</thead>
3434
<?php $_items = $_invoice->getItemsCollection(); ?>
3535
<?php foreach ($_items as $_item): ?>
36-
<?php if ($_item->getOrderItem()->getParentItem()): ?>
37-
continue;
36+
<?php if (!$_item->getOrderItem()->getParentItem()): ?>
37+
<tbody>
38+
<?= $block->getItemHtml($_item) ?>
39+
</tbody>
3840
<?php endif; ?>
39-
<tbody>
40-
<?= $block->getItemHtml($_item) ?>
41-
</tbody>
4241
<?php endforeach; ?>
4342
<tfoot>
4443
<?= $block->getInvoiceTotalsHtml($_invoice) ?>

app/code/Magento/Shipping/view/frontend/templates/items.phtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@
6767
</thead>
6868
<?php $_items = $_shipment->getAllItems(); ?>
6969
<?php foreach ($_items as $_item): ?>
70-
<?php if ($_item->getOrderItem()->getParentItem()) {
71-
continue;
72-
} ?>
73-
<tbody>
74-
<?= $block->getItemHtml($_item) ?>
75-
</tbody>
70+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
71+
<tbody>
72+
<?= $block->getItemHtml($_item) ?>
73+
</tbody>
74+
<?php endif; ?>
7675
<?php endforeach; ?>
7776
</table>
7877
</div>

app/code/Magento/Ui/view/base/web/js/form/element/region.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ define([
3535
return;
3636
}
3737
option = options[value];
38+
39+
if (typeof option === 'undefined') {
40+
return;
41+
}
42+
3843
defaultPostCodeResolver.setUseDefaultPostCode(!option['is_zipcode_optional']);
3944

4045
if (this.skipValidation) {

app/design/adminhtml/Magento/backend/web/css/source/_structure.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ body {
3636
// ToDo UI: should be moved to messages
3737
.notices-wrapper {
3838
margin: 0 3rem;
39+
min-height: 5rem;
3940
.messages {
4041
margin-bottom: 0;
4142
}

app/design/frontend/Magento/blank/Magento_Catalog/web/css/source/_module.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,16 @@
497497
}
498498
}
499499

500+
//
501+
// Category page 1 column layout
502+
// ---------------------------------------------
503+
504+
.catalog-category-view.page-layout-1column {
505+
.column.main {
506+
min-height: inherit;
507+
}
508+
}
509+
500510
}
501511

502512
//

app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/_module.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,16 @@
566566
}
567567
}
568568
}
569+
570+
//
571+
// Category page 1 column layout
572+
// ---------------------------------------------
573+
574+
.catalog-category-view.page-layout-1column {
575+
.column.main {
576+
min-height: inherit;
577+
}
578+
}
569579
}
570580

571581
//

app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
border-bottom-left-radius: 0;
6868
border-top-left-radius: 0;
6969
margin-left: -1px;
70+
white-space : nowrap;
7071
}
7172
}
7273
}

dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerMetadataTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getAttributeMetadataDataProvider()
6363
Customer::FIRSTNAME,
6464
[
6565
AttributeMetadata::FRONTEND_INPUT => 'text',
66-
AttributeMetadata::INPUT_FILTER => '',
66+
AttributeMetadata::INPUT_FILTER => 'trim',
6767
AttributeMetadata::STORE_LABEL => 'First Name',
6868
AttributeMetadata::MULTILINE_COUNT => 0,
6969
AttributeMetadata::VALIDATION_RULES => [

0 commit comments

Comments
 (0)