v2.5.29: Fixed export functionality and validation PDF layout

- Restored export functionality to use fillable PDF template when available
- Fixed validation PDF to use improved layout with all enhancements
- Separated export and validation: export uses fillable template, validation uses improved layout
- Validation PDF now includes OD and bank journal tables on first page
- Validation PDF now has all improvements (footer, filtered accounts, etc.)
- Updated module version to 2.5.29
This commit is contained in:
Frank Cools 2025-10-08 13:53:15 +02:00
parent 56bfa53669
commit a24bf86ecb
3 changed files with 21 additions and 26 deletions

View File

@ -1,5 +1,14 @@
# CHANGELOG MODULE DECLARATIONTVA FOR [DOLIBARR ERP CRM](https://www.dolibarr.org) # CHANGELOG MODULE DECLARATIONTVA FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
## 2.5.29
### Bug Fixes
- **Restored Export Functionality**: Export now correctly uses fillable PDF template when available
- **Fixed Validation PDF Layout**: Validation now uses improved PDF generation with all enhancements
- **Separated Export and Validation**: Export uses fillable template, validation uses improved layout
- **Consistent Validation**: Validation PDF now includes OD and bank journal tables on first page
- **Complete PDF Features**: Validation PDF now has all improvements (footer, filtered accounts, etc.)
## 2.5.28 ## 2.5.28
### Bug Fixes ### Bug Fixes

View File

@ -254,31 +254,13 @@ class DeclarationTVA_PDF
$filepath = $vat_declarations_dir . $filename; $filepath = $vat_declarations_dir . $filename;
// Generate complete PDF with CA-3 form and detailed breakdown pages // For validation, always use the improved PDF generation with all enhancements
$result = $this->generateCA3PDF($declaration_id); // This ensures validation PDF has the same layout as export
$result = $this->generateBasicPDF($filepath, $declaration, $ca3_data, $mysoc);
if ($result && file_exists($result)) {
// Copy the generated PDF to our target location
if (copy($result, $filepath)) {
// Clean up the temporary file
unlink($result);
$result = true;
} else {
$this->error = "Failed to copy PDF to target location";
$result = false;
}
}
if ($result) { if ($result) {
// Verify file was actually created return $filepath;
if (file_exists($filepath)) {
return $filepath;
} else {
$this->error = "PDF file was not created at expected path: " . $filepath;
return false;
}
} else { } else {
$this->error = "PDF generation failed: " . $this->error;
return false; return false;
} }
} }
@ -318,9 +300,13 @@ class DeclarationTVA_PDF
private function fillPDFTemplate($template_path, $output_path, $declaration, $ca3_data, $mysoc) private function fillPDFTemplate($template_path, $output_path, $declaration, $ca3_data, $mysoc)
{ {
try { try {
// Always use the improved PDF generation for consistency // Check if we have a custom fillable PDF template
// This ensures validation uses the same layout as export if (file_exists($template_path) && $this->isFillablePDF($template_path)) {
return $this->generateBasicPDF($output_path, $declaration, $ca3_data, $mysoc); return $this->fillFillablePDF($template_path, $output_path, $declaration, $ca3_data, $mysoc);
} else {
// Fall back to basic PDF generation
return $this->generateBasicPDF($output_path, $declaration, $ca3_data, $mysoc);
}
} catch (Exception $e) { } catch (Exception $e) {
$this->error = 'PDF generation failed: ' . $e->getMessage(); $this->error = 'PDF generation failed: ' . $e->getMessage();
return false; return false;

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.28'; $this->version = '2.5.29';
// 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';