![]() 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/old/vendor/fooman/pdfcustomiser-implementation-m2/src/Block/ |
<?php namespace Fooman\PdfCustomiser\Block; use Fooman\PdfCustomiser\Model\System\OrderBarcodeOptions; /** * Block in pdf to display order barcodes * * @author Kristof Ringleff * @copyright Copyright (c) 2009 Fooman Limited (http://www.fooman.co.nz) * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ class Barcode extends \Fooman\PdfCore\Block\Pdf\Block { const XML_PATH_BARCODE = 'sales_pdf/%s/ordernumberbarcode'; // phpcs:ignore PSR2.Classes.PropertyDeclaration protected $_template = 'Fooman_PdfCustomiser::pdf/barcode.phtml'; /** * @var \Fooman\PdfCore\Helper\ParamKey */ protected $paramKeyHelper; /** * @var \Fooman\PdfCore\Helper\Page */ protected $pageHelper; /** * @param \Magento\Framework\View\Element\Template\Context $context * @param \Fooman\PdfCore\Helper\Page $pageHelper * @param \Fooman\PdfCore\Helper\ParamKey $paramKeyHelper * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Fooman\PdfCore\Helper\Page $pageHelper, \Fooman\PdfCore\Helper\ParamKey $paramKeyHelper, array $data = [] ) { $this->paramKeyHelper = $paramKeyHelper; $this->pageHelper = $pageHelper; parent::__construct($context, $data); } /** * should we print a barcode * * @return bool * @access public */ public function shouldPrintBarcode() { $path = sprintf(self::XML_PATH_BARCODE, $this->getPdfType()); return $this->_scopeConfig->getValue( $path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getSalesObject()->getStoreId() ) > 0; } public function getOrderBarcodeType() { $path = sprintf(self::XML_PATH_BARCODE, $this->getPdfType()); $type = $this->_scopeConfig->getValue( $path, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getSalesObject()->getStoreId() ); switch ($type) { case OrderBarcodeOptions::DISPLAY_INLINE_QRCODE: return 'QRCODE,H'; case OrderBarcodeOptions::DISPLAY_INLINE_CODE39_CHECKSUM: return 'C39E+'; case OrderBarcodeOptions::DISPLAY_INLINE_CODE39: default: return 'C39E'; } } /** * @param array $params * * @return mixed */ public function getEncodedParams(array $params) { return $this->paramKeyHelper->getEncodedParams($params); } public function getPageWidth() { return $this->pageHelper->getPageWidth(); } public function getSideMargins() { return $this->pageHelper->getSideMargins(); } }