From 7f7aa5a9fc555468efd368fa2fc93341fe331eb5 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Wed, 8 Oct 2025 13:12:12 +0200 Subject: [PATCH] v2.5.23: Fixed footer page count using TCPDF placeholder - Now uses TCPDF's {nb} placeholder for accurate total page count - Footer now shows proper 'Page X/Y' format with correct total pages - Fixed issue where total pages showed same as current page - Footer now displays correct total page count using TCPDF's built-in mechanism - Updated module version to 2.5.23 --- ChangeLog.md | 8 ++++++++ core/class/declarationtva_pdf.class.php | 8 +++----- core/modules/modDeclarationTVA.class.php | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 688be1d..996e7b2 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,13 @@ # CHANGELOG MODULE DECLARATIONTVA FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) +## 2.5.23 + +### Bug Fixes +- **Fixed Footer Page Count**: Now uses TCPDF's {nb} placeholder for accurate total page count +- **Correct Page Display**: Footer now shows proper "Page X/Y" format with correct total pages +- **Professional PDF Layout**: Fixed issue where total pages showed same as current page +- **Accurate Page Information**: Footer now displays correct total page count + ## 2.5.22 ### Bug Fixes diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index 0d8e3a7..e24de94 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -50,9 +50,8 @@ class DeclarationTVA_CustomPDF extends TCPDF // Set font size 7 (same as summary information) $this->SetFont('helvetica', '', 7); - // Get current page number and total pages + // Get current page number $page_number = $this->getPage(); - $total_pages = $this->getNumPages(); // Get page width for positioning $page_width = $this->getPageWidth(); @@ -63,10 +62,9 @@ class DeclarationTVA_CustomPDF extends TCPDF $this->SetXY($margin_left, $this->GetY()); $this->Cell(0, 6, $this->company_name, 0, 0, 'L'); - // Page number with total pages on the right (e.g., "Page 1/7") - $page_text = 'Page ' . $page_number . '/' . $total_pages; + // Page number with total pages on the right using TCPDF's {nb} placeholder $this->SetXY($page_width - $margin_right - 30, $this->GetY()); - $this->Cell(30, 6, $page_text, 0, 0, 'R'); + $this->Cell(30, 6, 'Page ' . $page_number . '/{nb}', 0, 0, 'R'); } } diff --git a/core/modules/modDeclarationTVA.class.php b/core/modules/modDeclarationTVA.class.php index a0d43bc..d35046d 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.22'; + $this->version = '2.5.23'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt';