Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     if (!$this->orderLoader->load($this->_request, $this->_response)) {
         return;
     }
     $invoiceId = (int) $this->getRequest()->getParam('invoice_id');
     if ($invoiceId) {
         $invoice = $this->_objectManager->create('Magento\\Sales\\Model\\Order\\Invoice')->load($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);
         }
         $this->_view->loadLayout('print');
         $this->_view->renderLayout();
     } else {
         $this->_redirect('sales/guest/form');
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function execute()
 {
     $result = $this->orderLoader->load($this->_request);
     if ($result instanceof \Magento\Framework\Controller\ResultInterface) {
         return $result;
     }
     $shipmentId = (int) $this->getRequest()->getParam('shipment_id');
     if ($shipmentId) {
         $shipment = $this->_objectManager->create('Magento\\Sales\\Model\\Order\\Shipment')->load($shipmentId);
         $order = $shipment->getOrder();
     } else {
         $order = $this->_coreRegistry->registry('current_order');
     }
     if ($this->orderAuthorization->canView($order)) {
         if (isset($shipment)) {
             $this->_coreRegistry->register('current_shipment', $shipment);
         }
         return $this->resultPageFactory->create()->addHandle('print');
     } else {
         return $this->resultRedirectFactory->create()->setPath('sales/guest/form');
     }
 }
 /**
  * @return \Magento\Framework\Controller\ResultInterface
  */
 public function execute()
 {
     $result = $this->orderLoader->load($this->_request);
     if ($result instanceof \Magento\Framework\Controller\ResultInterface) {
         return $result;
     }
     $creditmemoId = (int) $this->getRequest()->getParam('creditmemo_id');
     if ($creditmemoId) {
         $creditmemo = $this->creditmemoRepository->get($creditmemoId);
         $order = $creditmemo->getOrder();
     } else {
         $order = $this->_coreRegistry->registry('current_order');
     }
     if ($this->orderAuthorization->canView($order)) {
         if (isset($creditmemo)) {
             $this->_coreRegistry->register('current_creditmemo', $creditmemo);
         }
         return $this->resultPageFactory->create()->addHandle('print');
     } else {
         return $this->resultRedirectFactory->create()->setPath('sales/guest/form');
     }
 }
Ejemplo n.º 4
0
    /**
     * {@inheritdoc}
     */
    public function executeInternal()
    {
        $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')->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');
        }
    }