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
This commit is contained in:
parent
d357b6d314
commit
c8376a9ae6
@ -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('<br>', $debug_messages);
|
||||
setEventMessages("Validation Debug Info:<br>" . $full_debug, null, 'mesgs');
|
||||
|
||||
} else {
|
||||
$debug_messages[] = "✗ Declaration validation failed: " . $declarationtva->error;
|
||||
setEventMessages($langs->trans("ErrorValidatingDeclaration") . ": " . $declarationtva->error, null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user