Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <type name="MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory">
- <plugin name="sales_order_pending" type="VendorModulePluginCustomSalesOrderGridCollection" sortOrder="100" />
- </type>
- <?php namespace VendorMOdulePlugin;
- use MagentoSalesModelResourceModelOrderGridCollection as SalesOrderGridCollection;
- class CustomSalesOrderGridCollection
- {
- private $collection;
- protected $adminSession;
- protected $logger;
- public function __construct(
- SalesOrderGridCollection $collection,
- MagentoBackendModelAuthSession $adminSession,
- PsrLogLoggerInterface $logger
- ) {
- $this->messageManager = $messageManager;
- $this->collection = $collection;
- $this->adminSession = $adminSession;
- $this->logger = $logger;
- }
- public function aroundGetReport(
- MagentoFrameworkViewElementUiComponentDataProviderCollectionFactory $subject,
- Closure $proceed,
- $requestName
- ) {
- $current_adminuser = $this->adminSession->getUser()->getAclRole();
- if(12 == $current_adminuser){ //Choose Your admin User Role.
- $result = $proceed($requestName);
- if ($requestName == 'sales_order_grid_data_source') {
- if ($result instanceof $this->collection) {
- $this->collection->addFieldToFilter('status', array('in' => array('pending')));
- }
- }
- }
- return $this->collection;
- }
- }
Add Comment
Please, Sign In to add comment