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
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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user