v2.5.24: Fixed footer page count with proper implementation
- Now properly sets total pages after all pages are generated
- Footer now shows proper 'Page X/Y' format with accurate total pages
- Fixed issue where {nb} placeholder wasn't being processed by TCPDF
- Added setTotalPages method to custom PDF class
- Footer now displays correct total page count using custom implementation
- Updated module version to 2.5.24
This commit is contained in:
parent
7f7aa5a9fc
commit
5f88a478a2
@ -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.24
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
- **Fixed Footer Page Count Implementation**: Now properly sets total pages after all pages are generated
|
||||||
|
- **Correct Page Display**: Footer now shows proper "Page X/Y" format with accurate total pages
|
||||||
|
- **Professional PDF Layout**: Fixed issue where {nb} placeholder wasn't being processed
|
||||||
|
- **Accurate Page Information**: Footer now displays correct total page count using custom implementation
|
||||||
|
|
||||||
## 2.5.23
|
## 2.5.23
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|||||||
@ -39,12 +39,18 @@ require_once DOL_DOCUMENT_ROOT.'/custom/declarationtva/vendor/autoload.php';
|
|||||||
class DeclarationTVA_CustomPDF extends TCPDF
|
class DeclarationTVA_CustomPDF extends TCPDF
|
||||||
{
|
{
|
||||||
private $company_name = '';
|
private $company_name = '';
|
||||||
|
private $total_pages = 0;
|
||||||
|
|
||||||
public function setCompanyName($company_name)
|
public function setCompanyName($company_name)
|
||||||
{
|
{
|
||||||
$this->company_name = $company_name;
|
$this->company_name = $company_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTotalPages($total_pages)
|
||||||
|
{
|
||||||
|
$this->total_pages = $total_pages;
|
||||||
|
}
|
||||||
|
|
||||||
public function Footer()
|
public function Footer()
|
||||||
{
|
{
|
||||||
// Set font size 7 (same as summary information)
|
// Set font size 7 (same as summary information)
|
||||||
@ -62,9 +68,10 @@ class DeclarationTVA_CustomPDF extends TCPDF
|
|||||||
$this->SetXY($margin_left, $this->GetY());
|
$this->SetXY($margin_left, $this->GetY());
|
||||||
$this->Cell(0, 6, $this->company_name, 0, 0, 'L');
|
$this->Cell(0, 6, $this->company_name, 0, 0, 'L');
|
||||||
|
|
||||||
// Page number with total pages on the right using TCPDF's {nb} placeholder
|
// Page number with total pages on the right
|
||||||
|
$total_pages = $this->total_pages > 0 ? $this->total_pages : $this->getNumPages();
|
||||||
$this->SetXY($page_width - $margin_right - 30, $this->GetY());
|
$this->SetXY($page_width - $margin_right - 30, $this->GetY());
|
||||||
$this->Cell(30, 6, 'Page ' . $page_number . '/{nb}', 0, 0, 'R');
|
$this->Cell(30, 6, 'Page ' . $page_number . '/' . $total_pages, 0, 0, 'R');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -898,6 +905,9 @@ class DeclarationTVA_PDF
|
|||||||
// Add detailed breakdown pages
|
// Add detailed breakdown pages
|
||||||
$this->addDetailPages($pdf, $declaration, $ca3_data);
|
$this->addDetailPages($pdf, $declaration, $ca3_data);
|
||||||
|
|
||||||
|
// Set total pages for footer after all pages are generated
|
||||||
|
$pdf->setTotalPages($pdf->getNumPages());
|
||||||
|
|
||||||
// Output PDF
|
// Output PDF
|
||||||
$pdf->Output($output_path, 'F');
|
$pdf->Output($output_path, 'F');
|
||||||
|
|
||||||
@ -1548,6 +1558,9 @@ class DeclarationTVA_PDF
|
|||||||
// Add detailed breakdown pages starting on page 2
|
// Add detailed breakdown pages starting on page 2
|
||||||
$this->addDetailPages($pdf, $declaration, $ca3_data);
|
$this->addDetailPages($pdf, $declaration, $ca3_data);
|
||||||
|
|
||||||
|
// Set total pages for footer after all pages are generated
|
||||||
|
$pdf->setTotalPages($pdf->getNumPages());
|
||||||
|
|
||||||
// Output PDF
|
// Output PDF
|
||||||
$pdf->Output($output_path, 'F');
|
$pdf->Output($output_path, 'F');
|
||||||
|
|
||||||
|
|||||||
@ -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.23';
|
$this->version = '2.5.24';
|
||||||
// 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';
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user