Skip to content

Commit 1a908c1

Browse files
adjust resources, refactor
1 parent 9db8711 commit 1a908c1

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Creditmemos.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@
55
*/
66
namespace Magento\Sales\Block\Adminhtml\Order\View\Tab;
77

8+
use Magento\Backend\Block\Widget\Tab\TabInterface;
89
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\AuthorizationInterface;
1011
use Magento\Framework\View\Element\Context;
12+
use Magento\Framework\View\Element\Text\ListText;
1113

1214
/**
1315
* Order Credit Memos grid
1416
*
1517
* @api
1618
* @since 100.0.2
1719
*/
18-
class Creditmemos extends \Magento\Framework\View\Element\Text\ListText implements
19-
\Magento\Backend\Block\Widget\Tab\TabInterface
20+
class Creditmemos extends ListText implements TabInterface
2021
{
21-
/**
22-
* @var AuthorizationInterface
23-
*/
22+
/**
23+
* @var AuthorizationInterface
24+
*/
2425
private $authorization;
2526

2627
/**
@@ -60,7 +61,7 @@ public function getTabTitle()
6061
*/
6162
public function canShowTab()
6263
{
63-
return $this->authorization->isAllowed('Magento_Sales::creditmemo');
64+
return $this->authorization->isAllowed('Magento_Sales::sales_creditmemo');
6465
}
6566

6667
/**

app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Invoices.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
*/
66
namespace Magento\Sales\Block\Adminhtml\Order\View\Tab;
77

8+
use Magento\Backend\Block\Widget\Tab\TabInterface;
89
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\AuthorizationInterface;
1011
use Magento\Framework\View\Element\Context;
12+
use Magento\Framework\View\Element\Text\ListText;
1113

1214
/**
1315
* Order Invoices grid
1416
*
1517
* @api
1618
* @since 100.0.2
1719
*/
18-
class Invoices extends \Magento\Framework\View\Element\Text\ListText implements
19-
\Magento\Backend\Block\Widget\Tab\TabInterface
20+
class Invoices extends ListText implements TabInterface
2021
{
2122
/**
2223
* @var AuthorizationInterface
@@ -60,7 +61,7 @@ public function getTabTitle()
6061
*/
6162
public function canShowTab()
6263
{
63-
return $this->authorization->isAllowed('Magento_Sales::invoice');
64+
return $this->authorization->isAllowed('Magento_Sales::sales_invoice');
6465
}
6566

6667
/**

app/code/Magento/Sales/Block/Adminhtml/Order/View/Tab/Shipments.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@
55
*/
66
namespace Magento\Sales\Block\Adminhtml\Order\View\Tab;
77

8+
use Magento\Backend\Block\Widget\Tab\TabInterface;
89
use Magento\Framework\App\ObjectManager;
910
use Magento\Framework\AuthorizationInterface;
11+
use Magento\Framework\Registry;
12+
use Magento\Framework\View\Element\Context;
13+
use Magento\Framework\View\Element\Text\ListText;
14+
use Magento\Sales\Model\Order;
1015

1116
/**
1217
* Order Shipments grid
1318
*
1419
* @api
1520
* @since 100.0.2
1621
*/
17-
class Shipments extends \Magento\Framework\View\Element\Text\ListText implements
18-
\Magento\Backend\Block\Widget\Tab\TabInterface
22+
class Shipments extends ListText implements TabInterface
1923
{
2024
/**
2125
* Core registry
2226
*
23-
* @var \Magento\Framework\Registry
27+
* @var Registry
2428
*/
2529
protected $_coreRegistry = null;
2630

@@ -32,14 +36,14 @@ class Shipments extends \Magento\Framework\View\Element\Text\ListText implements
3236
/**
3337
* Collection factory
3438
*
35-
* @param \Magento\Framework\View\Element\Context $context
36-
* @param \Magento\Framework\Registry $coreRegistry
39+
* @param Context $context
40+
* @param Registry $coreRegistry
3741
* @param array $data
3842
* @param AuthorizationInterface|null $authorization
3943
*/
4044
public function __construct(
41-
\Magento\Framework\View\Element\Context $context,
42-
\Magento\Framework\Registry $coreRegistry,
45+
Context $context,
46+
Registry $coreRegistry,
4347
array $data = [],
4448
?AuthorizationInterface $authorization = null
4549
) {
@@ -51,7 +55,7 @@ public function __construct(
5155
/**
5256
* Retrieve order model instance
5357
*
54-
* @return \Magento\Sales\Model\Order
58+
* @return Order
5559
*/
5660
public function getOrder()
5761
{
@@ -79,7 +83,7 @@ public function getTabTitle()
7983
*/
8084
public function canShowTab()
8185
{
82-
return $this->authorization->isAllowed('Magento_Sales::ship') && !$this->getOrder()->getIsVirtual();
86+
return $this->authorization->isAllowed('Magento_Sales::shipment') && !$this->getOrder()->getIsVirtual();
8387
}
8488

8589
/**

0 commit comments

Comments
 (0)