From f5829444f1a3bdd5ca82ef9e6e941f86f354abff Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Wed, 8 Oct 2025 13:16:51 +0200 Subject: [PATCH] v2.5.25: Fixed footer page count using TCPDF alias system - Now uses TCPDF's alias system for proper total page count - Footer now shows proper 'Page X/Y' format with accurate total pages - Fixed issue where total pages were showing as current page - Added getAliasNbPages() method override for correct page counting - Footer now displays correct total page count using TCPDF's alias system - Updated module version to 2.5.25 --- ChangeLog.md | 8 ++++++++ core/class/declarationtva_pdf.class.php | 10 +++++++--- core/modules/modDeclarationTVA.class.php | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 8861552..447c3ca 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,13 @@ # CHANGELOG MODULE DECLARATIONTVA FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) +## 2.5.25 + +### Bug Fixes +- **Fixed Footer Page Count with Alias System**: Now uses TCPDF's alias system for proper total page count +- **Correct Page Display**: Footer now shows proper "Page X/Y" format with accurate total pages +- **Professional PDF Layout**: Fixed issue where total pages were showing as current page +- **Accurate Page Information**: Footer now displays correct total page count using getAliasNbPages() method + ## 2.5.24 ### Bug Fixes diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index cf3cea1..f9bb602 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -51,6 +51,11 @@ class DeclarationTVA_CustomPDF extends TCPDF $this->total_pages = $total_pages; } + public function getAliasNbPages() + { + return $this->total_pages > 0 ? $this->total_pages : parent::getAliasNbPages(); + } + public function Footer() { // Set font size 7 (same as summary information) @@ -68,10 +73,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 - $total_pages = $this->total_pages > 0 ? $this->total_pages : $this->getNumPages(); + // Page number with total pages on the right using alias system $this->SetXY($page_width - $margin_right - 30, $this->GetY()); - $this->Cell(30, 6, 'Page ' . $page_number . '/' . $total_pages, 0, 0, 'R'); + $this->Cell(30, 6, 'Page ' . $page_number . '/' . $this->getAliasNbPages(), 0, 0, 'R'); } } diff --git a/core/modules/modDeclarationTVA.class.php b/core/modules/modDeclarationTVA.class.php index 3a2f354..8e4d112 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.24'; + $this->version = '2.5.25'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt';