24 lines
734 B
PHP
24 lines
734 B
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
ini_set('display_errors', 1);
|
|
ini_set('display_startup_errors', 1);
|
|
error_reporting(E_ALL);
|
|
|
|
require_once(__DIR__ . '/class/db-functions.php');
|
|
|
|
$db = DBHandlerSelect::getInstance();
|
|
$pdo = $db->getConnection();
|
|
|
|
$template_id = $_GET['template_id'] ?? 0;
|
|
|
|
try {
|
|
$stmt = $pdo->prepare("SELECT id, field_id, excel_column, is_manual, manual_default, field_label FROM template_mapping WHERE template_id = ?");
|
|
$stmt->execute([$template_id]);
|
|
$mappings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
echo json_encode(["success" => true, "mappings" => $mappings]);
|
|
} catch (Exception $e) {
|
|
echo json_encode(["success" => false, "message" => "Error: " . $e->getMessage()]);
|
|
}
|
|
exit;
|