Create.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Controller\Adminhtml\Rma\Shipment;
  6. use Magento\Backend\App\Action\Context;
  7. use Magento\Framework\Controller\ResultFactory;
  8. use Temando\Shipping\Controller\Adminhtml\Activation\AbstractRegisteredAction;
  9. use Temando\Shipping\Model\Config\ModuleConfigInterface;
  10. use Temando\Shipping\Model\ResourceModel\Rma\RmaAccess;
  11. /**
  12. * Temando Create RMA Shipment Action
  13. *
  14. * @package Temando\Shipping\Controller
  15. * @author Max Melzer <max.melzer@netresearch.de>
  16. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  17. * @link http://www.temando.com/
  18. */
  19. class Create extends AbstractRegisteredAction
  20. {
  21. const ADMIN_RESOURCE = 'Magento_Rma::magento_rma';
  22. /**
  23. * @var RmaAccess
  24. */
  25. private $rmaAccess;
  26. /**
  27. * Create constructor.
  28. * @param Context $context
  29. * @param ModuleConfigInterface $config
  30. * @param RmaAccess $rmaAccess
  31. */
  32. public function __construct(
  33. Context $context,
  34. ModuleConfigInterface $config,
  35. RmaAccess $rmaAccess
  36. ) {
  37. $this->rmaAccess = $rmaAccess;
  38. parent::__construct($context, $config);
  39. }
  40. /**
  41. * @return \Magento\Backend\Model\View\Result\Page
  42. */
  43. public function execute()
  44. {
  45. $rmaId = $this->getRequest()->getParam('rma_id');
  46. // load and register current RMA
  47. $rma = $this->rmaAccess->getById($rmaId);
  48. $this->rmaAccess->setCurrentRma($rma);
  49. /** @var \Magento\Backend\Model\View\Result\Page $resultPage */
  50. $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
  51. $resultPage->getConfig()->getTitle()->prepend(__('Create Return Shipment'));
  52. return $resultPage;
  53. }
  54. }