Add debugging to declaration list document detection

- Added error_log statements to track document detection in declaration list
- Logs declaration ID, status, has document result, PDF path, and download URL
- Will help identify why PDF icons are not showing despite successful detection
- Debug info will show what's happening in the list display logic
This commit is contained in:
Frank Cools 2025-10-06 17:39:43 +02:00
parent 29f9462f47
commit 6fe9141002

View File

@ -148,12 +148,17 @@ if (empty($declarations)) {
if ($d['status'] == 'validated') { if ($d['status'] == 'validated') {
// Check if document exists // Check if document exists
$has_document = $declarationtva->hasValidatedDocument($d['rowid']); $has_document = $declarationtva->hasValidatedDocument($d['rowid']);
error_log("DeclarationTVA List Debug - Declaration ID: " . $d['rowid'] . ", Status: " . $d['status'] . ", Has Document: " . ($has_document ? 'TRUE' : 'FALSE'));
if ($has_document) { if ($has_document) {
$pdf_path = $declarationtva->getValidatedPDFPath($d['rowid']); $pdf_path = $declarationtva->getValidatedPDFPath($d['rowid']);
error_log("DeclarationTVA List Debug - PDF Path: " . ($pdf_path ? $pdf_path : 'NULL'));
if ($pdf_path) { if ($pdf_path) {
// Create a download link // Create a download link
$relative_path = str_replace(DOL_DATA_ROOT, '', $pdf_path); $relative_path = str_replace(DOL_DATA_ROOT, '', $pdf_path);
$download_url = DOL_URL_ROOT . '/documents' . $relative_path; $download_url = DOL_URL_ROOT . '/documents' . $relative_path;
error_log("DeclarationTVA List Debug - Download URL: " . $download_url);
print '<a href="' . $download_url . '" target="_blank" title="' . $langs->trans("DownloadPDF") . '">'; print '<a href="' . $download_url . '" target="_blank" title="' . $langs->trans("DownloadPDF") . '">';
print '<i class="fa fa-file-pdf-o text-success"></i>'; print '<i class="fa fa-file-pdf-o text-success"></i>';
print '</a>'; print '</a>';