added auto user accettatore id
This commit is contained in:
parent
35021e9d9b
commit
cf44e67922
File diff suppressed because one or more lines are too long
@ -310,3 +310,4 @@
|
||||
<hr><p>HTTP Error 404. The requested resource is not found.</p>
|
||||
</BODY></HTML>
|
||||
|
||||
2026-02-25 15:23:12 [AnagraficaCertestObject] Autenticazione fallita: HTTP 400, Errore cURL: , Risposta: {"title":"Bad Request","status":400,"detail":"Cannot persist the object. It was modified or deleted (purged) by another application.","instance":"POST /api/authentication/authenticate","errorCode":"96bfc1252b"}
|
||||
|
||||
@ -13,7 +13,7 @@ try {
|
||||
|
||||
// Parametri OData
|
||||
$params = [
|
||||
'$select' => 'IdCliente,Nominativo,CodiceNazioneFatturazione',
|
||||
'$select' => 'IdCliente,Nominativo,CodiceCliente',
|
||||
'$orderby' => 'Nominativo asc'
|
||||
];
|
||||
|
||||
|
||||
@ -55,7 +55,52 @@ $template = $template_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$default_idclient = $template['idclient'] ?? null;
|
||||
|
||||
$insertedIds = $_POST['inserted_ids'] ?? $_SESSION['inserted_ids'];
|
||||
// ------------------------------------------------------------
|
||||
// AUTO SET: schema field_id = 244 with auth_users.lims_user_id (if present)
|
||||
// ------------------------------------------------------------
|
||||
try {
|
||||
// 1) Read logged user lims_user_id
|
||||
$stmtUser = $pdo->prepare("SELECT lims_user_id FROM auth_users WHERE id = ? LIMIT 1");
|
||||
$stmtUser->execute([(int)$user_id]);
|
||||
$limsUserId = $stmtUser->fetchColumn();
|
||||
|
||||
// normalize
|
||||
$limsUserId = ($limsUserId !== false && $limsUserId !== null && $limsUserId !== '') ? (string)$limsUserId : '';
|
||||
|
||||
if ($limsUserId !== '' && !empty($insertedIds)) {
|
||||
|
||||
// 2) Find mapping_id for field_id = 244 in this template
|
||||
$stmtMap = $pdo->prepare("SELECT id FROM template_mapping WHERE template_id = ? AND field_id = 244 LIMIT 1");
|
||||
$stmtMap->execute([(int)$template_id]);
|
||||
$mappingId244 = (int)$stmtMap->fetchColumn();
|
||||
|
||||
if ($mappingId244 > 0) {
|
||||
|
||||
// 3) Upsert value into import_data_details for every inserted datadb row
|
||||
$pdo->beginTransaction();
|
||||
|
||||
$updStmt = $pdo->prepare("UPDATE import_data_details SET field_value = ? WHERE id = ? AND mapping_id = ?");
|
||||
$insStmt = $pdo->prepare("INSERT INTO import_data_details (id, mapping_id, field_value) VALUES (?, ?, ?)");
|
||||
|
||||
foreach ($insertedIds as $iddatadb) {
|
||||
$iddatadb = (int)$iddatadb;
|
||||
if ($iddatadb <= 0) continue;
|
||||
|
||||
$updStmt->execute([$limsUserId, $iddatadb, $mappingId244]);
|
||||
|
||||
if ($updStmt->rowCount() === 0) {
|
||||
$insStmt->execute([$iddatadb, $mappingId244, $limsUserId]);
|
||||
}
|
||||
}
|
||||
|
||||
$pdo->commit();
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Do not block import page if this fails; just log
|
||||
error_log("[AUTO FIELD 244] " . $e->getMessage());
|
||||
if ($pdo->inTransaction()) $pdo->rollBack();
|
||||
}
|
||||
// Recupera i dati appena inseriti con i nomi degli utenti
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT d.*, CONCAT(u.first_name, ' ', u.last_name) AS user_name
|
||||
@ -68,7 +113,8 @@ $importedData = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Recupera i dettagli manuali da import_data_details
|
||||
$stmt = $pdo->prepare("
|
||||
SELECT d.id AS detail_id, d.id AS datadb_id, d.mapping_id, d.field_value, m.field_label, m.data_type, m.is_required, m.manual_default
|
||||
SELECT d.id AS detail_id, d.id AS datadb_id, d.mapping_id, d.field_value,
|
||||
m.field_id, m.field_label, m.data_type, m.is_required, m.manual_default
|
||||
FROM import_data_details d
|
||||
JOIN template_mapping m ON d.mapping_id = m.id
|
||||
WHERE d.id IN (" . implode(',', array_fill(0, count($insertedIds), '?')) . ")
|
||||
@ -1935,8 +1981,13 @@ function fixedDefaultValue(array $f): string
|
||||
clientData.forEach(client => {
|
||||
const nome = client.Nominativo || "Nome non disponibile";
|
||||
const id = client.IdCliente || "ID non disponibile";
|
||||
const codice = (client.CodiceNazioneFatturazione || '').trim();
|
||||
const option = new Option(`${nome.trim()} - ${codice} (ID: ${id})`, id);
|
||||
|
||||
// CodiceCliente es: "Bl01858_E" -> vogliamo "E"
|
||||
const codiceCliente = (client.CodiceCliente || '').toString().trim();
|
||||
const suffix = (codiceCliente.split('_')[1] || '').trim(); // parte dopo "_"
|
||||
const shortCode = suffix || '--';
|
||||
|
||||
const option = new Option(`${nome.trim()} - ${shortCode} (ID: ${id})`, id);
|
||||
|
||||
if (parseInt(id) === parseInt(<?php echo json_encode($default_idclient ?? 0); ?>)) {
|
||||
option.selected = true;
|
||||
@ -1967,8 +2018,13 @@ function fixedDefaultValue(array $f): string
|
||||
clientData.forEach(client => {
|
||||
const nome = client.Nominativo || "Nome non disponibile";
|
||||
const id = client.IdCliente || "ID non disponibile";
|
||||
const codice = (client.CodiceNazioneFatturazione || '').trim();
|
||||
const option = new Option(`${nome.trim()} - ${codice} (ID: ${id})`, id);
|
||||
|
||||
// CodiceCliente es: "Bl01858_E" -> vogliamo "E"
|
||||
const codiceCliente = (client.CodiceCliente || '').toString().trim();
|
||||
const suffix = (codiceCliente.split('_')[1] || '').trim(); // parte dopo "_"
|
||||
const shortCode = suffix || '--';
|
||||
|
||||
const option = new Option(`${nome.trim()} - ${shortCode} (ID: ${id})`, id);
|
||||
|
||||
if (String(id) === String(currentValue)) {
|
||||
option.selected = true;
|
||||
|
||||
@ -121,6 +121,16 @@ error_log("Loaded template: " . print_r($template, true));
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.column-filters th {
|
||||
background: #ffffff;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.column-filters input {
|
||||
width: 100%;
|
||||
min-width: 80px;
|
||||
}
|
||||
</style>
|
||||
<title><?= htmlspecialchars($template['name']) ?> - <?= htmlspecialchars($titlewebsite, ENT_QUOTES, 'UTF-8'); ?></title>
|
||||
</head>
|
||||
@ -310,9 +320,7 @@ error_log("Loaded template: " . print_r($template, true));
|
||||
<input type="hidden" name="excelrows" value="${encodeURIComponent(JSON.stringify(data.excel_data.map(r => r.excelrow)))}">
|
||||
|
||||
<input type="hidden" name="filename" value="${data.filename}">
|
||||
<div class="search-container">
|
||||
<input type="text" id="searchInput" class="form-control" placeholder="Cerca nelle righe...">
|
||||
</div>
|
||||
|
||||
<div class="table-container">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
@ -320,6 +328,17 @@ error_log("Loaded template: " . print_r($template, true));
|
||||
<th><input type="checkbox" id="selectAll"> Seleziona</th>
|
||||
${data.columns.map(col => `<th>${col || 'Colonna senza nome'}<div class="resize-handle"></div></th>`).join('')}
|
||||
</tr>
|
||||
<tr class="column-filters">
|
||||
<th></th>
|
||||
${data.columns.map((col, i) => `
|
||||
<th>
|
||||
<input type="text"
|
||||
class="form-control form-control-sm column-filter"
|
||||
data-col-index="${i}"
|
||||
placeholder="Filter...">
|
||||
</th>
|
||||
`).join('')}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
${data.excel_data.map((row, index) => `
|
||||
@ -394,14 +413,39 @@ error_log("Loaded template: " . print_r($template, true));
|
||||
}
|
||||
});
|
||||
|
||||
const searchInput = document.getElementById('searchInput');
|
||||
const rows = document.querySelectorAll('.table tbody tr');
|
||||
const filterInputs = document.querySelectorAll('.column-filter');
|
||||
|
||||
searchInput.addEventListener('input', function() {
|
||||
const searchTerm = this.value.toLowerCase();
|
||||
// Stato filtri: key = colIndex, value = testo
|
||||
const activeFilters = {};
|
||||
|
||||
function applyColumnFilters() {
|
||||
rows.forEach(row => {
|
||||
const text = Array.from(row.cells).slice(1).map(cell => cell.textContent.toLowerCase()).join(' ');
|
||||
row.style.display = text.includes(searchTerm) ? '' : 'none';
|
||||
// Le celle di data partono da index 1 (perché index 0 è checkbox)
|
||||
let visible = true;
|
||||
|
||||
for (const [colIndexStr, filterValue] of Object.entries(activeFilters)) {
|
||||
const colIndex = parseInt(colIndexStr, 10); // 0..N-1 sulle colonne dati
|
||||
const cell = row.cells[colIndex + 1]; // +1 per saltare la colonna checkbox
|
||||
|
||||
const cellText = (cell?.textContent || '').toLowerCase();
|
||||
const searchText = (filterValue || '').toLowerCase().trim();
|
||||
|
||||
if (searchText && !cellText.includes(searchText)) {
|
||||
visible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
row.style.display = visible ? '' : 'none';
|
||||
});
|
||||
}
|
||||
|
||||
filterInputs.forEach(input => {
|
||||
input.addEventListener('input', function() {
|
||||
const colIndex = this.dataset.colIndex; // string
|
||||
activeFilters[colIndex] = this.value;
|
||||
applyColumnFilters();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ $schemajson = $template['schemajson'] ? json_decode($template['schemajson'], tru
|
||||
$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, is_visible_parts FROM template_mapping WHERE template_id = ?");
|
||||
$stmt = $pdo->prepare("SELECT id, field_id, excel_column, is_manual, manual_default, auto_value, 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, is_visible_parts FROM template_mapping WHERE template_id = ?");
|
||||
$stmt->execute([$id]);
|
||||
$mappings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
@ -216,9 +216,13 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
<td>
|
||||
<?php
|
||||
$isSceltaMultipla = ($mapping['data_type'] === 'SceltaMultipla');
|
||||
|
||||
$autoValue = $mapping['auto_value'] ?? 'none';
|
||||
$hasAuto = ($autoValue && $autoValue !== 'none');
|
||||
|
||||
$mappingValue = $isSceltaMultipla
|
||||
? 'manual'
|
||||
: ($mapping['excel_column'] ? 'xls' : ((int)$mapping['is_manual'] === 1 ? 'manual' : ''));
|
||||
: ($hasAuto ? 'auto' : ($mapping['excel_column'] ? 'xls' : ((int)$mapping['is_manual'] === 1 ? 'manual' : '')));
|
||||
?>
|
||||
|
||||
<select class="form-select mapping-select"
|
||||
@ -229,6 +233,7 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
<?php if (!$isSceltaMultipla): ?>
|
||||
<option value="">Select Option</option>
|
||||
<option value="xls" <?php echo ($mappingValue === 'xls') ? 'selected' : ''; ?>>Map to XLS Column</option>
|
||||
<option value="auto" <?php echo ($mappingValue === 'auto') ? 'selected' : ''; ?>>Auto value</option>
|
||||
<?php endif; ?>
|
||||
|
||||
<option value="manual" <?php echo ($mappingValue === 'manual') ? 'selected' : ''; ?>>Manual Entry</option>
|
||||
@ -240,6 +245,16 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
<?php echo $mapping['excel_column'] ? 'data-current-xls="' . htmlspecialchars($mapping['excel_column']) . '"' : ''; ?>>
|
||||
</select>
|
||||
|
||||
<select class="form-select auto-value-select"
|
||||
style="display:<?php echo ($mappingValue === 'auto') ? 'block' : 'none'; ?>; margin-top:6px;"
|
||||
data-id="<?php echo (int)$mapping['id']; ?>">
|
||||
<option value="none">Select auto value</option>
|
||||
<option value="import_date" <?php echo ($autoValue === 'import_date') ? 'selected' : ''; ?>>Current date (import)</option>
|
||||
<option value="import_time" <?php echo ($autoValue === 'import_time') ? 'selected' : ''; ?>>Current time (import)</option>
|
||||
<option value="export_date" <?php echo ($autoValue === 'export_date') ? 'selected' : ''; ?>>Current date (export)</option>
|
||||
<option value="export_time" <?php echo ($autoValue === 'export_time') ? 'selected' : ''; ?>>Current time (export)</option>
|
||||
</select>
|
||||
|
||||
<?php if (!empty($mapping['excel_column'])): ?>
|
||||
<span class="mapped-column" style="margin-left:5px;">
|
||||
(<?php echo htmlspecialchars($mapping['excel_column']); ?>)
|
||||
@ -266,7 +281,7 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
class="form-control manual-default"
|
||||
placeholder="Default value"
|
||||
value="<?php echo htmlspecialchars($mapping['manual_default'] ?? ''); ?>"
|
||||
style="display:<?php echo ((int)$mapping['is_manual'] === 1) ? 'block' : 'none'; ?>"
|
||||
style="display:<?php echo ($mappingValue === 'manual') ? 'block' : 'none'; ?>"
|
||||
data-field-id="<?php echo (int)$mapping['field_id']; ?>">
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
@ -802,27 +817,57 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
let mappingId = event.target.getAttribute('data-id');
|
||||
let xlsSelect = tr.querySelector('.xls-columns');
|
||||
let manualInput = tr.querySelector('.manual-default');
|
||||
let autoSelect = tr.querySelector('.auto-value-select');
|
||||
let mappedColumn = tr.querySelector('.mapped-column');
|
||||
let removeBtn = tr.querySelector('.remove-xls');
|
||||
if (event.target.value === 'xls') {
|
||||
xlsSelect.style.display = 'block';
|
||||
if (autoSelect) autoSelect.style.display = 'none';
|
||||
|
||||
manualInput.style.display = 'none';
|
||||
manualInput.value = '';
|
||||
|
||||
if (mappedColumn) mappedColumn.style.display = 'none';
|
||||
if (removeBtn) removeBtn.style.display = xlsSelect.value ? 'inline-block' : 'none';
|
||||
|
||||
} else if (event.target.value === 'manual') {
|
||||
xlsSelect.style.display = 'none';
|
||||
if (autoSelect) autoSelect.style.display = 'none';
|
||||
|
||||
manualInput.style.display = 'block';
|
||||
|
||||
if (mappedColumn) mappedColumn.style.display = 'none';
|
||||
if (removeBtn) removeBtn.style.display = 'none';
|
||||
} else {
|
||||
|
||||
} else if (event.target.value === 'auto') {
|
||||
xlsSelect.style.display = 'none';
|
||||
xlsSelect.value = ''; // libera UI
|
||||
|
||||
manualInput.style.display = 'none';
|
||||
manualInput.value = '';
|
||||
|
||||
if (mappedColumn) mappedColumn.style.display = 'none';
|
||||
if (removeBtn) removeBtn.style.display = 'none';
|
||||
|
||||
if (autoSelect) autoSelect.style.display = 'block';
|
||||
|
||||
} else {
|
||||
xlsSelect.style.display = 'none';
|
||||
if (autoSelect) autoSelect.style.display = 'none';
|
||||
|
||||
manualInput.style.display = 'none';
|
||||
manualInput.value = '';
|
||||
|
||||
if (mappedColumn) mappedColumn.style.display = 'none';
|
||||
if (removeBtn) removeBtn.style.display = 'none';
|
||||
}
|
||||
saveMapping(mappingId, event.target.value, manualInput.value, xlsSelect.value);
|
||||
saveMapping(
|
||||
mappingId,
|
||||
event.target.value,
|
||||
manualInput.value,
|
||||
xlsSelect.value,
|
||||
autoSelect ? autoSelect.value : null
|
||||
);
|
||||
updateXlsDropdowns();
|
||||
} else if (event.target.classList.contains('main-field-checkbox')) {
|
||||
const checkbox = event.target;
|
||||
@ -930,12 +975,30 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
document.querySelectorAll('.main-field-checkbox').forEach(cb => {
|
||||
cb.dataset.originalChecked = cb.checked;
|
||||
});
|
||||
// AUTO VALUE select change -> save auto_value
|
||||
document.getElementById('schemaFieldsBody').addEventListener('change', function(event) {
|
||||
if (!event.target.classList.contains('auto-value-select')) return;
|
||||
|
||||
const tr = event.target.closest('tr');
|
||||
const mappingId = event.target.getAttribute('data-id');
|
||||
|
||||
const xlsSelect = tr.querySelector('.xls-columns');
|
||||
const manualInput = tr.querySelector('.manual-default');
|
||||
|
||||
saveMapping(
|
||||
mappingId,
|
||||
'auto',
|
||||
manualInput ? manualInput.value : '',
|
||||
xlsSelect ? xlsSelect.value : null,
|
||||
event.target.value
|
||||
);
|
||||
});
|
||||
document.getElementById('schemaFieldsBody').addEventListener('change', function(event) {
|
||||
if (event.target.classList.contains('xls-columns')) {
|
||||
let tr = event.target.closest('tr');
|
||||
let mappingId = event.target.getAttribute('data-id');
|
||||
let manualInput = tr.querySelector('.manual-default');
|
||||
let autoSelect = tr.querySelector('.auto-value-select');
|
||||
let mappedColumn = tr.querySelector('.mapped-column');
|
||||
let removeBtn = tr.querySelector('.remove-xls');
|
||||
|
||||
@ -976,6 +1039,10 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
mappedColumn.style.display = event.target.value ? 'inline' : 'none';
|
||||
}
|
||||
if (removeBtn) removeBtn.style.display = event.target.value ? 'inline-block' : 'none';
|
||||
const mappingSelect = tr.querySelector('.mapping-select');
|
||||
if (mappingSelect && mappingSelect.value !== 'xls') {
|
||||
return; // non salvare XLS se non siamo in modalità XLS
|
||||
}
|
||||
saveMapping(mappingId, 'xls', manualInput.value, event.target.value);
|
||||
updateXlsDropdowns();
|
||||
}
|
||||
@ -1027,7 +1094,7 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
}
|
||||
});
|
||||
|
||||
function saveMapping(mappingId, mappingType, defaultValue, excelColumn) {
|
||||
function saveMapping(mappingId, mappingType, defaultValue, excelColumn, autoValue) {
|
||||
console.log("Saving mapping:", {
|
||||
id: mappingId,
|
||||
mapping_type: mappingType,
|
||||
@ -1044,6 +1111,7 @@ $xlsHeaders = $template['xls_headers'] ? json_decode($template['xls_headers'], t
|
||||
mapping_type: mappingType,
|
||||
excel_column: mappingType === 'xls' ? excelColumn : null,
|
||||
manual_default: mappingType === 'manual' ? defaultValue : null,
|
||||
auto_value: mappingType === 'auto' ? (autoValue || 'none') : 'none',
|
||||
tablename: "<?php echo $template['target_table']; ?>"
|
||||
})
|
||||
}).then(response => response.json())
|
||||
|
||||
@ -20,19 +20,82 @@ $mappingId = $data['id'];
|
||||
$mappingType = $data['mapping_type'] ?? '';
|
||||
$excelColumn = $data['excel_column'] ?? null;
|
||||
$manualDefault = $data['manual_default'] ?? null;
|
||||
|
||||
$autoValue = $data['auto_value'] ?? 'none';
|
||||
$tablename = $data['tablename'] ?? '';
|
||||
|
||||
try {
|
||||
$stmt = $pdo->prepare("UPDATE template_mapping SET is_manual = ?, excel_column = ?, manual_default = ? WHERE id = ?");
|
||||
$isManual = ($mappingType === 'manual') ? 1 : 0;
|
||||
$result = $stmt->execute([$isManual, $excelColumn, $manualDefault, $mappingId]);
|
||||
// Normalize mapping type
|
||||
$allowedTypes = ['', 'xls', 'manual', 'auto'];
|
||||
if (!in_array($mappingType, $allowedTypes, true)) {
|
||||
echo json_encode(["success" => false, "message" => "Invalid mapping_type"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Normalize auto_value
|
||||
$allowedAuto = ['none', 'import_date', 'import_datetime', 'export_date', 'export_datetime'];
|
||||
if (!in_array($autoValue, $allowedAuto, true)) {
|
||||
$autoValue = 'none';
|
||||
}
|
||||
|
||||
// Decide what to persist based on mapping_type
|
||||
$isManual = 0;
|
||||
$excelToSave = null;
|
||||
$manualToSave = null;
|
||||
$autoToSave = 'none';
|
||||
|
||||
if ($mappingType === 'xls') {
|
||||
$isManual = 0;
|
||||
$excelToSave = $excelColumn ?: null;
|
||||
$manualToSave = null;
|
||||
$autoToSave = 'none';
|
||||
} elseif ($mappingType === 'manual') {
|
||||
$isManual = 1;
|
||||
$excelToSave = null;
|
||||
$manualToSave = $manualDefault;
|
||||
$autoToSave = 'none';
|
||||
} elseif ($mappingType === 'auto') {
|
||||
$isManual = 0;
|
||||
$excelToSave = null;
|
||||
$manualToSave = null;
|
||||
$autoToSave = $autoValue ?: 'none';
|
||||
} else {
|
||||
// reset
|
||||
$isManual = 0;
|
||||
$excelToSave = null;
|
||||
$manualToSave = null;
|
||||
$autoToSave = 'none';
|
||||
}
|
||||
|
||||
$stmt = $pdo->prepare("
|
||||
UPDATE template_mapping
|
||||
SET
|
||||
is_manual = ?,
|
||||
excel_column = ?,
|
||||
manual_default = ?,
|
||||
auto_value = ?
|
||||
WHERE id = ?
|
||||
");
|
||||
|
||||
$result = $stmt->execute([$isManual, $excelToSave, $manualToSave, $autoToSave, $mappingId]);
|
||||
|
||||
if (!$result) {
|
||||
echo json_encode(["success" => false, "message" => "Database update failed"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
echo json_encode(["success" => true, "message" => "Mapping updated successfully", "data" => $data]); // Aggiunto debug
|
||||
echo json_encode([
|
||||
"success" => true,
|
||||
"message" => "Mapping updated successfully",
|
||||
"saved" => [
|
||||
"id" => (int)$mappingId,
|
||||
"mapping_type" => $mappingType,
|
||||
"is_manual" => $isManual,
|
||||
"excel_column" => $excelToSave,
|
||||
"manual_default" => $manualToSave,
|
||||
"auto_value" => $autoToSave
|
||||
]
|
||||
]);
|
||||
} catch (Exception $e) {
|
||||
echo json_encode(["success" => false, "message" => "Error: " . $e->getMessage()]);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user