Skip to content

Commit a080bb3

Browse files
authored
Merge pull request #5873 from magento-tsg/MC-35765
[TSG] MC-35765 [2.4.0-beta1] Full Tax Details causes the Order Page to fail
2 parents bae58bb + e28dfcf commit a080bb3

File tree

2 files changed

+12
-3
lines changed
  • app/code/Magento/Sales
    • Block/Adminhtml/Order/Totals
    • view/adminhtml/templates/order/totals

2 files changed

+12
-3
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/Totals/Tax.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Sales\Block\Adminhtml\Order\Totals;
77

8+
use Magento\Framework\App\ObjectManager;
9+
use Magento\Framework\Math\Random;
10+
811
/**
912
* Adminhtml order tax totals block
1013
*
@@ -50,6 +53,7 @@ class Tax extends \Magento\Tax\Block\Sales\Order\Tax
5053
* @param \Magento\Tax\Model\Sales\Order\TaxFactory $taxOrderFactory
5154
* @param \Magento\Sales\Helper\Admin $salesAdminHelper
5255
* @param array $data
56+
* @param Random $randomHelper
5357
*/
5458
public function __construct(
5559
\Magento\Backend\Block\Template\Context $context,
@@ -58,13 +62,15 @@ public function __construct(
5862
\Magento\Tax\Model\Calculation $taxCalculation,
5963
\Magento\Tax\Model\Sales\Order\TaxFactory $taxOrderFactory,
6064
\Magento\Sales\Helper\Admin $salesAdminHelper,
61-
array $data = []
65+
array $data = [],
66+
?Random $randomHelper = null
6267
) {
6368
$this->_taxHelper = $taxHelper;
6469
$this->_taxCalculation = $taxCalculation;
6570
$this->_taxOrderFactory = $taxOrderFactory;
6671
$this->_salesAdminHelper = $salesAdminHelper;
6772
$data['taxHelper'] = $this->_taxHelper;
73+
$data['randomHelper'] = $randomHelper ?? ObjectManager::getInstance()->get(Random::class);
6874
parent::__construct($context, $taxConfig, $data);
6975
}
7076

app/code/Magento/Sales/view/adminhtml/templates/order/totals/tax.phtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ $_fullInfo = $block->getFullTaxInfo();
1616

1717
/** @var \Magento\Tax\Helper\Data $taxHelper */
1818
$taxHelper = $block->getData('taxHelper');
19+
/** @var \Magento\Framework\Math\Random $randomHelper */
20+
$randomHelper = $block->getData('randomHelper');
1921
?>
2022

2123
<?php if ($block->displayFullSummary() && $_fullInfo): ?>
@@ -86,8 +88,9 @@ $taxHelper = $block->getData('taxHelper');
8688
$amount = $info['tax_amount'];
8789
$baseAmount = $info['base_tax_amount'];
8890
$isFirst = 1;
91+
$infoId = $randomHelper->getRandomString(20);
8992
?>
90-
<tr id="info-<?= /* @noEscape */ $info->getCode() ?>"
93+
<tr id="info-<?= /* @noEscape */ $infoId ?>"
9194
class="summary-details<?= ($isTop ? ' summary-details-first' : '') ?>">
9295
<?php if ($info['percent'] !== null): ?>
9396
<td class="admin__total-mark">
@@ -98,7 +101,7 @@ $taxHelper = $block->getData('taxHelper');
98101
<?php endif; ?>
99102
<td><?= /* @noEscape */ $block->displayAmount($amount, $baseAmount) ?></td>
100103
</tr>
101-
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("display:none;", 'tr#info-' . $info->getCode()) ?>
104+
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("display:none;", 'tr#info-' . $infoId) ?>
102105
<?php
103106
$isFirst = 0;
104107
$isTop = 0;

0 commit comments

Comments
 (0)