Fix ECM files class path resolution
- Updated paths to include correct ECM files location - Added multiple fallback paths for ecmfiles.class.php - Prioritized /ecm/class/ path over /core/class/ path - Enhanced error logging to show all attempted paths - Should resolve the 'Failed opening required' error - ECM files integration should now work properly
This commit is contained in:
parent
7b5aedee81
commit
8cb8f9e588
@ -1111,9 +1111,24 @@ class DeclarationTVA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try to add document record to Dolibarr (optional feature)
|
// Try to add document record to Dolibarr (optional feature)
|
||||||
$ecmfiles_path = DOL_DOCUMENT_ROOT . '/core/class/ecmfiles.class.php';
|
// Try multiple possible paths for ecmfiles.class.php
|
||||||
|
$ecmfiles_paths = array(
|
||||||
|
DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php',
|
||||||
|
dirname(__FILE__) . '/../../../ecm/class/ecmfiles.class.php',
|
||||||
|
dirname(__FILE__) . '/../../../../ecm/class/ecmfiles.class.php',
|
||||||
|
DOL_DOCUMENT_ROOT . '/core/class/ecmfiles.class.php',
|
||||||
|
dirname(__FILE__) . '/../../../../core/class/ecmfiles.class.php'
|
||||||
|
);
|
||||||
|
|
||||||
if (file_exists($ecmfiles_path)) {
|
$ecmfiles_path = null;
|
||||||
|
foreach ($ecmfiles_paths as $path) {
|
||||||
|
if (file_exists($path)) {
|
||||||
|
$ecmfiles_path = $path;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($ecmfiles_path && file_exists($ecmfiles_path)) {
|
||||||
try {
|
try {
|
||||||
require_once $ecmfiles_path;
|
require_once $ecmfiles_path;
|
||||||
$ecmfile = new EcmFiles($this->db);
|
$ecmfile = new EcmFiles($this->db);
|
||||||
@ -1149,7 +1164,7 @@ class DeclarationTVA
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Log that ECM files class is not available
|
// Log that ECM files class is not available
|
||||||
error_log("DeclarationTVA: ECM files class not found at: " . $ecmfiles_path);
|
error_log("DeclarationTVA: ECM files class not found. Tried paths: " . implode(', ', $ecmfiles_paths));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true even if ECM file creation failed - the PDF is still saved to disk
|
// Return true even if ECM file creation failed - the PDF is still saved to disk
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user