From 84261a4950dd1a7ac4107ced3bcfe94058d8f6a9 Mon Sep 17 00:00:00 2001 From: Cedric Date: Tue, 30 Jun 2026 14:44:08 +0200 Subject: [PATCH] Actualiser js/admin.js --- js/admin.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/js/admin.js b/js/admin.js index 32b51a8..1dc6d7d 100644 --- a/js/admin.js +++ b/js/admin.js @@ -412,12 +412,11 @@ async function handleCritiqueUpload(input) { loadDashboardData(); } -// ✅ NOUVEAU : Retourne l'EAN ET le titre du CSV function normalizeVideothequeRow(row) { let ean = row['ean_isbn13'] || row['EAN'] || row['ean'] || row['Barcode'] || row['UPC'] || row['upc_isbn10'] || ''; if (ean) ean = String(ean).replace(/[^0-9]/g, ''); - // ✅ Récupérer le titre du CSV comme secours + // ✅ NOUVEAU : Récupérer aussi le titre du CSV let title = row['title'] ? String(row['title']).trim() : ''; if (!ean && !title) return null; @@ -437,10 +436,9 @@ function handleVideothequeUpload(input) { const parsed = parseCSV(text); if (!parsed.length) { alert("❌ CSV vide."); return; } - // ✅ NOUVEAU : On garde le titre du CSV - const items = parsed.map(row => normalizeVideothequeRow(row)).filter(Boolean); - - if (!items.length) { alert("❌ Aucun titre ou EAN valide trouvé."); return; } + const items = parsed.map(row => normalizeVideothequeRow(row)).filter(Boolean); + + if (!items.length) { alert("❌ Aucun titre ou EAN valide trouvé."); return; } showImportModal(items.length, 'videotheque'); let processed = 0, totalImp = 0, totalSkp = 0;