template mapping addes is visible as checkbox and is required as badge
This commit is contained in:
@@ -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']);
|
||||
}
|
||||
Reference in New Issue
Block a user