From 9b8ae2ae94802f7cf42751f95fcd72c8f4763742 Mon Sep 17 00:00:00 2001
From: Lucas Gass <lucas@bywatersolutions.com>
Date: Thu, 8 May 2025 14:58:51 +0000
Subject: [PATCH] Bug 39861: Delegate click function to the table

To test:
1 - Add a new Z3950 server with basic information filled out, it doesn't need to be valid
2 - Add a second copy via the DB:
    INSERT INTO z3950servers SELECT null,host,port,db,userid,password,servername,checked,rank,syntax,timeout,servertype,encoding,recordtype,sru_options,sru_fields,add_xslt,attributes FROM z3950servers WHERE id=6;
3 - Delete the copy, assuming it is on page one, it works
4 - Spam the DB with the SQL above and create 20+ entries
5 - Open the Z3950 admin page
6 - Go to second page of servers
7 - Attempt to delete any entry
8 - Nothing happens
9 - APPLY PATCH
10 - Try deleting again, it should now work.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt
index 467af1e7ff..ef73637f27 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt
@@ -321,7 +321,7 @@
                 $("#serverst").kohaTable({
                     pagingType: "full",
                 });
-                $(".delete").on("click",function(e){
+                $("#serverst").on("click", ".delete", function(e) {
                     var servername = $(this).data("servername");
                     let formid = $(this).data("formid");
                     if( confirm( _("Are you sure you want to delete server %s?").format(servername) ) ) {
-- 
2.39.5