fix(wa): usar language_code real de la plantilla (es, no es_CO)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
61c8c0b9ca
commit
7a56ec25a0
+3
-2
@@ -175,8 +175,9 @@ if (isset($_GET['test_cel'])) {
|
||||
echo "5. TEST DE ENVÍO\n";
|
||||
echo "─────────────────\n";
|
||||
$testCel = trim($_GET['test_cel']);
|
||||
$testTpl = $cfg['turnero_wa_template'] ?? 'consentimiento_turno';
|
||||
$testLang = $cfg['turnero_wa_lang'] ?? 'es_CO';
|
||||
$testTpl = $cfg['turnero_wa_template'] ?? 'consentimiento_turno';
|
||||
// Usar el idioma real de la plantilla aprobada en Meta
|
||||
$testLang = $tplRow['language_code'] ?? ($cfg['turnero_wa_lang'] ?? 'es');
|
||||
|
||||
require_once __DIR__ . '/services/WhatsAppService.php';
|
||||
$baseUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
|
||||
|
||||
@@ -153,11 +153,14 @@ try {
|
||||
$waTemplate = $esSoloMuestra
|
||||
? ($cfgWA['turnero_wa_template_muestra'] ?? 'turno_muestra_pendiente')
|
||||
: ($cfgWA['turnero_wa_template'] ?? 'consentimiento_turno');
|
||||
$waLang = $cfgWA['turnero_wa_lang'] ?? 'es_CO';
|
||||
// Usar idioma real de la plantilla aprobada (puede diferir del config)
|
||||
$stmtLang = $pdo->prepare("SELECT language_code FROM message_templates WHERE template_name = ? LIMIT 1");
|
||||
$stmtLang->execute([$waTemplate]);
|
||||
$waLang = $stmtLang->fetchColumn() ?: ($cfgWA['turnero_wa_lang'] ?? 'es');
|
||||
} catch (\Throwable $e) {
|
||||
$waKioskoEnabled = true;
|
||||
$waTemplate = 'consentimiento_turno';
|
||||
$waLang = 'es_CO';
|
||||
$waLang = 'es';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user