From 407d6884a1071330164dc8413fd7c5440b18a5c7 Mon Sep 17 00:00:00 2001 From: solocla Date: Thu, 19 Feb 2026 11:55:24 +0100 Subject: [PATCH] fixed note save and import special character --- public/userarea/error_log.txt | 3 + public/userarea/import_edit2.php | 98 +++++++++++++++---------------- public/userarea/import_insert.php | 7 ++- public/userarea/import_xls2.php | 7 ++- 4 files changed, 59 insertions(+), 56 deletions(-) diff --git a/public/userarea/error_log.txt b/public/userarea/error_log.txt index 9619b2d..2c825a6 100644 --- a/public/userarea/error_log.txt +++ b/public/userarea/error_log.txt @@ -27,3 +27,6 @@ 2026-01-30 10:50:43 [AnagraficaCertestService] 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"} 2026-01-30 10:50:43 [MoltiplicatorePrezzo] 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"} 2026-01-30 11:09:22 [MoltiplicatorePrezzo] 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"} +2026-02-19 10:00:13 [MoltiplicatorePrezzo] 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"} +2026-02-19 10:00:42 [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"} +2026-02-19 10:00:44 [MoltiplicatorePrezzo] 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"} diff --git a/public/userarea/import_edit2.php b/public/userarea/import_edit2.php index 78f7054..1a1fa38 100644 --- a/public/userarea/import_edit2.php +++ b/public/userarea/import_edit2.php @@ -666,13 +666,11 @@ function fixedDefaultValue(array $f): string
-
-
Modifica Dati Importati
- + +
@@ -1228,52 +1226,49 @@ function fixedDefaultValue(array $f): string document.addEventListener("DOMContentLoaded", function() { const inputs = document.querySelectorAll(".cell-input, .dropdown-select, .carrier-select, .awb-input, .date-picker"); const unsavedDiv = document.getElementById("unsavedChanges"); - const changedList = document.getElementById("changedFields"); + const changedRowsEl = document.getElementById("changedRows"); let hasChanges = false; - let changedFields = {}; - function renderChangedList() { - changedList.innerHTML = ""; - Object.keys(changedFields).forEach(rowIndex => { - const fields = changedFields[rowIndex]; - if (fields.length > 0) { - const li = document.createElement("li"); - li.textContent = `Row ${parseInt(rowIndex) + 1}: ${fields.join(", ")}`; - changedList.appendChild(li); - } - }); - unsavedDiv.style.display = Object.keys(changedFields).length > 0 ? "block" : "none"; + // ✅ solo righe modificate (Set) + let changedRows = new Set(); + + function renderChangedRows() { + const rows = Array.from(changedRows) + .map(n => Number(n)) + .sort((a, b) => a - b); + + if (rows.length === 0) { + unsavedDiv.style.display = "none"; + changedRowsEl.textContent = ""; + return; + } + + // Visuale: "Row 1, Row 5, Row 6" + changedRowsEl.textContent = rows.map(r => `Row ${r + 1}`).join(", "); + unsavedDiv.style.display = "block"; } + inputs.forEach(el => { el.addEventListener("change", () => { hasChanges = true; + const gridCell = el.closest(".grid-cell"); - const colIndex = gridCell?.dataset.index; const rowIndex = gridCell?.dataset.row; - let label = "Unknown field"; - - if (colIndex) { - const header = document.querySelector(`.grid-header[data-index="${colIndex}"]`); - if (header) { - label = header.textContent.replace(":", "").trim(); - } - } + // ✅ segnamo solo la riga if (rowIndex !== undefined) { - if (!changedFields[rowIndex]) { - changedFields[rowIndex] = []; - } - if (!changedFields[rowIndex].includes(label)) { - changedFields[rowIndex].push(label); - } - gridCell.classList.add("cell-changed"); + changedRows.add(rowIndex); } - renderChangedList(); + // (se vuoi mantenere highlight cella gialla, lascia questa riga) + if (gridCell) gridCell.classList.add("cell-changed"); + + renderChangedRows(); }); }); + document.querySelectorAll(".save-btn").forEach(btn => { btn.addEventListener("click", () => { const rowIndex = btn.dataset.row; @@ -1331,13 +1326,16 @@ function fixedDefaultValue(array $f): string }); setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500); - if (changedFields[rowIndex]) { - delete changedFields[rowIndex]; - document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`) - .forEach(cell => cell.classList.remove("cell-changed")); - renderChangedList(); - hasChanges = Object.keys(changedFields).length > 0; - } + // ✅ rimuovi riga dal set (non mostrare più Row X) + changedRows.delete(rowIndex); + + // se vuoi continuare a togliere highlight giallo di TUTTA la riga: + document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`) + .forEach(cell => cell.classList.remove("cell-changed")); + + renderChangedRows(); + hasChanges = changedRows.size > 0; + alert('Salvataggio riga avvenuto con successo!'); } else { @@ -1413,11 +1411,10 @@ function fixedDefaultValue(array $f): string }); setTimeout(() => cells.forEach(cell => cell.classList.remove('flash-success')), 500); - if (changedFields[rowIndex]) { - delete changedFields[rowIndex]; - document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`) - .forEach(cell => cell.classList.remove("cell-changed")); - } + changedRows.delete(rowIndex); + document.querySelectorAll(`.grid-cell[data-row="${rowIndex}"]`) + .forEach(cell => cell.classList.remove("cell-changed")); + } else { errorMessages.push(`Riga ${parseInt(rowIndex) + 1}: ${data.message}`); } @@ -1426,8 +1423,9 @@ function fixedDefaultValue(array $f): string } } - renderChangedList(); - hasChanges = Object.keys(changedFields).length > 0; + renderChangedRows(); + hasChanges = changedRows.size > 0; + if (errorMessages.length === 0) { alert(`Tutte le ${successCount} righe salvate con successo!`); diff --git a/public/userarea/import_insert.php b/public/userarea/import_insert.php index 7f7cc0b..9cafc10 100644 --- a/public/userarea/import_insert.php +++ b/public/userarea/import_insert.php @@ -20,9 +20,10 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST' || !isset($_POST['template_id']) || !i $template_id = intval($_POST['template_id']); $selected_rows = array_map('intval', $_POST['selected_rows']); -$columns = json_decode($_POST['columns'], true); -$rows = json_decode($_POST['rows'], true); -$excelrows = json_decode($_POST['excelrows'], true); +$columns = json_decode(urldecode($_POST['columns'] ?? '[]'), true); +$rows = json_decode(urldecode($_POST['rows'] ?? '[]'), true); +$excelrows = json_decode(urldecode($_POST['excelrows'] ?? '[]'), true); + $newFilename = htmlspecialchars($_POST['filename']); $_SESSION['template_id'] = $template_id; diff --git a/public/userarea/import_xls2.php b/public/userarea/import_xls2.php index e1e3b40..de1da41 100644 --- a/public/userarea/import_xls2.php +++ b/public/userarea/import_xls2.php @@ -305,9 +305,10 @@ error_log("Loaded template: " . print_r($template, true)); let html = `
- - - + + + +