Fix URL construction to add /documents back for download links

- Added /documents back to the URL construction in declaration list
- File is saved in /var/lib/dolibarr/declarationtva/validated/ (no /documents)
- URL should be /dolibarr/documents/declarationtva/validated/ (with /documents)
- This ensures the download links work correctly
- File path and URL path are now properly separated
This commit is contained in:
Frank Cools 2025-10-06 18:02:39 +02:00
parent 15d4fb34b6
commit 00ecb72791

View File

@ -155,8 +155,8 @@ if (empty($declarations)) {
if ($pdf_path) {
// Create a download link
$relative_path = str_replace(DOL_DATA_ROOT, '', $pdf_path);
// The file is saved with /documents/documents/ so we need to keep that in the URL
$download_url = DOL_URL_ROOT . $relative_path;
// Add /documents to the URL path
$download_url = DOL_URL_ROOT . '/documents' . $relative_path;
print '<a href="' . $download_url . '" target="_blank" title="' . $langs->trans("DownloadPDF") . '" style="color: #28a745; text-decoration: none; font-weight: bold;">';
print '<i class="fa fa-file-pdf" style="font-size: 16px; color: #dc3545;"></i> PDF';
print '</a>';