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
This commit is contained in:
Frank Cools 2025-10-08 12:41:16 +02:00
parent 74875476f2
commit 348a2ecb1e
3 changed files with 48 additions and 1 deletions

View File

@ -1,5 +1,13 @@
# CHANGELOG MODULE DECLARATIONTVA FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) # 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 ## 2.5.8
### UI/UX Improvements ### UI/UX Improvements

View File

@ -825,6 +825,9 @@ class DeclarationTVA_PDF
// Set thin borders for all elements // Set thin borders for all elements
$pdf->SetLineWidth(0.1); $pdf->SetLineWidth(0.1);
// Set custom footer
$pdf->setFooterCallback(array($this, 'customFooter'));
// Add a page // Add a page
$pdf->AddPage(); $pdf->AddPage();
@ -1409,6 +1412,9 @@ class DeclarationTVA_PDF
// Set thin borders for all elements // Set thin borders for all elements
$pdf->SetLineWidth(0.1); $pdf->SetLineWidth(0.1);
// Set custom footer
$pdf->setFooterCallback(array($this, 'customFooter'));
// Add title page // Add title page
$pdf->AddPage(); $pdf->AddPage();
$pdf->SetFont('helvetica', 'B', 16); $pdf->SetFont('helvetica', 'B', 16);
@ -2576,4 +2582,37 @@ class DeclarationTVA_PDF
return 'Compte ' . $account_code; 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');
}
} }

View File

@ -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' $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' // 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 // Url to the file with your last numberversion of this module
//$this->url_last_version = 'http://www.example.com/versionmodule.txt'; //$this->url_last_version = 'http://www.example.com/versionmodule.txt';