From dba949b83d92f116f68043858f486fe92131b3b5 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 12 Oct 2025 19:27:53 +0200 Subject: [PATCH] Show deletion text using common name --- scripts/species_tools.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/species_tools.php b/scripts/species_tools.php index d1c9d07..becf0f5 100644 --- a/scripts/species_tools.php +++ b/scripts/species_tools.php @@ -266,7 +266,7 @@ $result = $db->query($sql); . "".$confirm_cell."" . "".$excl_cell."" . "".$white_cell."" - . "" + . "" . ""; } ?> @@ -358,11 +358,12 @@ function toggleSpecies(list, species, action) { .then(t => { if (t.trim() === 'OK') location.reload(); }); } function deleteSpecies(species) { - get(scriptsBase + 'species_tools.php?getcounts=' + encodeURIComponent(species)).then(t => { + let parts = species.split(' + '); let sci_species = parts[0]; let com_species = parts[1]; + get(scriptsBase + 'species_tools.php?getcounts=' + encodeURIComponent(sci_species)).then(t => { let info; try { info = JSON.parse(t); } catch { alert('Could not parse count response'); return; } - if (!confirm('Delete ' + info.count + ' detections and local audio and png files for ' + species + '?')) return; - get(scriptsBase + 'species_tools.php?delete=' + encodeURIComponent(species)).then(t2 => { - try { const res = JSON.parse(t2); alert('Deleted ' + res.lines + ' detections and ' + res.files + ' files for ' + species); } + if (!confirm('Delete ' + info.count + ' detections and local audio and png files for ' + com_species + '?')) return; + get(scriptsBase + 'species_tools.php?delete=' + encodeURIComponent(sci_species)).then(t2 => { + try { const res = JSON.parse(t2); alert('Deleted ' + res.lines + ' detections and ' + res.files + ' files for ' + com_species); } catch { alert('Deletion complete'); } location.reload(); });