Skip to content

Commit

Permalink
fix: error with export pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
fox-john committed Mar 27, 2023
1 parent 6d1657e commit cce9b4a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Service/ExportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@
use Language;
use Module;
use Order;
use PDF;
use PrestaShop\Module\Psgdpr\Service\Smarty;
use PDFGenerator;
use PdfGeneratorService;
use PrestaShop\PrestaShop\Adapter\Entity\CustomerThread;
use PrestaShop\PrestaShop\Core\Domain\Customer\ValueObject\CustomerId;
use PrestaShopBundle\Translation\TranslatorInterface;
Expand Down Expand Up @@ -250,7 +249,15 @@ private function exportCustomerToPdf(CustomerId $customerId, array $customerData
$this->context->smarty->escape_html = false;

$pdfGenerator = new PDFGenerator(false, 'P');
$template = new PdfGeneratorService($customerData, $this->context->smarty);

/** @var Smarty $smarty */
$smarty = $this->context->smarty;

if ($smarty === null) {
throw new PrestaShopException('Smarty not initialized');
}

$template = new PdfGeneratorService($customerData, $smarty);

$pdfGenerator->setFontForLang($this->context->language->iso_code);
$pdfGenerator->startPageGroup();
Expand Down
9 changes: 9 additions & 0 deletions src/Service/PdfGeneratorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@

// require _PS_MODULE_DIR_.'psgdpr/psgdpr.php';

namespace PrestaShop\Module\Psgdpr\Service;

use Configuration;
use Context;
use HTMLTemplate;
use Shop;
use Smarty;
use Tools;

class PdfGeneratorService extends HTMLTemplate
{
/**
Expand Down

0 comments on commit cce9b4a

Please sign in to comment.