Abgleich mit Live-Daten
This commit is contained in:
+44
-44
@@ -1,45 +1,45 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../inc/config.inc.php';
|
||||
require_once __DIR__ . '/../inc/functions.inc.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
try {
|
||||
$templetid = $_POST['templetid'] ?? '';
|
||||
$anfrageid = (int)($_POST['anfrageid'] ?? 0);
|
||||
|
||||
if ($templetid === '' || $anfrageid <= 0) {
|
||||
throw new RuntimeException('Fehlende Parameter');
|
||||
}
|
||||
|
||||
// URL aus config-Tabelle holen (sicher, unabhängig von globalen Variablen)
|
||||
$stmt = $pdo->query("SELECT anfragebestaetigung FROM config LIMIT 1");
|
||||
$anfragebestaetigung = (string)$stmt->fetchColumn();
|
||||
|
||||
if ($anfragebestaetigung === '') {
|
||||
throw new RuntimeException('Config anfragebestaetigung ist leer');
|
||||
}
|
||||
|
||||
$result = renderTemplateForAnfrage(
|
||||
$pdo,
|
||||
$anfrageid,
|
||||
$templetid,
|
||||
$anfragebestaetigung, // aus config
|
||||
[
|
||||
// optional:
|
||||
// '%TERMINZEITVORGABE%' => $Zeitanzeige,
|
||||
],
|
||||
false // CP1252 nur wenn nötig
|
||||
);
|
||||
|
||||
echo json_encode([
|
||||
'betreff' => $result['betreff'],
|
||||
'body' => $result['body']
|
||||
]);
|
||||
|
||||
} catch (Throwable $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
<?php
|
||||
require_once __DIR__ . '/../inc/config.inc.php';
|
||||
require_once __DIR__ . '/../inc/functions.inc.php';
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
try {
|
||||
$templetid = $_POST['templetid'] ?? '';
|
||||
$anfrageid = (int)($_POST['anfrageid'] ?? 0);
|
||||
|
||||
if ($templetid === '' || $anfrageid <= 0) {
|
||||
throw new RuntimeException('Fehlende Parameter');
|
||||
}
|
||||
|
||||
// URL aus config-Tabelle holen (sicher, unabhängig von globalen Variablen)
|
||||
$stmt = $pdo->query("SELECT anfragebestaetigung FROM config LIMIT 1");
|
||||
$anfragebestaetigung = (string)$stmt->fetchColumn();
|
||||
|
||||
if ($anfragebestaetigung === '') {
|
||||
throw new RuntimeException('Config anfragebestaetigung ist leer');
|
||||
}
|
||||
|
||||
$result = renderTemplateForAnfrage(
|
||||
$pdo,
|
||||
$anfrageid,
|
||||
$templetid,
|
||||
$anfragebestaetigung, // aus config
|
||||
[
|
||||
// optional:
|
||||
// '%TERMINZEITVORGABE%' => $Zeitanzeige,
|
||||
],
|
||||
false // CP1252 nur wenn nötig
|
||||
);
|
||||
|
||||
echo json_encode([
|
||||
'betreff' => $result['betreff'],
|
||||
'body' => $result['body']
|
||||
]);
|
||||
|
||||
} catch (Throwable $e) {
|
||||
http_response_code(500);
|
||||
echo json_encode([
|
||||
'error' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user