Fix PDF file paths to remove duplicate /documents

- Changed PDF generation path from /documents/declarationtva/validated/ to /declarationtva/validated/
- Updated hasValidatedDocument() to look in /declarationtva/validated/
- Updated getValidatedPDFPath() to look in /declarationtva/validated/
- This removes the duplicate /documents in the file path
- Files will now be saved in /var/lib/dolibarr/declarationtva/validated/
- URLs will be /dolibarr/documents/declarationtva/validated/ (single /documents)
This commit is contained in:
Frank Cools 2025-10-06 18:01:37 +02:00
parent ef40e60d6e
commit 15d4fb34b6
2 changed files with 3 additions and 3 deletions

View File

@ -1262,7 +1262,7 @@ class DeclarationTVA
}
// Check if PDF file exists in the VAT declarations directory
$vat_declarations_dir = DOL_DATA_ROOT . '/documents/declarationtva/validated/';
$vat_declarations_dir = DOL_DATA_ROOT . '/declarationtva/validated/';
// Look for PDF files with the declaration number
$pattern = $vat_declarations_dir . 'CA3_' . $obj->declaration_number . '_*.pdf';
@ -1302,7 +1302,7 @@ class DeclarationTVA
}
// Check if PDF file exists in the VAT declarations directory
$vat_declarations_dir = DOL_DATA_ROOT . '/documents/declarationtva/validated/';
$vat_declarations_dir = DOL_DATA_ROOT . '/declarationtva/validated/';
// Look for PDF files with the declaration number
$pattern = $vat_declarations_dir . 'CA3_' . $obj->declaration_number . '_*.pdf';

View File

@ -184,7 +184,7 @@ class DeclarationTVA_PDF
$filename = 'CA3_' . $declaration->declaration_number . '_' . date('Y-m-d') . '.pdf';
// Create VAT declarations documents directory structure
$vat_declarations_dir = DOL_DATA_ROOT . '/documents/declarationtva/validated/';
$vat_declarations_dir = DOL_DATA_ROOT . '/declarationtva/validated/';
// Create directory if it doesn't exist
if (!is_dir($vat_declarations_dir)) {