added schema details
This commit is contained in:
@@ -31,9 +31,13 @@ try {
|
||||
throw new Exception("Invalid JSON format for client-specific fields.");
|
||||
}
|
||||
|
||||
// Recupera idschema e schemaname
|
||||
$idschema = intval($_POST['idschema'] ?? 0); // Nuovo campo
|
||||
$schemamaname = trim($_POST['schemamaname'] ?? ''); // Nuovo campo
|
||||
|
||||
// Controllo sui campi obbligatori
|
||||
if (empty($name) || empty($header_row) || empty($start_column) || empty($target_table)) {
|
||||
throw new Exception("All fields marked with * are required.");
|
||||
if (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
|
||||
@@ -45,10 +49,10 @@ try {
|
||||
$db = DBHandlerSelect::getInstance();
|
||||
$pdo = $db->getConnection();
|
||||
|
||||
// Inserisci nel database, usando idclient e clientname
|
||||
// Inserisci nel database, aggiungendo idschema e schemaname
|
||||
$stmt = $pdo->prepare("INSERT INTO excel_templates
|
||||
(name, header_row, start_column, description, target_table, button_size, button_bg_color, button_text_color, button_label, idclient, clientname, status, client_specific_fields, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())");
|
||||
(name, header_row, start_column, description, target_table, button_size, button_bg_color, button_text_color, button_label, idclient, clientname, status, client_specific_fields, schemaname, idschema, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW())");
|
||||
$stmt->execute([
|
||||
$name,
|
||||
$header_row,
|
||||
@@ -62,7 +66,9 @@ try {
|
||||
$idclient,
|
||||
$clientname,
|
||||
$status,
|
||||
$client_specific_fields
|
||||
$client_specific_fields,
|
||||
$schemamaname,
|
||||
$idschema
|
||||
]);
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
|
||||
Reference in New Issue
Block a user