Configure Template:
Client: | Schema: | Header Row: | Start Column:
Schema Fields Configuration
| Main | Visible on Import | Title | Type | Mapping | Default Value |
|---|---|---|---|---|---|
| > | > | Required |
getConnection(); $stmt = $pdo->prepare("SELECT name, header_row, start_column, target_table, sample_xlsx, idclient, clientname, idschema, schemaname, schemajson, xls_headers FROM excel_templates WHERE id = ?"); $stmt->execute([$id]); $template = $stmt->fetch(PDO::FETCH_ASSOC); if (!$template) { die("Template not found"); } $clientName = $template['clientname'] ?: ''; $schemaName = $template['schemaname'] ?: ''; $schemajson = $template['schemajson'] ? json_decode($template['schemajson'], true) : []; $isSchemajsonEmpty = empty(trim($template['schemajson'])); // Recupera i campi dalla tabella template_mapping $stmt = $pdo->prepare("SELECT id, field_id, excel_column, is_manual, manual_default, data_type, is_required, default_value, has_list, length, decimals, min_value, max_value, default_curr_date, tablename, field_label, main_field, is_visible_import FROM template_mapping WHERE template_id = ?"); $stmt->execute([$id]); $mappings = $stmt->fetchAll(PDO::FETCH_ASSOC); // Recupera le colonne già associate nel database $usedColumnsFromDB = array_filter(array_column($mappings, 'excel_column')); // Decodifica l'header XLS salvato, se presente $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], true) : []; ?>