From 98f61265ea5ad7048f84902e152bfe551a24b182 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Sat, 22 Jun 2024 15:35:31 -0700 Subject: [PATCH] Bug 37161: After deleting a tag in a MARC framework, redirect back to the tag list rather than showing a 'Tag deleted' page first Currently after you delete a tag from a MARC framework, Koha intends to show you a page with the text "Tag deleted" and an OK button to click to go back to where you were in the list of tags. But because that depends on the template variable being set for the name of the op in the script, and the name of the op is "cud-delete_confirmed" which isn't a legal TT variable name, nothing is set to tell the template what to display, so it displays a mostly-blank page. Far better to show, don't tell, and just redirect to the list of tags like deleting a tag from an authority framework does. Test plan: 1. Without the patch, Administration - MARC bibliographic frameworks - Binders row - Actions menu - MARC structure 2. Type 092 and press Enter in the Search for tag: input 3. 092 row - Actions menu - Delete - Yes, delete this tag 4. Stare blankly at the blank page with only a header 5. Apply patch, restart_all 6. Administration - MARC bibliographic frameworks - Kits row - Actions menu - MARC structure 7. Type 092 and press Enter in the Search for tag: input 8. 092 row - Actions menu - Delete - Yes, delete this tag 9. Enjoy the sight of the Kits framework showing a search for 092 that doesn't show one, because you just deleted it, and now you can delete the 096 tag next Signed-off-by: Sam Lau Signed-off-by: Eric Garcia Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer (cherry picked from commit 825c6c5edf953161acf124a4fcecd6d32f719431) Signed-off-by: Lucas Gass --- admin/marctagstructure.pl | 4 ++- .../prog/en/modules/admin/marctagstructure.tt | 25 ------------------- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/admin/marctagstructure.pl b/admin/marctagstructure.pl index d342c09733..96eeedfef2 100755 --- a/admin/marctagstructure.pl +++ b/admin/marctagstructure.pl @@ -180,7 +180,9 @@ if ($op eq 'add_form') { $cache->clear_from_cache("MarcStructure-1-$frameworkcode"); $cache->clear_from_cache("MarcSubfieldStructure-$frameworkcode"); $cache->clear_from_cache("MarcCodedFields-$frameworkcode"); - $template->param( searchfield => $searchfield ); + print $input->redirect( + "/cgi-bin/koha/admin/marctagstructure.pl?searchfield=$searchfield&frameworkcode=$frameworkcode"); + exit; # END $OP eq DELETE_CONFIRMED ################## ITEMTYPE_CREATE ################################## # called automatically if an unexisting frameworkis selected diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt index d3c54b1787..f0e028ff2c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt @@ -15,9 +15,6 @@ [% IF ( delete_confirm ) %] [% tx("Confirm deletion of tag {searchfield}", { searchfield = searchfield }) | html %] › [% END %] - [% IF ( delete_confirmed ) %] - [% t("Data deleted") | html %] › - [% END %] [% IF framework %] [% framework.frameworktext | html %] ([% framework.frameworkcode | html %]) › [% ELSE %] @@ -84,20 +81,6 @@ [% WRAPPER breadcrumb_item bc_active= 1%] [% tx("Confirm deletion of tag {searchfield}", { searchfield = searchfield }) | html %] [% END %] - - [% ELSIF ( delete_confirmed ) %] - [% WRAPPER breadcrumb_item %] - - [% IF framework %] - [% framework.frameworktext | html %] ([% framework.frameworkcode | html %]) - [% ELSE %] - Default framework - [% END %] - - [% END %] - [% WRAPPER breadcrumb_item bc_active= 1%] - Data deleted - [% END %] [% END %] [% END #/ WRAPPER breadcrumbs %] [% END #/ WRAPPER sub-header.inc %] @@ -212,14 +195,6 @@ [% END %] -[% IF ( delete_confirmed ) %] - -

Tag deleted

-
- [% INCLUDE 'csrf-token.inc' %] - -
-[% END %] [% IF ( framework_create ) %]
-- 2.39.5