Skip to content

Commit c1e20d3

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-93118' into 2.3-develop-pr28
2 parents b60b013 + 2fec874 commit c1e20d3

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

app/code/Magento/Sales/view/adminhtml/templates/order/totalbar.phtml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66

77
// @codingStandardsIgnoreFile
88

9+
$totals = $block->getTotals();
910
?>
10-
<?php if (sizeof($block->getTotals()) > 0): ?>
11+
<?php if ($totals && count($totals) > 0): ?>
1112
<table class="items-to-invoice">
1213
<tr>
13-
<?php foreach ($block->getTotals() as $_total): ?>
14-
<td <?php if ($_total['grand']): ?>class="grand-total"<?php endif; ?>>
15-
<?= /* @escapeNotVerified */ $_total['label'] ?><br />
16-
<?= /* @escapeNotVerified */ $_total['value'] ?>
14+
<?php foreach ($totals as $total): ?>
15+
<td <?php if ($total['grand']): ?>class="grand-total"<?php endif; ?>>
16+
<?= $block->escapeHtml($total['label']) ?><br />
17+
<?= $block->escapeHtml($total['value']) ?>
1718
</td>
1819
<?php endforeach; ?>
1920
</tr>

app/code/Magento/Ui/Model/Export/MetadataProvider.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ public function getHeaders(UiComponentInterface $component)
118118
foreach ($this->getColumns($component) as $column) {
119119
$row[] = $column->getData('config/label');
120120
}
121+
122+
array_walk($row, function (&$header) {
123+
if (mb_strpos($header, 'ID') === 0) {
124+
$header = '"' . $header . '"';
125+
}
126+
});
127+
121128
return $row;
122129
}
123130

app/code/Magento/Ui/Test/Unit/Model/Export/MetadataProviderTest.php

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,37 @@ protected function setUp()
4040
);
4141
}
4242

43-
public function testGetHeaders()
43+
/**
44+
* @param array $columnLabels
45+
* @param array $expected
46+
* @return void
47+
* @dataProvider getColumnsDataProvider
48+
*/
49+
public function testGetHeaders(array $columnLabels, array $expected): void
4450
{
4551
$componentName = 'component_name';
4652
$columnName = 'column_name';
47-
$columnLabel = 'column_label';
48-
49-
$component = $this->prepareColumns($componentName, $columnName, $columnLabel);
5053

54+
$component = $this->prepareColumns($componentName, $columnName, $columnLabels[0]);
5155
$result = $this->model->getHeaders($component);
5256
$this->assertTrue(is_array($result));
5357
$this->assertCount(1, $result);
54-
$this->assertEquals($columnLabel, $result[0]);
58+
$this->assertEquals($expected, $result);
59+
}
60+
61+
/**
62+
* @return array
63+
*/
64+
public function getColumnsDataProvider(): array
65+
{
66+
return [
67+
[['ID'],['"ID"']],
68+
[['Name'],['Name']],
69+
[['Id'],['Id']],
70+
[['id'],['id']],
71+
[['IDTEST'],['"IDTEST"']],
72+
[['ID TEST'],['"ID TEST"']],
73+
];
5574
}
5675

5776
public function testGetFields()

0 commit comments

Comments
 (0)