diff --git a/application/Espo/Modules/Crm/Tools/Campaign/MailMergeGenerator.php b/application/Espo/Modules/Crm/Tools/Campaign/MailMergeGenerator.php index 20c7150752..9a9c28050f 100644 --- a/application/Espo/Modules/Crm/Tools/Campaign/MailMergeGenerator.php +++ b/application/Espo/Modules/Crm/Tools/Campaign/MailMergeGenerator.php @@ -50,7 +50,7 @@ use Espo\Tools\Pdf\ZipContents; class MailMergeGenerator { - private const DEFAULT_ENGINE = 'Tcpdf'; + private const DEFAULT_ENGINE = 'Dompdf'; private const ATTACHMENT_MAIL_MERGE_ROLE = 'Mail Merge'; private EntityManager $entityManager; diff --git a/application/Espo/Resources/defaults/tcpdf-config.php b/application/Espo/Resources/defaults/tcpdf-config.php deleted file mode 100644 index 35d4dba347..0000000000 --- a/application/Espo/Resources/defaults/tcpdf-config.php +++ /dev/null @@ -1,58 +0,0 @@ -getBarcodeSVGcode($width, $height, $color); + $options = new QROptions(); - $encoded = base64_encode($code); + $options->outputType = QRCode::OUTPUT_MARKUP_SVG; + + $code = (new QRCode($options))->render($value); $css = "width: {$width}mm; height: {$height}mm;"; - return ""; + return ""; } if (!$type) { @@ -271,10 +273,9 @@ class HtmlComposer $width = $data['width'] ?? 60; $height = $data['height'] ?? 30; - $color = $data['color'] ?? [0, 0, 0]; + $color = $data['color'] ?? '#000'; - $barcode = new TCPDFBarcode($value, $type); - $code = $barcode->getBarcodeSVGcode($width, $height, $color); + $code = (new BarcodeGeneratorSVG())->getBarcode($value, $type, 2, $height, $color); $encoded = base64_encode($code); diff --git a/application/Espo/Tools/Pdf/MassService.php b/application/Espo/Tools/Pdf/MassService.php index 58c0f37342..1c2b91d044 100644 --- a/application/Espo/Tools/Pdf/MassService.php +++ b/application/Espo/Tools/Pdf/MassService.php @@ -51,7 +51,7 @@ use Espo\Tools\Pdf\Jobs\RemoveMassFile; class MassService { - private const DEFAULT_ENGINE = 'Tcpdf'; + private const DEFAULT_ENGINE = 'Dompdf'; private const ATTACHMENT_MASS_PDF_ROLE = 'Mass Pdf'; private const REMOVE_MASS_PDF_PERIOD = '1 hour'; diff --git a/application/Espo/Tools/Pdf/Service.php b/application/Espo/Tools/Pdf/Service.php index 37824db87d..e730b94241 100644 --- a/application/Espo/Tools/Pdf/Service.php +++ b/application/Espo/Tools/Pdf/Service.php @@ -41,7 +41,7 @@ use Espo\Tools\Pdf\Data\DataLoaderManager; class Service { - private const DEFAULT_ENGINE = 'Tcpdf'; + private const DEFAULT_ENGINE = 'Dompdf'; private EntityManager $entityManager; private Acl $acl; diff --git a/application/Espo/Tools/Pdf/Tcpdf/EntityProcessor.php b/application/Espo/Tools/Pdf/Tcpdf/EntityProcessor.php deleted file mode 100644 index 44fcedefc7..0000000000 --- a/application/Espo/Tools/Pdf/Tcpdf/EntityProcessor.php +++ /dev/null @@ -1,249 +0,0 @@ -config = $config; - $this->templateRendererFactory = $templateRendererFactory; - } - - public function process(Tcpdf $pdf, Template $template, Entity $entity, Params $params, Data $data): void - { - $renderer = $this->templateRendererFactory - ->create() - ->setApplyAcl($params->applyAcl()) - ->setEntity($entity) - ->setData($data->getAdditionalTemplateData()); - - $fontFace = $this->config->get('pdfFontFace', $this->fontFace); - $fontSize = $this->config->get('pdfFontSize', $this->fontSize); - - if ($template->getFontFace()) { - $fontFace = $template->getFontFace(); - } - - if ($template->hasTitle()) { - $title = $this->replacePlaceholders($template->getTitle(), $entity); - - $pdf->SetTitle($title); - } - - $pdf->setFont($fontFace, '', $fontSize, '', true); - - $pdf->setAutoPageBreak(true, $template->getBottomMargin()); - - $pdf->setMargins( - $template->getLeftMargin(), - $template->getTopMargin(), - $template->getRightMargin() - ); - - $pageOrientation = $template->getPageOrientation(); - - $pageFormat = $template->getPageFormat(); - - if ($pageFormat === 'Custom') { - $pageFormat = [ - $template->getPageWidth(), - $template->getPageHeight(), - ]; - } - - $pageOrientationCode = 'P'; - - if ($pageOrientation === 'Landscape') { - $pageOrientationCode = 'L'; - } - - if ($template->hasFooter()) { - $htmlFooter = $this->render($renderer, $template->getFooter()); - - $pdf->setFooterFont([$fontFace, '', $this->fontSize]); - $pdf->setFooterPosition($template->getFooterPosition()); - - $pdf->setFooterHtml($htmlFooter); - } - else { - $pdf->setPrintFooter(false); - } - - if ($template->hasHeader()) { - $htmlHeader = $this->render($renderer, $template->getHeader()); - - $pdf->setHeaderFont([$fontFace, '', $this->fontSize]); - $pdf->setHeaderPosition($template->getHeaderPosition()); - - $pdf->setHeaderHtml($htmlHeader); - } - else { - $pdf->setPrintHeader(false); - } - - $pdf->addPage($pageOrientationCode, $pageFormat); - - $htmlBody = $this->render($renderer, $template->getBody()); - - $pdf->writeHTML($htmlBody, true, false, true, false, ''); - } - - private function render(TemplateRenderer $renderer, string $template): string - { - $html = $renderer->renderTemplate($template); - - /** @var string */ - return preg_replace_callback( - '//', - function ($matches) { - $dataString = $matches[1]; - - $data = json_decode(urldecode($dataString), true); - - return $this->composeBarcodeTag($data); - }, - $html - ); - } - - /** - * - * @param array $data - * @return string - */ - private function composeBarcodeTag(array $data): string - { - $value = $data['value'] ?? null; - - $codeType = $data['type'] ?? 'CODE128'; - - $typeMap = [ - "CODE128" => 'C128', - "CODE128A" => 'C128A', - "CODE128B" => 'C128B', - "CODE128C" => 'C128C', - "EAN13" => 'EAN13', - "EAN8" => 'EAN8', - "EAN5" => 'EAN5', - "EAN2" => 'EAN2', - "UPC" => 'UPCA', - "UPCE" => 'UPCE', - "ITF14" => 'I25', - "pharmacode" => 'PHARMA', - "QRcode" => 'QRCODE,H', - ]; - - if ($codeType === 'QRcode') { - $function = 'write2DBarcode'; - - $params = [ - $value, - $typeMap[$codeType] ?? null, /** @phpstan-ignore-line */ - '', '', - $data['width'] ?? 40, - $data['height'] ?? 40, - [ - 'border' => false, - 'vpadding' => $data['padding'] ?? 2, - 'hpadding' => $data['padding'] ?? 2, - 'fgcolor' => $data['color'] ?? [0, 0, 0], - 'bgcolor' => $data['bgcolor'] ?? false, - 'module_width' => 1, - 'module_height' => 1, - ], - 'N', - ]; - } - else { - $function = 'write1DBarcode'; - - $params = [ - $value, - $typeMap[$codeType] ?? null, - '', '', - $data['width'] ?? 60, - $data['height'] ?? 30, - 0.4, - [ - 'position' => 'S', - 'border' => false, - 'padding' => $data['padding'] ?? 0, - 'fgcolor' => $data['color'] ?? [0, 0, 0], - 'bgcolor' => $data['bgcolor'] ?? [255, 255, 255], - 'text' => $data['text'] ?? true, - 'font' => 'helvetica', - 'fontsize' => $data['fontsize'] ?? 14, - 'stretchtext' => 4, - ], - 'N', - ]; - } - - $paramsString = urlencode(Json::encode($params)); - - return ""; - } - - private function replacePlaceholders(string $string, Entity $entity): string - { - $newString = $string; - - $attributeList = ['name']; - - foreach ($attributeList as $attribute) { - $value = (string) ($entity->get($attribute) ?? ''); - - $newString = str_replace('{$' . $attribute . '}', $value, $newString); - } - - return $newString; - } -} diff --git a/application/Espo/Tools/Pdf/Tcpdf/Tcpdf.php b/application/Espo/Tools/Pdf/Tcpdf/Tcpdf.php deleted file mode 100644 index b4c1250e08..0000000000 --- a/application/Espo/Tools/Pdf/Tcpdf/Tcpdf.php +++ /dev/null @@ -1,223 +0,0 @@ -useGroupNumbers = $value; - } - - /** - * @param string $html - * @return void - */ - public function setHeaderHtml($html) - { - $this->headerHtml = $html; - } - - /** - * @param string $html - * @return void - */ - public function setFooterHtml($html) - { - $this->footerHtml = $html; - } - - /** - * @param float $position - * @return void - */ - public function setFooterPosition($position) - { - $this->footerPosition = $position; - } - - /** - * @param float $position - * @return void - */ - public function setHeaderPosition($position) - { - $this->headerPosition = $position; - } - - /** - * @return void - */ - public function Header() - { - $this->SetY($this->headerPosition); - - $html = $this->headerHtml; - - $html = $this->setPageNumbers($html); - - $this->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, '', 0, false); - } - - /** - * @return void - */ - public function Footer() - { - $breakMargin = $this->getBreakMargin(); - $autoPageBreak = $this->AutoPageBreak; - - $this->SetAutoPageBreak(false, 0); - - $this->SetY((-1) * $this->footerPosition); - - $html = $this->footerHtml; - - $html = $this->setPageNumbers($html); - - $this->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, '', 0, false); - - $this->SetAutoPageBreak($autoPageBreak, $breakMargin); - } - - /** - * @param string $html - * @return string - */ - private function setPageNumbers($html): string { - if ($this->useGroupNumbers) { - $html = str_replace('{pageNumber}', '{{:png:}}', $html); - $html = str_replace('{pageAbsoluteNumber}', '{{:pnp:}}', $html); - - /** @phpstan-ignore-next-line */ - if ($this->isUnicodeFont()) { - $html = str_replace('{totalPageNumber}', '{{:ptg:}}', $html); - } else { - $html = str_replace('{totalPageNumber}', '{:ptg:}', $html); - } - } else { - $html = str_replace('{pageNumber}', '{{:pnp:}}', $html); - $html = str_replace('{pageAbsoluteNumber}', '{{:pnp:}}', $html); - - /** @phpstan-ignore-next-line */ - if ($this->isUnicodeFont()) { - $html = str_replace('{totalPageNumber}', '{{:ptp:}}', $html); - } else { - $html = str_replace('{totalPageNumber}', '{:ptp:}', $html); - } - } - - return $html; - } - - /** - * @param string $name - * @param string $dest - * @return string - * @throws \Exception - */ - public function Output($name = 'doc.pdf', $dest = 'I') - { - if ($dest === 'I' && !$this->sign && php_sapi_name() != 'cli') { - if ($this->state < 3) { - $this->Close(); - } - /** @var string $name */ - $name = preg_replace('/[\s]+/', '_', $name); - $name = Util::sanitizeFileName($name); - - if (ob_get_contents()) { - $this->Error('Some data has already been output, can\'t send PDF file'); - } - - header('Content-Type: application/pdf'); - if (headers_sent()) { - $this->Error('Some data has already been output to browser, can\'t send PDF file'); - } - header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1'); - header('Pragma: public'); - header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); - header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); - header('Content-Disposition: inline; filename="'.$name.'"'); - TCPDF_STATIC::sendOutputData($this->getBuffer(), $this->bufferlen); - - return ''; - } - - return parent::Output($name, $dest); - } -} diff --git a/application/Espo/Tools/Pdf/Tcpdf/TcpdfCollectionPrinter.php b/application/Espo/Tools/Pdf/Tcpdf/TcpdfCollectionPrinter.php deleted file mode 100644 index 4de746b37b..0000000000 --- a/application/Espo/Tools/Pdf/Tcpdf/TcpdfCollectionPrinter.php +++ /dev/null @@ -1,69 +0,0 @@ -entityProcessor = $entityProcessor; - } - - /** - * @param Collection<\Espo\ORM\Entity> $collection - */ - public function print(Template $template, Collection $collection, Params $params, IdDataMap $dataMap): Contents - { - $pdf = new Tcpdf(); - - $pdf->setUseGroupNumbers(true); - - foreach ($collection as $entity) { - $pdf->startPageGroup(); - - $data = $dataMap->get($entity->getId()) ?? Data::create(); - - $this->entityProcessor->process($pdf, $template, $entity, $params, $data); - } - - return new TcpdfContents($pdf); - } -} diff --git a/application/Espo/Tools/Pdf/Tcpdf/TcpdfContents.php b/application/Espo/Tools/Pdf/Tcpdf/TcpdfContents.php deleted file mode 100644 index c4d6776284..0000000000 --- a/application/Espo/Tools/Pdf/Tcpdf/TcpdfContents.php +++ /dev/null @@ -1,73 +0,0 @@ -pdf = $pdf; - } - - public function getStream(): StreamInterface - { - $resource = fopen('php://temp', 'r+'); - - if ($resource === false) { - throw new RuntimeException("Could not open temp."); - } - - fwrite($resource, $this->getString()); - rewind($resource); - - return new Stream($resource); - } - - public function getString(): string - { - return $this->pdf->output('', 'S'); - } - - public function getLength(): int - { - return strlen($this->getString()); - } -} diff --git a/application/Espo/Tools/Pdf/Tcpdf/TcpdfEntityPrinter.php b/application/Espo/Tools/Pdf/Tcpdf/TcpdfEntityPrinter.php deleted file mode 100644 index 73ff8e8f2d..0000000000 --- a/application/Espo/Tools/Pdf/Tcpdf/TcpdfEntityPrinter.php +++ /dev/null @@ -1,57 +0,0 @@ -entityProcessor = $entityProcessor; - } - - public function print(Template $template, Entity $entity, Params $params, Data $data): Contents - { - $pdf = new Tcpdf(); - - $this->entityProcessor->process($pdf, $template, $entity, $params, $data); - - return new TcpdfContents($pdf); - } -} diff --git a/client/src/views/template/fields/font-face.js b/client/src/views/template/fields/font-face.js index 4ceebb5373..20d322d410 100644 --- a/client/src/views/template/fields/font-face.js +++ b/client/src/views/template/fields/font-face.js @@ -31,7 +31,7 @@ define('views/template/fields/font-face', ['views/fields/enum'], function (Dep) return Dep.extend({ setupOptions: function () { - var engine = this.getConfig().get('pdfEngine') || 'Tcpdf'; + var engine = this.getConfig().get('pdfEngine') || 'Dompdf'; var fontFaceList = this.getMetadata().get([ 'app', 'pdfEngines', engine, 'fontFaceList', diff --git a/composer.json b/composer.json index 458703346d..0baba53146 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,6 @@ "zordius/lightncandy": "dev-espo#v1.2.5e", "composer/semver": "^3", "spatie/async": "1.5.6", - "tecnickcom/tcpdf": "6.3.5", "symfony/process": "6.0.*", "symfony/http-foundation": "6.0.*", "symfony/routing": "6.0.*", @@ -48,7 +47,9 @@ "phpseclib/phpseclib": "^3.0", "openspout/openspout": "^4.9", "dompdf/dompdf": "^2.0", - "brick/phonenumber": "^0.5.0" + "brick/phonenumber": "^0.5.0", + "picqer/php-barcode-generator": "^2.4", + "chillerlan/php-qrcode": "^4.3" }, "require-dev": { "phpunit/phpunit": "^9", @@ -74,7 +75,6 @@ "Espo\\Modules\\": "custom/Espo/Modules/" }, "files": [ - "application/Espo/Resources/defaults/tcpdf-config.php", "application/Espo/Resources/defaults/class-aliases.php" ] }, diff --git a/composer.lock b/composer.lock index 484d2907c2..9d278717b4 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d00cfc7a66d5f0fc733141d48f9eca16", + "content-hash": "9282cc67e31e0de81934dcbdefcad5e6", "packages": [ { "name": "async-aws/core", @@ -249,6 +249,148 @@ }, "time": "2021-12-14T00:20:41+00:00" }, + { + "name": "chillerlan/php-qrcode", + "version": "4.3.4", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-qrcode.git", + "reference": "2ca4bf5ae048af1981d1023ee42a0a2a9d51e51d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/2ca4bf5ae048af1981d1023ee42a0a2a9d51e51d", + "reference": "2ca4bf5ae048af1981d1023ee42a0a2a9d51e51d", + "shasum": "" + }, + "require": { + "chillerlan/php-settings-container": "^2.1.4", + "ext-mbstring": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phan/phan": "^5.3", + "phpunit/phpunit": "^9.5", + "setasign/fpdf": "^1.8.2" + }, + "suggest": { + "chillerlan/php-authenticator": "Yet another Google authenticator! Also creates URIs for mobile apps.", + "setasign/fpdf": "Required to use the QR FPDF output." + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\QRCode\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kazuhiko Arase", + "homepage": "https://github.com/kazuhikoarase" + }, + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + }, + { + "name": "Contributors", + "homepage": "https://github.com/chillerlan/php-qrcode/graphs/contributors" + } + ], + "description": "A QR code generator. PHP 7.4+", + "homepage": "https://github.com/chillerlan/php-qrcode", + "keywords": [ + "phpqrcode", + "qr", + "qr code", + "qrcode", + "qrcode-generator" + ], + "support": { + "issues": "https://github.com/chillerlan/php-qrcode/issues", + "source": "https://github.com/chillerlan/php-qrcode/tree/4.3.4" + }, + "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, + { + "url": "https://ko-fi.com/codemasher", + "type": "ko_fi" + } + ], + "time": "2022-07-25T09:12:45+00:00" + }, + { + "name": "chillerlan/php-settings-container", + "version": "2.1.4", + "source": { + "type": "git", + "url": "https://github.com/chillerlan/php-settings-container.git", + "reference": "1beb7df3c14346d4344b0b2e12f6f9a74feabd4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/chillerlan/php-settings-container/zipball/1beb7df3c14346d4344b0b2e12f6f9a74feabd4a", + "reference": "1beb7df3c14346d4344b0b2e12f6f9a74feabd4a", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phan/phan": "^5.3", + "phpunit/phpunit": "^9.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "chillerlan\\Settings\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Smiley", + "email": "smiley@chillerlan.net", + "homepage": "https://github.com/codemasher" + } + ], + "description": "A container class for immutable settings objects. Not a DI container. PHP 7.4+", + "homepage": "https://github.com/chillerlan/php-settings-container", + "keywords": [ + "PHP7", + "Settings", + "configuration", + "container", + "helper" + ], + "support": { + "issues": "https://github.com/chillerlan/php-settings-container/issues", + "source": "https://github.com/chillerlan/php-settings-container" + }, + "funding": [ + { + "url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4", + "type": "custom" + }, + { + "url": "https://ko-fi.com/codemasher", + "type": "ko_fi" + } + ], + "time": "2022-07-05T22:32:14+00:00" + }, { "name": "composer/semver", "version": "3.0.0", @@ -3334,6 +3476,93 @@ ], "time": "2023-03-05T17:13:09+00:00" }, + { + "name": "picqer/php-barcode-generator", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/picqer/php-barcode-generator.git", + "reference": "4cec18909dffd86e14beb69b1040f2520c2e1bb1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/picqer/php-barcode-generator/zipball/4cec18909dffd86e14beb69b1040f2520c2e1bb1", + "reference": "4cec18909dffd86e14beb69b1040f2520c2e1bb1", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.3|^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5" + }, + "suggest": { + "ext-bcmath": "Barcode IMB (Intelligent Mail Barcode) needs bcmath extension", + "ext-gd": "For JPG and PNG generators, GD or Imagick is required", + "ext-imagick": "For JPG and PNG generators, GD or Imagick is required" + }, + "type": "library", + "autoload": { + "psr-4": { + "Picqer\\Barcode\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "homepage": "http://nicolaasuni.tecnick.com" + }, + { + "name": "Casper Bakker", + "email": "info@picqer.com", + "homepage": "https://picqer.com" + } + ], + "description": "An easy to use, non-bloated, barcode generator in PHP. Creates SVG, PNG, JPG and HTML images from the most used 1D barcode standards.", + "homepage": "https://github.com/picqer/php-barcode-generator", + "keywords": [ + "CODABAR", + "Code11", + "Code93", + "EAN13", + "KIX", + "KIXCODE", + "MSI", + "POSTNET", + "Pharma", + "Standard 2 of 5", + "barcode", + "barcode generator", + "code128", + "code39", + "ean", + "html", + "jpeg", + "jpg", + "php", + "png", + "svg", + "upc" + ], + "support": { + "issues": "https://github.com/picqer/php-barcode-generator/issues", + "source": "https://github.com/picqer/php-barcode-generator/tree/v2.4.0" + }, + "funding": [ + { + "url": "https://github.com/casperbakker", + "type": "github" + } + ], + "time": "2023-09-16T08:58:52+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -6057,72 +6286,6 @@ ], "time": "2021-03-23T23:28:01+00:00" }, - { - "name": "tecnickcom/tcpdf", - "version": "6.3.5", - "source": { - "type": "git", - "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "19a535eaa7fb1c1cac499109deeb1a7a201b4549" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/19a535eaa7fb1c1cac499109deeb1a7a201b4549", - "reference": "19a535eaa7fb1c1cac499109deeb1a7a201b4549", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "config", - "include", - "tcpdf.php", - "tcpdf_parser.php", - "tcpdf_import.php", - "tcpdf_barcodes_1d.php", - "tcpdf_barcodes_2d.php", - "include/tcpdf_colors.php", - "include/tcpdf_filters.php", - "include/tcpdf_font_data.php", - "include/tcpdf_fonts.php", - "include/tcpdf_images.php", - "include/tcpdf_static.php", - "include/barcodes/datamatrix.php", - "include/barcodes/pdf417.php", - "include/barcodes/qrcode.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0-only" - ], - "authors": [ - { - "name": "Nicola Asuni", - "email": "info@tecnick.com", - "role": "lead" - } - ], - "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", - "homepage": "http://www.tcpdf.org/", - "keywords": [ - "PDFD32000-2008", - "TCPDF", - "barcodes", - "datamatrix", - "pdf", - "pdf417", - "qrcode" - ], - "support": { - "issues": "https://github.com/tecnickcom/TCPDF/issues", - "source": "https://github.com/tecnickcom/TCPDF/tree/6.3.5" - }, - "time": "2020-02-14T14:20:12+00:00" - }, { "name": "webmozart/assert", "version": "1.11.0", diff --git a/upgrades/8.1/scripts/AfterUpgrade.php b/upgrades/8.1/scripts/AfterUpgrade.php index 215b868c6c..030a768aa9 100644 --- a/upgrades/8.1/scripts/AfterUpgrade.php +++ b/upgrades/8.1/scripts/AfterUpgrade.php @@ -35,6 +35,8 @@ class AfterUpgrade { public function run(Container $container): void { + $config = $container->getByClass(Espo\Core\Utils\Config::class); + $configWriter = $container->getByClass(InjectableFactory::class) ->create(ConfigWriter::class); @@ -43,6 +45,17 @@ class AfterUpgrade 'phoneNumberInternational' => false, ]); + if ($config->get('pdfEngine') === 'Tcpdf') { + $configWriter->set('pdfEngine', 'Dompdf'); + + if (php_sapi_name() === 'cli') { + echo "Important. The 'Tcpdf' PDF engine has been removed from EspoCRM. " . + "Now PDF printing is handled by the 'Dompdf' engine. " . + "If you would like to continue using the 'Tcpdf', download and install a free extension: {link}. " . + "After that, set 'Tcpdf' at Administration > Settings > PDF Engine."; + } + } + $configWriter->save(); } }