From c8376a9ae697a77409365c760727de85f5da7ae4 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Mon, 6 Oct 2025 18:24:01 +0200 Subject: [PATCH] Remove debugging code from validation process - Removed all debug messages and console logs - Simplified validation success message to use translation - Cleaned up verbose debug output - Production-ready code without debugging clutter - Maintains error handling but removes debug verbosity --- declarationtva_view.php | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/declarationtva_view.php b/declarationtva_view.php index 7aeb923..c098a65 100644 --- a/declarationtva_view.php +++ b/declarationtva_view.php @@ -79,46 +79,26 @@ if ($action == 'export_pdf') { if ($action == 'validate' && $token) { // Validate the declaration - $debug_messages = array(); - $debug_messages[] = "Starting validation process..."; - if ($declarationtva->validateDeclaration($id)) { - $debug_messages[] = "✓ Declaration validated successfully"; - // Generate and save detailed PDF to Dolibarr documents - $debug_messages[] = "Loading PDF generator..."; require_once DOL_DOCUMENT_ROOT . '/custom/declarationtva/core/class/declarationtva_pdf.class.php'; $pdf_generator = new DeclarationTVA_PDF($db); - $debug_messages[] = "Generating detailed PDF..."; $pdf_path = $pdf_generator->generateDetailedCA3PDF($id); if ($pdf_path && file_exists($pdf_path)) { - $debug_messages[] = "✓ PDF generated successfully: " . $pdf_path; - // Save PDF to Dolibarr documents - $debug_messages[] = "Saving PDF to documents..."; $save_result = $declarationtva->saveValidatedPDF($id, $pdf_path); if (!$save_result) { - $debug_messages[] = "✗ PDF save failed: " . $declarationtva->error; setEventMessages("Warning: Declaration validated but PDF save failed: " . $declarationtva->error, null, 'warnings'); } else { - $debug_messages[] = "✓ PDF generated and saved successfully: " . $pdf_path; - setEventMessages("PDF generated and saved successfully: " . $pdf_path, null, 'mesgs'); + setEventMessages($langs->trans("DeclarationValidated"), null, 'mesgs'); } } else { - $debug_messages[] = "✗ PDF generation failed: " . $pdf_generator->error; - $debug_messages[] = "PDF path returned: " . ($pdf_path ? $pdf_path : 'NULL'); - $debug_messages[] = "File exists: " . ($pdf_path && file_exists($pdf_path) ? 'YES' : 'NO'); setEventMessages("Warning: Declaration validated but PDF generation failed: " . $pdf_generator->error, null, 'warnings'); } - // Show all debug messages in a single message - $full_debug = implode('
', $debug_messages); - setEventMessages("Validation Debug Info:
" . $full_debug, null, 'mesgs'); - } else { - $debug_messages[] = "✗ Declaration validation failed: " . $declarationtva->error; setEventMessages($langs->trans("ErrorValidatingDeclaration") . ": " . $declarationtva->error, null, 'errors'); } }