Actualiser test.html
CI / PHP Syntax Check (push) Has been cancelled
CI / JavaScript Lint (push) Has been cancelled
CI / Docker Build Test (push) Has been cancelled
CI / Validate Translation Files (push) Has been cancelled
CI / Auto-merge develop → main (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled

This commit is contained in:
2026-06-17 19:59:26 +00:00
parent 02bfc82e2b
commit 69eb319aa1
+11 -8
View File
@@ -91,22 +91,25 @@
let errorCount = 0;
for (const checkbox of checkedBoxes) {
let p = { ...fullProductList[checkbox.dataset.index] };
p.category = newCat;
let p = fullProductList[checkbox.dataset.index];
// Utilisation de FormData pour garantir la compatibilité avec l'API
let formData = new FormData();
for (let key in p) {
formData.append(key, p[key]);
}
formData.set('category', newCat);
try {
let res = await fetch('api/index.php?action=product_save', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(p)
body: formData
});
let data = await res.json();
if (res.ok) {
successCount++;
} else {
console.error("Erreur serveur sur " + p.name, data);
console.error("Erreur serveur sur " + p.name);
errorCount++;
}
await new Promise(r => setTimeout(r, 250));
@@ -120,7 +123,7 @@
btn.disabled = false;
btn.textContent = "APPLIQUER AUX COCHÉS";
alert(`Traitement terminé :\n- Succès : ${successCount}\n- Erreurs : ${errorCount}\n\nVoir la console (F12) pour les détails.`);
alert(`Traitement terminé :\n- Succès : ${successCount}\n- Erreurs : ${errorCount}`);
}
</script>
</body>