up
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* Fecha: 3 de enero de 2026
|
||||
*/
|
||||
|
||||
require_once '../config/config.php';
|
||||
require_once __DIR__ . '/../config/config_enhanced.php';
|
||||
|
||||
// Suprimir errores para obtener JSON limpio
|
||||
error_reporting(E_ERROR | E_PARSE);
|
||||
@@ -67,22 +67,26 @@ try {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Determinar estado según configuración
|
||||
$initialStatus = defined('AUTO_APPROVE_TEMPLATES') && AUTO_APPROVE_TEMPLATES ? 'approved' : 'pending';
|
||||
|
||||
// Crear la plantilla
|
||||
$templateId = $db->insert('message_templates', [
|
||||
'name' => $name,
|
||||
'template_name' => $templateName,
|
||||
'language_code' => $languageCode,
|
||||
'category' => $category,
|
||||
'status' => 'pending', // Siempre inicia como pendiente
|
||||
'status' => $initialStatus,
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
]);
|
||||
|
||||
if ($templateId) {
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'message' => 'Plantilla creada correctamente. Estado: Pendiente de aprobación por WhatsApp.',
|
||||
'message' => 'Plantilla creada correctamente.',
|
||||
'id' => $templateId,
|
||||
'note' => 'La plantilla debe ser aprobada en WhatsApp Business Manager antes de poder usarse.'
|
||||
'status' => $initialStatus,
|
||||
'note' => $initialStatus === 'approved' ? 'Plantilla marcada como aprobada localmente.' : 'La plantilla debe ser aprobada en WhatsApp Business Manager antes de poder usarse.'
|
||||
]);
|
||||
} else {
|
||||
http_response_code(500);
|
||||
|
||||
Reference in New Issue
Block a user