From 85feea7cf3096d752fc842589a097662bed035c4 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Wed, 8 Oct 2025 12:46:35 +0200 Subject: [PATCH] v2.5.11: Fixed TCPDF class loading issue - Added proper TCPDF include statement before custom class definition - Ensured TCPDF is loaded before extending it with custom PDF class - Fixed 'Class TCPDF not found' error - Custom PDF class now works correctly with proper dependencies - Updated module version to 2.5.11 --- ChangeLog.md | 8 ++++++++ core/class/declarationtva_pdf.class.php | 5 +++++ core/modules/modDeclarationTVA.class.php | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index df1d533..eb5358e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,13 @@ # CHANGELOG MODULE DECLARATIONTVA FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) +## 2.5.11 + +### Bug Fixes +- **Fixed TCPDF Loading**: Added proper TCPDF include statement before custom class definition +- **Class Loading**: Ensured TCPDF is loaded before extending it with custom PDF class +- **Error Resolution**: Fixed "Class TCPDF not found" error +- **Stable Implementation**: Custom PDF class now works correctly with proper dependencies + ## 2.5.10 ### Bug Fixes diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 97dd2bd..0fd3dff 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -15,6 +15,11 @@ * along with this program. If not, see . */ +// Ensure TCPDF is loaded +if (!class_exists('TCPDF')) { + require_once DOL_DOCUMENT_ROOT . '/includes/tcpdf/tcpdf.php'; +} + /** * Custom PDF class with footer functionality */ diff --git a/core/modules/modDeclarationTVA.class.php b/core/modules/modDeclarationTVA.class.php index b266819..1f37fa0 100644 --- a/core/modules/modDeclarationTVA.class.php +++ b/core/modules/modDeclarationTVA.class.php @@ -76,7 +76,7 @@ class modDeclarationTVA extends DolibarrModules $this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@declarationtva' // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z' - $this->version = '2.5.10'; + $this->version = '2.5.11'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt';