From cb1f73b1bc3cdf56be5f44261621512dfa92c7cd Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 16 Feb 2024 14:18:06 +0000 Subject: [PATCH] Bug 34478: Corrections to add and delete of OAI sets This patch makes two changes: The first changes the name of the op value matched in the script when editing a set. The "mod" step is a GET operation to load the edit form. The second change is a workaround for the fact that a submit button looks bad in a Bootstrap dropdown. The patch creates a hidden form for deletion operations. Clicking a "delete" link in a dropdown fills the hidden form with the OAI set id to be deleted and submits it. Signed-off-by: Jonathan Druart --- admin/oai_sets.pl | 2 +- .../prog/en/modules/admin/oai_sets.tt | 20 ++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/admin/oai_sets.pl b/admin/oai_sets.pl index fe611953a0..6e69eac652 100755 --- a/admin/oai_sets.pl +++ b/admin/oai_sets.pl @@ -55,7 +55,7 @@ if($op && $op eq "new") { name => $name, descriptions => \@descriptions }); -} elsif($op && $op eq "cud-mod") { +} elsif($op && $op eq "mod") { my $id = $input->param('id'); my $set = GetOAISet($id); $template->param( diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt index f258097c41..3ccf6d187f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/oai_sets.tt @@ -139,7 +139,7 @@ Actions @@ -148,6 +148,11 @@ [% END %] +
+ [% INCLUDE 'csrf-token.inc' %] + + +
[% ELSE %]

There are no sets defined.

@@ -181,13 +186,14 @@ $(li).remove(); } - function confirmDelete() { - return confirm(_("Are you sure you want to delete this OAI set?")); - } - $(document).ready(function() { - $(".delete_oai_set").on("click",function(){ - return confirmDelete(); + $(".delete_oai_set").on("click",function(e){ + e.preventDefault(); + if( confirm(_("Are you sure you want to delete this OAI set?")) ){ + let oai_set_id = $(this).data("oai-set-id"); + $("#oai_sets_id").val( oai_set_id ); + $("#oai_sets_delete").submit(); + } }); $("body").on("click", ".remove_description", function(e){ -- 2.39.2