From 63a51acc8327dffa9029a442eb58fae975034a11 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 23 Feb 2024 18:05:16 +0000 Subject: [PATCH] Bug 34478: Correct op name for list edit confirmation The 'delete_confirm' op leads to a confirmation page, so it's GET. The patch also consolidates JS for handling deletions, using the same class for both the delete button in the toolbar and in the table of lists. Signed-off-by: Jonathan Druart --- .../prog/en/includes/virtualshelves-toolbar.inc | 6 +++--- .../prog/en/modules/virtualshelves/shelves.tt | 16 ++-------------- .../virtualshelves/tables/shelves_results.tt | 4 ++-- virtualshelves/shelves.pl | 2 +- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc index d588bd477c..2ce1ccd503 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc @@ -16,11 +16,11 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 67413a7cd5..7dd62933f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -939,20 +939,8 @@ sendList(); return false; }); - $("#deleteshelf").click(function(e){ - if(confirm(_("Are you sure you want to delete this list?"))){ - return true; - } else { - e.preventDefault(); - } - }); - $("#deleteshelf_toolbar").on('click',function(e){ - if(confirm(_("Are you sure you want to delete this list?"))){ - $("#deleteshelf_toolbar_form").submit(); - return false; - } else { - e.preventDefault(); - } + $(".delete-list").click(function(e){ + return confirm(_("Are you sure you want to delete this list?")); }); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt index 38efef79ce..de301479f3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt @@ -50,11 +50,11 @@ [%~ action_block = action_block _ '
' ~%] [%~ action_block = BLOCK ~%][%~ action_block | $raw ~%][%~ INCLUDE 'csrf-token.inc' | trim ~%][%~ END ~%] [%~ action_block = action_block _ '' ~%] - [%~ action_block = action_block _ '' ~%] + [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '' ~%] - [%~ action_block = action_block _ '' ~%] + [%~ action_block = action_block _ '' ~%] [%~ action_block = action_block _ '
' ~%] [%~ END ~%] [%~ IF public AND allow_transfer ~%] diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index 2be580b4d0..ecf08fa9c7 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -63,7 +63,7 @@ my ( $shelf, $shelfnumber, @messages, $allow_transfer ); if ( $op eq 'add_form' ) { # Only pass default $shelf = { allow_change_from_owner => 1 }; -} elsif ( $op eq 'cud-edit_form' ) { +} elsif ( $op eq 'edit_form' ) { $shelfnumber = $query->param('shelfnumber'); $shelf = Koha::Virtualshelves->find($shelfnumber); -- 2.39.5