From a925393c672a376bffe44cb9b4f0eefa903baa62 Mon Sep 17 00:00:00 2001 From: evansgl Date: Wed, 3 Jan 2024 17:52:33 +0200 Subject: [PATCH] Prevent crash of sponge module when url is not populated --- mydata/ChangeLog.md | 7 +++++-- mydata/core/modules/facture/doc/pdf_sponge.modules.php | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mydata/ChangeLog.md b/mydata/ChangeLog.md index 8dced00..795b6fe 100644 --- a/mydata/ChangeLog.md +++ b/mydata/ChangeLog.md @@ -1,6 +1,9 @@ # CHANGELOG MYDATA FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) -#1.8 +#1.8.1 +Bug: Prevent crash of sponge module when aade url is not present. + +##1.8 Feature: Print QR AADE Code into pdf
Feature: Show AADE Link to verify invoice @@ -14,7 +17,7 @@ Bug: Handle large descriptions that are not allowed by AADE Bug: Fix date and time to comply AADDE API
-# 1.7 +## 1.7 Feature: Support negative values in invoices
Feature: Support πιστωτικές αποδείξεις. diff --git a/mydata/core/modules/facture/doc/pdf_sponge.modules.php b/mydata/core/modules/facture/doc/pdf_sponge.modules.php index bae8449..30f7bf0 100644 --- a/mydata/core/modules/facture/doc/pdf_sponge.modules.php +++ b/mydata/core/modules/facture/doc/pdf_sponge.modules.php @@ -1076,6 +1076,8 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $aade_invoiceUid = $object->array_options['options_mydata_reply_invoiceUid'] . " MARK " . $mark_result; $doc = new DOMDocument(); + + if (!empty(url) { $doc->loadHTML($url); $aTags = $doc->getElementsByTagName('a'); $qrcodestring = $aTags->item(0)->getAttribute('href'); @@ -1083,6 +1085,7 @@ public function write_file($object, $outputlangs, $srctemplatepath = '', $hidede $pdf->write2DBarcode($qrcodestring, 'QRCODE,M', $this->marge_gauche, 245, 200, 25, $styleQr, 'N'); $pdf->SetXY(55,275); $pdf->writeHTMLCell(200, 10, '', '', $aade_invoiceUid, 0, 1); + } } $pdf->Close();