Info.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Refer to LICENSE.txt distributed with the Temando Shipping module for notice of license
  4. */
  5. namespace Temando\Shipping\Block\Adminhtml\Rma\RmaShipment\View;
  6. use Magento\Sales\Api\Data\OrderAddressInterfaceFactory;
  7. use Temando\Shipping\Block\Adminhtml\Sales\Order\View\Info as SalesOrderInfo;
  8. use Temando\Shipping\Model\ResourceModel\Order\OrderRepository;
  9. use Temando\Shipping\Model\ResourceModel\Rma\RmaAccess;
  10. use Temando\Shipping\Model\Shipment\ShipmentProviderInterface;
  11. /**
  12. * RMA Shipment General Info
  13. *
  14. * @api
  15. * @package Temando\Shipping\Block
  16. * @author Rhodri Davies <rhodri.davies@temando.com>
  17. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  18. * @link http://www.temando.com/
  19. *
  20. * @deprecated since 1.1.3 | Block data is provided by view model
  21. * @see \Temando\Shipping\ViewModel\Order\CustomerDetails
  22. * @see \Temando\Shipping\ViewModel\Order\OrderDetails
  23. * @see \Temando\Shipping\ViewModel\Rma\RmaView
  24. *
  25. * @method \Magento\Sales\Api\Data\OrderInterface getOrder()
  26. * @method void setOrder() setOrder(\Magento\Sales\Api\Data\OrderInterface $order)
  27. */
  28. class Info extends SalesOrderInfo
  29. {
  30. /**
  31. * @var RmaAccess
  32. */
  33. private $rmaAccess;
  34. /**
  35. * Info constructor.
  36. * @param \Magento\Backend\Block\Template\Context $context
  37. * @param \Magento\Framework\Registry $registry
  38. * @param \Magento\Sales\Helper\Admin $adminHelper
  39. * @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository
  40. * @param \Magento\Customer\Api\CustomerMetadataInterface $metadata
  41. * @param \Magento\Customer\Model\Metadata\ElementFactory $elementFactory
  42. * @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer
  43. * @param ShipmentProviderInterface $shipmentProvider
  44. * @param OrderAddressInterfaceFactory $addressFactory
  45. * @param OrderRepository $orderRepository
  46. * @param RmaAccess $rmaAccess
  47. * @param mixed[] $data
  48. */
  49. public function __construct(
  50. \Magento\Backend\Block\Template\Context $context,
  51. \Magento\Framework\Registry $registry,
  52. \Magento\Sales\Helper\Admin $adminHelper,
  53. \Magento\Customer\Api\GroupRepositoryInterface $groupRepository,
  54. \Magento\Customer\Api\CustomerMetadataInterface $metadata,
  55. \Magento\Customer\Model\Metadata\ElementFactory $elementFactory,
  56. \Magento\Sales\Model\Order\Address\Renderer $addressRenderer,
  57. ShipmentProviderInterface $shipmentProvider,
  58. OrderAddressInterfaceFactory $addressFactory,
  59. OrderRepository $orderRepository,
  60. RmaAccess $rmaAccess,
  61. $data = []
  62. ) {
  63. $this->rmaAccess = $rmaAccess;
  64. parent::__construct(
  65. $context,
  66. $registry,
  67. $adminHelper,
  68. $groupRepository,
  69. $metadata,
  70. $elementFactory,
  71. $addressRenderer,
  72. $shipmentProvider,
  73. $addressFactory,
  74. $orderRepository,
  75. $data
  76. );
  77. }
  78. /**
  79. * Set the order model for use in parent class.
  80. *
  81. * @see \Magento\Sales\Block\Adminhtml\Order\View\Info::getOrderStoreName
  82. *
  83. * @throws \Magento\Framework\Exception\LocalizedException
  84. * @return $this
  85. */
  86. protected function _beforeToHtml()
  87. {
  88. /** @var \Magento\Rma\Model\Rma $rma */
  89. $rma = $this->getData('viewModel')->getRma();
  90. $order = $rma->getOrder();
  91. $this->setOrder($order);
  92. return $this;
  93. }
  94. }