1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Controller\Adminhtml\Order\Invoice;
use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;
use Magento\Framework\View\Result\PageFactory;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Registry;
class View extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\View implements HttpGetActionInterface
{
/**
* @var PageFactory
*/
protected $resultPageFactory;
/**
* @param Context $context
* @param Registry $registry
* @param \Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory
* @param PageFactory $resultPageFactory
*/
public function __construct(
Context $context,
Registry $registry,
\Magento\Backend\Model\View\Result\ForwardFactory $resultForwardFactory,
PageFactory $resultPageFactory
) {
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context, $registry, $resultForwardFactory);
}
/**
* Invoice information page
*
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
{
$invoice = $this->getInvoice();
if (!$invoice) {
/** @var \Magento\Framework\Controller\Result\Forward $resultForward */
$resultForward = $this->resultForwardFactory->create();
return $resultForward->forward('noroute');
}
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
$resultPage = $this->resultPageFactory->create();
$resultPage->setActiveMenu('Magento_Sales::sales_order');
$resultPage->getConfig()->getTitle()->prepend(__('Invoices'));
$resultPage->getConfig()->getTitle()->prepend(sprintf("#%s", $invoice->getIncrementId()));
$resultPage->getLayout()->getBlock(
'sales_invoice_view'
)->updateBackButtonUrl(
$this->getRequest()->getParam('come_from')
);
return $resultPage;
}
}