added schema details

This commit is contained in:
2025-07-05 20:31:44 +02:00
parent 3816bf5a20
commit 78089cadc1
16 changed files with 1117 additions and 108 deletions
@@ -19,10 +19,12 @@ try {
$idclient = intval($_POST['client_id'] ?? 0); // Usa client_id dal form
$clientname = trim($_POST['client_name'] ?? ''); // Usa client_name dal form
$client_specific_fields = trim($_POST['client_specific_fields'] ?? '{}'); // Recupera il JSON dei campi specifici
$idschema = intval($_POST['idschema'] ?? 0); // Nuovo campo
$schemamaname = trim($_POST['schemamaname'] ?? ''); // Nuovo campo
// Controllo sui campi obbligatori
if (empty($id) || empty($name) || empty($header_row) || empty($start_column) || empty($target_table)) {
throw new Exception("All fields marked with * are required.");
if (empty($id) || empty($name) || empty($header_row) || empty($start_column) || empty($target_table) || $idschema <= 0) {
throw new Exception("All fields marked with * are required, including schema.");
}
// Validazione del idclient
@@ -40,10 +42,10 @@ try {
$db = DBHandlerSelect::getInstance();
$pdo = $db->getConnection();
// Aggiorna il database, includendo idclient, clientname e client_specific_fields
// Aggiorna il database, includendo idschema e schemaname
$stmt = $pdo->prepare("UPDATE excel_templates
SET name = ?, header_row = ?, start_column = ?, description = ?, target_table = ?,
idclient = ?, clientname = ?, client_specific_fields = ?, updated_at = NOW()
idclient = ?, clientname = ?, client_specific_fields = ?, schemaname = ?, idschema = ?, updated_at = NOW()
WHERE id = ?");
$stmt->execute([
$name,
@@ -54,6 +56,8 @@ try {
$idclient,
$clientname,
$client_specific_fields,
$schemamaname,
$idschema,
$id
]);