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; let errorCount = 0;
for (const checkbox of checkedBoxes) { for (const checkbox of checkedBoxes) {
let p = { ...fullProductList[checkbox.dataset.index] }; let p = fullProductList[checkbox.dataset.index];
p.category = newCat;
// 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 { try {
let res = await fetch('api/index.php?action=product_save', { let res = await fetch('api/index.php?action=product_save', {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, body: formData
body: JSON.stringify(p)
}); });
let data = await res.json();
if (res.ok) { if (res.ok) {
successCount++; successCount++;
} else { } else {
console.error("Erreur serveur sur " + p.name, data); console.error("Erreur serveur sur " + p.name);
errorCount++; errorCount++;
} }
await new Promise(r => setTimeout(r, 250)); await new Promise(r => setTimeout(r, 250));
@@ -120,7 +123,7 @@
btn.disabled = false; btn.disabled = false;
btn.textContent = "APPLIQUER AUX COCHÉS"; 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> </script>
</body> </body>