![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/magento/module-sales/Controller/Guest/ |
<?php /** * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Sales\Controller\Guest; use Magento\Framework\App\Action\Context; use Magento\Framework\View\Result\PageFactory; class PrintInvoice extends \Magento\Sales\Controller\AbstractController\PrintInvoice { /** * @var OrderLoader */ protected $orderLoader; /** * @param Context $context * @param OrderViewAuthorization $orderAuthorization * @param \Magento\Framework\Registry $registry * @param PageFactory $resultPageFactory * @param OrderLoader $orderLoader */ public function __construct( Context $context, OrderViewAuthorization $orderAuthorization, \Magento\Framework\Registry $registry, PageFactory $resultPageFactory, OrderLoader $orderLoader ) { $this->orderLoader = $orderLoader; parent::__construct( $context, $orderAuthorization, $registry, $resultPageFactory ); } /** * {@inheritdoc} */ public function execute() { $result = $this->orderLoader->load($this->_request); if ($result instanceof \Magento\Framework\Controller\ResultInterface) { return $result; } $invoiceId = (int)$this->getRequest()->getParam('invoice_id'); if ($invoiceId) { $invoice = $this->_objectManager->create( \Magento\Sales\Api\InvoiceRepositoryInterface::class )->get($invoiceId); $order = $invoice->getOrder(); } else { $order = $this->_coreRegistry->registry('current_order'); } if ($this->orderAuthorization->canView($order)) { if (isset($invoice)) { $this->_coreRegistry->register('current_invoice', $invoice); } return $this->resultPageFactory->create()->addHandle('print'); } else { return $this->resultRedirectFactory->create()->setPath('sales/guest/form'); } } }