34 lines
919 B
PHP
34 lines
919 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace External\PompoBundle\Attachment;
|
|
|
|
use KupShop\OrderingBundle\Attachment\BaseAttachment;
|
|
use KupShop\OrderingBundle\Exception\InvoiceException;
|
|
use KupShop\OrderingBundle\Util\Invoice\PdfGenerator;
|
|
|
|
class ReceiptPDFAttachment extends BaseAttachment
|
|
{
|
|
/** @required */
|
|
public PdfGenerator $pdfGenerator;
|
|
|
|
protected static $name = '[pompo] Účtenka';
|
|
protected static $type = 'pompo_receipt';
|
|
|
|
protected $filename = 'Uctenka_{KOD}.pdf';
|
|
|
|
public function getContent()
|
|
{
|
|
if ($this->order) {
|
|
if (!$this->order->getData('transactionPrintout')) {
|
|
throw new InvoiceException('Chybějící data pro účtenku.');
|
|
}
|
|
|
|
return $this->pdfGenerator->setTemplate('receiptPDF')->getInvoicePDFContent($this->order->id);
|
|
}
|
|
|
|
throw new InvoiceException('Nelze vytisknout účtenku.');
|
|
}
|
|
}
|