template mapping addes is visible as checkbox and is required as badge

This commit is contained in:
2025-09-12 10:01:19 +02:00
parent 3aa2504f3c
commit 296143016a
2 changed files with 77 additions and 23 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
require_once 'include/headscript.php';
header('Content-Type: application/json');
$data = json_decode(file_get_contents('php://input'), true);
$template_id = $data['template_id'] ?? null;
$mapping_id = $data['mapping_id'] ?? null;
$value = $data['value'] ?? null;
if (!$template_id || !$mapping_id || !isset($value)) {
echo json_encode(['success' => false, 'message' => 'Invalid input']);
exit;
}
$db = DBHandlerSelect::getInstance();
$pdo = $db->getConnection();
$stmt = $pdo->prepare("UPDATE template_mapping SET is_visible_import = ? WHERE id = ? AND template_id = ?");
$result = $stmt->execute([$value, $mapping_id, $template_id]);
if ($result) {
echo json_encode(['success' => true]);
} else {
echo json_encode(['success' => false, 'message' => 'Failed to update is_visible_import']);
}