Temporarily disable ECM integration to prevent fatal errors

- Added ECM integration toggle for easy enable/disable
- Temporarily disabled ECM integration to prevent fatal errors
- Added debugging logs to track ECM files path resolution
- PDF saving to disk still works without ECM integration
- Declaration validation will work without document management
- Can be re-enabled once ECM files path is properly resolved
This commit is contained in:
Frank Cools 2025-10-06 17:23:45 +02:00
parent 4074c4fabd
commit faf7b3a00a

View File

@ -1129,25 +1129,31 @@ class DeclarationTVA
} }
// Try to add document record to Dolibarr (optional feature) // Try to add document record to Dolibarr (optional feature)
// Try multiple possible paths for ecmfiles.class.php // Skip ECM integration if there are any issues to prevent fatal errors
$ecmfiles_paths = array( $ecm_integration_enabled = false; // Temporarily disabled to prevent fatal errors
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'
);
$ecmfiles_path = null; if ($ecm_integration_enabled) {
foreach ($ecmfiles_paths as $path) { // Try multiple possible paths for ecmfiles.class.php
if (file_exists($path)) { $ecmfiles_paths = array(
$ecmfiles_path = $path; DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php',
break; 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'
);
$ecmfiles_path = null;
foreach ($ecmfiles_paths as $path) {
if (file_exists($path)) {
$ecmfiles_path = $path;
break;
}
} }
}
if ($ecmfiles_path && file_exists($ecmfiles_path)) {
if ($ecmfiles_path && file_exists($ecmfiles_path)) {
try { try {
// Log the path being used for debugging
error_log("DeclarationTVA: Using ECM files path: " . $ecmfiles_path);
require_once $ecmfiles_path; require_once $ecmfiles_path;
$ecmfile = new EcmFiles($this->db); $ecmfile = new EcmFiles($this->db);