Bug 39861

Summary: Z39.50/SRU servers on second page of results cannot be deleted
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Z39.50 / SRU / OpenSearch ServersAssignee: Lucas Gass (lukeg) <lucas>
Status: Pushed to main --- QA Contact: David Cook <dcook>
Severity: normal    
Priority: P5 - low CC: david, dcook, lucas, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
This fixes the Z39.50/SRU servers page so that servers on the second (and later) page of results can now be deleted.
Version(s) released in:
25.05.00
Circulation function:
Attachments: Bug 39861: Delegate click function to the table
Bug 39861: Delegate click function to the table
Bug 39861: Delegate click function to the table
Bug 39861: Delegate click function to the table

Description Nick Clemens (kidclamp) 2025-05-08 10:33:08 UTC
It seems that when paginating the Z3950 sources table, the event for the delete button is not attached to the second page of results.

To recreate:
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
Comment 1 Lucas Gass (lukeg) 2025-05-08 15:00:00 UTC
Created attachment 182090 [details] [review]
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.
Comment 2 Roman Dolny 2025-05-08 20:10:23 UTC
Created attachment 182118 [details] [review]
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>
Comment 3 David Nind 2025-05-08 20:23:15 UTC
Created attachment 182119 [details] [review]
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>
Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Cook 2025-05-09 01:40:54 UTC
Trying this out and interestingly it only applies to 20+ entries.

If you have 10+ entries and change it to "Show 10 entries", you can delete from the second page. I guess that's because the click handler was added for the original <= 20 entries
Comment 5 David Cook 2025-05-09 01:42:32 UTC
Created attachment 182134 [details] [review]
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>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Comment 6 Katrin Fischer 2025-05-09 07:15:01 UTC
Pushed for 25.05!

Well done everyone, thank you!