Actualiser js/admin.js
This commit is contained in:
+25
-4
@@ -408,13 +408,34 @@ async function handleCritiqueUpload(input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function normalizeVideothequeRow(row) {
|
function normalizeVideothequeRow(row) {
|
||||||
|
// 🔥 CORRECTION : Ne PAS convertir l'EAN en nombre (perte de précision > 15 chiffres)
|
||||||
let ean = row['ean_isbn13'] || row['EAN'] || '';
|
let ean = row['ean_isbn13'] || row['EAN'] || '';
|
||||||
if (ean !== '') { const eanNum = parseFloat(ean); ean = isNaN(eanNum) ? '' : String(Math.round(eanNum)); }
|
if (ean !== '') {
|
||||||
|
// Nettoyer uniquement les caractères non numériques SANS conversion
|
||||||
|
ean = String(ean).replace(/[^0-9]/g, '');
|
||||||
|
// Supprimer les zéros non significatifs au début
|
||||||
|
ean = ean.replace(/^0+/, '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Length et discs peuvent rester en conversion numérique (petits nombres)
|
||||||
let length = row['length'] || '';
|
let length = row['length'] || '';
|
||||||
if (length !== '' && length !== null) { const l = parseFloat(length); length = isNaN(l) ? '' : String(Math.round(l)); }
|
if (length !== '' && length !== null) {
|
||||||
|
const l = parseFloat(length);
|
||||||
|
length = isNaN(l) ? '' : String(Math.round(l));
|
||||||
|
}
|
||||||
|
|
||||||
let discs = row['number_of_discs'] || '';
|
let discs = row['number_of_discs'] || '';
|
||||||
if (discs === '' || discs === null || isNaN(parseFloat(discs))) { discs = 1; } else { discs = Math.round(parseFloat(discs)); }
|
if (discs === '' || discs === null || isNaN(parseFloat(discs))) {
|
||||||
return Object.assign({}, row, { ean_isbn13: ean, length: length, number_of_discs: discs });
|
discs = 1;
|
||||||
|
} else {
|
||||||
|
discs = Math.round(parseFloat(discs));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.assign({}, row, {
|
||||||
|
ean_isbn13: ean,
|
||||||
|
length: length,
|
||||||
|
number_of_discs: discs
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleVideothequeUpload(input) {
|
async function handleVideothequeUpload(input) {
|
||||||
|
|||||||
Reference in New Issue
Block a user