Revert PDF URL path fix - keep original /documents/documents/ structure

- Removed the str_replace that was removing /documents/documents/
- The file is actually saved with /documents/documents/ in the path
- URL should match the actual file location
- Should generate URLs like /dolibarr/documents/documents/declarationtva/
This commit is contained in:
Frank Cools 2025-10-06 17:50:20 +02:00
parent 4f3ad7fb8a
commit 519f5e3be2

View File

@ -155,8 +155,7 @@ if (empty($declarations)) {
if ($pdf_path) {
// Create a download link
$relative_path = str_replace(DOL_DATA_ROOT, '', $pdf_path);
// Remove the extra /documents from the path
$relative_path = str_replace('/documents/documents/', '/documents/', $relative_path);
// The file is saved with /documents/documents/ so we need to keep that in the URL
$download_url = DOL_URL_ROOT . $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';