From 348a2ecb1ebc042123aac32cd00b2c739a08edf4 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Wed, 8 Oct 2025 12:41:16 +0200 Subject: [PATCH] v2.5.9: Custom footer with company name and page numbering - Added company name on the left side of footer - Page number remains on the right side of footer - Footer uses same font size as summary information (size 7) - Professional branding with company name on every page - Enhanced footer layout for complete document identification - Updated module version to 2.5.9 --- ChangeLog.md | 8 +++++ core/class/declarationtva_pdf.class.php | 39 ++++++++++++++++++++++++ core/modules/modDeclarationTVA.class.php | 2 +- 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 40e2207..697e92f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,13 @@ # CHANGELOG MODULE DECLARATIONTVA FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) +## 2.5.9 + +### UI/UX Improvements +- **Custom Footer**: Added company name on the left and page number on the right in footer +- **Font Consistency**: Footer uses the same font size as summary information (size 7) +- **Professional Branding**: Company name is displayed on every page +- **Complete Layout**: Enhanced footer with both company identification and page numbering + ## 2.5.8 ### UI/UX Improvements diff --git a/core/class/declarationtva_pdf.class.php b/core/class/declarationtva_pdf.class.php index c13305b..df239d9 100644 --- a/core/class/declarationtva_pdf.class.php +++ b/core/class/declarationtva_pdf.class.php @@ -825,6 +825,9 @@ class DeclarationTVA_PDF // Set thin borders for all elements $pdf->SetLineWidth(0.1); + // Set custom footer + $pdf->setFooterCallback(array($this, 'customFooter')); + // Add a page $pdf->AddPage(); @@ -1409,6 +1412,9 @@ class DeclarationTVA_PDF // Set thin borders for all elements $pdf->SetLineWidth(0.1); + // Set custom footer + $pdf->setFooterCallback(array($this, 'customFooter')); + // Add title page $pdf->AddPage(); $pdf->SetFont('helvetica', 'B', 16); @@ -2576,4 +2582,37 @@ class DeclarationTVA_PDF return 'Compte ' . $account_code; } + /** + * Custom footer callback for PDF + * + * @param TCPDF $pdf PDF object + */ + public function customFooter($pdf) + { + global $conf; + + // Get company information + $company = new Societe($this->db); + $company->fetch($conf->entity); + + // Set font size 7 (same as summary information) + $pdf->SetFont('helvetica', '', 7); + + // Get current page number + $page_number = $pdf->getPage(); + + // Get page width for positioning + $page_width = $pdf->getPageWidth(); + $margin_left = $pdf->getMargins()['left']; + $margin_right = $pdf->getMargins()['right']; + + // Company name on the left + $pdf->SetXY($margin_left, $pdf->GetY()); + $pdf->Cell(0, 6, $company->name, 0, 0, 'L'); + + // Page number on the right + $pdf->SetXY($page_width - $margin_right - 20, $pdf->GetY()); + $pdf->Cell(20, 6, 'Page ' . $page_number, 0, 0, 'R'); + } + } diff --git a/core/modules/modDeclarationTVA.class.php b/core/modules/modDeclarationTVA.class.php index 284355d..7acf109 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.8'; + $this->version = '2.5.9'; // Url to the file with your last numberversion of this module //$this->url_last_version = 'http://www.example.com/versionmodule.txt';