/var/www/vhosts/m-auto.co/httpdocs
Edit: /var/www/vhosts/m-auto.co/httpdocs/contact_process.php (2370B)
prepare("INSERT INTO messages (sender, message, is_user) VALUES (?, ?, 1)");
$sender_info = "الاسم: $name, البريد: $email, الموضوع: $subject";
$stmt->bind_param("ss", $sender_info, $message);
if ($stmt->execute()) {
// Send data to Odoo CRM
try {
$odoo = new OdooAPI();
// Prepare lead data for Odoo
$leadData = [
'name' => 'استفسار - ' . $subject,
'contact_name' => $name,
'email' => $email,
'description' => "الموضوع: {$subject}\n\nالرسالة:\n{$message}",
'source' => OdooConfig::LEAD_SOURCE_WEBSITE_CONTACT
];
// Create lead in Odoo
$leadId = $odoo->createLead($leadData);
if ($leadId) {
// Create follow-up activity
$odoo->createActivity(
$leadId,
1, // Default activity type (adjust as needed)
'الرد على استفسار العميل',
"العميل {$name} أرسل استفساراً بعنوان: {$subject}"
);
}
} catch (Exception $e) {
// Log error but don't fail the contact form submission
error_log('Odoo integration error for contact form: ' . $e->getMessage());
}
header("Location: contact.php?status=success");
} else {
header("Location: contact.php?status=error");
}
$stmt->close();
$conn->close();
} else {
header("Location: contact.php");
exit();
}
?>