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; ?>

0 commit comments

Comments
 (0)