Sales.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. /**
  7. * Sales report admin controller
  8. *
  9. * @author Magento Core Team <core@magentocommerce.com>
  10. */
  11. namespace Magento\Reports\Controller\Adminhtml\Report;
  12. /**
  13. * @SuppressWarnings(PHPMD.NumberOfChildren)
  14. * @api
  15. * @since 100.0.2
  16. */
  17. abstract class Sales extends AbstractReport
  18. {
  19. /**
  20. * Add report/sales breadcrumbs
  21. *
  22. * @return $this
  23. */
  24. public function _initAction()
  25. {
  26. parent::_initAction();
  27. $this->_addBreadcrumb(__('Sales'), __('Sales'));
  28. return $this;
  29. }
  30. /**
  31. * Determine if action is allowed for reports module
  32. *
  33. * @return bool
  34. */
  35. protected function _isAllowed()
  36. {
  37. switch ($this->getRequest()->getActionName()) {
  38. case 'sales':
  39. return $this->_authorization->isAllowed('Magento_Reports::salesroot_sales');
  40. break;
  41. case 'tax':
  42. return $this->_authorization->isAllowed('Magento_Reports::tax');
  43. break;
  44. case 'shipping':
  45. return $this->_authorization->isAllowed('Magento_Reports::shipping');
  46. break;
  47. case 'invoiced':
  48. return $this->_authorization->isAllowed('Magento_Reports::invoiced');
  49. break;
  50. case 'refunded':
  51. return $this->_authorization->isAllowed('Magento_Reports::refunded');
  52. break;
  53. case 'coupons':
  54. return $this->_authorization->isAllowed('Magento_Reports::coupons');
  55. break;
  56. case 'bestsellers':
  57. return $this->_authorization->isAllowed('Magento_Reports::bestsellers');
  58. break;
  59. default:
  60. return $this->_authorization->isAllowed('Magento_Reports::salesroot');
  61. break;
  62. }
  63. }
  64. }