Fix PDF download URL by removing extra /documents path
- Added str_replace to remove /documents/documents/ from path - Changes /documents/documents/declarationtva/ to /documents/declarationtva/ - Should now generate correct URLs that match actual file locations - File is at /var/lib/dolibarr/documents/documents/declarationtva/ - URL should be /dolibarr/documents/declarationtva/
This commit is contained in:
parent
ea891e5c31
commit
4f3ad7fb8a
@ -155,6 +155,8 @@ if (empty($declarations)) {
|
|||||||
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);
|
||||||
|
// Remove the extra /documents from the path
|
||||||
|
$relative_path = str_replace('/documents/documents/', '/documents/', $relative_path);
|
||||||
$download_url = DOL_URL_ROOT . $relative_path;
|
$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 '<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 '<i class="fa fa-file-pdf" style="font-size: 16px; color: #dc3545;"></i> PDF';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user