init
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Stemcell\Sales\Block\Adminhtml\Order;
|
||||
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
use Magento\Directory\Helper\Data as DirectoryHelper;
|
||||
use Magento\Framework\Json\Helper\Data as JsonHelper;
|
||||
|
||||
class Reject extends \Magento\Backend\Block\Template
|
||||
{
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
protected \Magento\Framework\Registry $_coreRegistry,
|
||||
array $data = [],
|
||||
?JsonHelper $jsonHelper = null,
|
||||
?DirectoryHelper $directoryHelper = null
|
||||
)
|
||||
{
|
||||
parent::__construct($context, $data, $jsonHelper, $directoryHelper);
|
||||
$this->_authorization = $context->getAuthorization();
|
||||
}
|
||||
|
||||
public function getRejectUrl()
|
||||
{
|
||||
return $this->getUrl('sales/*/reject');
|
||||
}
|
||||
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->_coreRegistry->registry('current_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $resourceId
|
||||
* @return bool
|
||||
*/
|
||||
public function canReject(string $resourceId = 'Magento_Sales::cancel') {
|
||||
return $this->_authorization->isAllowed($resourceId) && $this->getOrder()->canCancel();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user