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;