From 949d646b3bdcf15e9423caca818c5acf3bc7fdc2 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 16 Dec 2020 13:40:26 +0100 Subject: [PATCH] Bug 27250: Prevent DELETE to be called several times on SMTP servers admin page The on click event is not replaced but added. We must unbind it before adding the second one To recreate: Create at least 2 SMTP servers Click "Delete" for server 1 => You get a successful message (OK) Click "Delete" for server 2 => You get a successful message (OK) => You get also an alert message about server 1 (KO) The DELETE route is called twice (one per Delete button you clicked) --- koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt index 66975366db..5d95faff4e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/smtp_servers.tt @@ -367,7 +367,7 @@ SMTP servers _("You are about to delete the '%s' SMTP server.").format(smtp_server_name) ); - $("#delete_confirm_modal_button").on( "click", function () { + $("#delete_confirm_modal_button").unbind("click").on( "click", function () { $.ajax({ method: "DELETE", url: "/api/v1/config/smtp_servers/"+smtp_server_id -- 2.20.1