Skip to content

Commit aa571b3

Browse files
committed
AC-11642:Sales order sidebar fix
1 parent b08b7ea commit aa571b3

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Sales\Block\Adminhtml\Order\Create;
79

10+
use Magento\Backend\Block\Widget\Button;
11+
use Magento\Framework\DataObject;
12+
813
/**
914
* Adminhtml sales order create sidebar
1015
*
1116
* @api
12-
* @author Magento Core Team <[email protected]>
1317
* @since 100.0.2
1418
*/
15-
class Sidebar extends \Magento\Sales\Block\Adminhtml\Order\Create\AbstractCreate
19+
class Sidebar extends AbstractCreate
1620
{
1721
/**
1822
* Preparing global layout
@@ -23,7 +27,7 @@ protected function _prepareLayout()
2327
{
2428
if ($this->getCustomerId()) {
2529
$button = $this->getLayout()->createBlock(
26-
\Magento\Backend\Block\Widget\Button::class
30+
Button::class
2731
)->setData(
2832
[
2933
'label' => __('Update Changes'),
@@ -34,9 +38,7 @@ protected function _prepareLayout()
3438
]
3539
);
3640
$this->setChild('top_button', $button);
37-
}
3841

39-
if ($this->getCustomerId()) {
4042
$button = clone $button;
4143
$button->unsId();
4244
$this->setChild('bottom_button', $button);
@@ -47,7 +49,7 @@ protected function _prepareLayout()
4749
/**
4850
* Check if can display
4951
*
50-
* @param \Magento\Framework\DataObject $child
52+
* @param DataObject $child
5153
* @return true
5254
*/
5355
public function canDisplay($child)
@@ -57,4 +59,14 @@ public function canDisplay($child)
5759
}
5860
return true;
5961
}
62+
63+
/**
64+
* To check customer permission
65+
*
66+
* @return bool
67+
*/
68+
public function isAllowedAction(): bool
69+
{
70+
return $this->_authorization->isAllowed('Magento_Customer::customer');
71+
}
6072
}

app/code/Magento/Sales/view/adminhtml/templates/order/create/sidebar.phtml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
/**
88
* @var \Magento\Sales\Block\Adminhtml\Order\Create\Sidebar $block
99
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
10+
* @var \Magento\Framework\Escaper $escaper
1011
*/
1112
?>
13+
<?php if ($block->isAllowedAction()): ?>
1214
<div class="customer-current-activity-inner">
13-
<h4 class="customer-activity-title"><?= $block->escapeHtml(__('Customer\'s Activities')) ?></h4>
15+
<h4 class="customer-activity-title"><?= $escaper->escapeHtml(__('Customer\'s Activities')) ?></h4>
1416
<div class="create-order-sidebar-container">
1517
<?= $block->getChildHtml('top_button') ?>
1618
<?php foreach ($block->getLayout()->getChildBlocks($block->getNameInLayout()) as $_alias => $_child): ?>
1719
<?php if ($_alias != 'top_button' && $_alias != 'bottom_button'): ?>
1820
<?php if ($block->canDisplay($_child)): ?>
19-
<div class="order-sidebar-block" id="order-sidebar_<?= $block->escapeHtmlAttr($_alias) ?>">
21+
<div class="order-sidebar-block" id="order-sidebar_<?= $escaper->escapeHtmlAttr($_alias) ?>">
2022
<?= $block->getChildHtml($_alias) ?>
2123
</div>
2224
<?php endif; ?>
@@ -25,6 +27,7 @@
2527
<?= $block->getChildHtml('bottom_button') ?>
2628
</div>
2729
</div>
30+
<?php endif; ?>
2831
<?php $scriptString = <<<script
2932
require([
3033
"prototype",

0 commit comments

Comments
 (0)