Remove separate detailed PDF export button

- Removed 'Export Detailed PDF' button from view page
- Removed export_pdf_detailed action handler
- Detailed export is now integrated into main 'Export PDF' button
- Simplifies UI by having single PDF export option
- Main export now includes both CA-3 form and detailed breakdown pages
This commit is contained in:
Frank Cools 2025-10-06 18:11:31 +02:00
parent 64f5278e2b
commit 6e9f620925

View File

@ -76,27 +76,6 @@ if ($action == 'export_pdf') {
}
}
if ($action == 'export_pdf_detailed') {
// Load PDF generator
require_once DOL_DOCUMENT_ROOT . '/custom/declarationtva/core/class/declarationtva_pdf.class.php';
$pdf_generator = new DeclarationTVA_PDF($db);
// Generate detailed PDF with breakdown pages
$pdf_path = $pdf_generator->generateDetailedCA3PDF($id);
if ($pdf_path && file_exists($pdf_path)) {
// Set headers for PDF download
header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="CA3_Detailed_' . $declarationtva->declaration_number . '.pdf"');
header('Content-Length: ' . filesize($pdf_path));
// Output PDF file
readfile($pdf_path);
exit;
} else {
setEventMessages($pdf_generator->error ?: $langs->trans("ErrorGeneratingDetailedPDF"), null, 'errors');
}
}
if ($action == 'validate' && $token) {
// Validate the declaration
@ -469,9 +448,8 @@ if ($declarationtva->status == 'draft') {
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '&action=recalculate&token=' . newToken() . '" class="butAction">' . $langs->trans("Recalculate") . '</a> ';
}
// PDF Export buttons (always available)
// PDF Export button (always available)
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '&action=export_pdf" class="butAction">' . $langs->trans("ExportPDF") . '</a> ';
print '<a href="' . $_SERVER['PHP_SELF'] . '?id=' . $id . '&action=export_pdf_detailed" class="butAction">' . $langs->trans("ExportPDFDetailed") . '</a> ';
if ($declarationtva->status == 'draft') {
// Validation button with confirmation dialog