Bug 37163 - Fix the redirect after deleting a tag from an authority framework to load the right page
Summary: Fix the redirect after deleting a tag from an authority framework to load the...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Phil Ringnalda
QA Contact: Testopia
URL:
Keywords:
Depends on: 918
Blocks:
  Show dependency treegraph
 
Reported: 2024-06-22 00:43 UTC by Phil Ringnalda
Modified: 2024-06-27 09:53 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00


Attachments
Bug 37163: Fix the redirect after deleting a tag from an authority framework to load the right page (2.23 KB, patch)
2024-06-22 01:08 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 37163: Fix the redirect after deleting a tag from an authority framework to load the right page (2.28 KB, patch)
2024-06-24 16:45 UTC, Sam Lau
Details | Diff | Splinter Review
Bug 37163: Fix the redirect after deleting a tag from an authority framework to load the right page (2.33 KB, patch)
2024-06-25 22:46 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Phil Ringnalda 2024-06-22 00:43:13 UTC
https://git.koha-community.org/Koha-community/Koha/src/commit/36c4d315c8b4bac116377d7fac4d9e51414c7f80/admin/auth_tag_structure.pl#L160 attempts to send you back to the page where you were when you deleted a tag from an authority framework, but since the previous line sets  my $tagfield = $input->param('tagfield'); when the actual param is 'searchfield' ('tagfield' is only set when you are creating a new tag, editing tags misuses 'searchfield' whether or not you searched for it) so it fails.

Whether or not that redirect is the right thing to do is bug 37162 once bug 37161 decides what approach to use, but those may or may not go back through every supported version since they probably depend on the CSRF changes, and this has been busted since bug 918 landed in 2009.
Comment 1 Phil Ringnalda 2024-06-22 01:08:20 UTC
Created attachment 167999 [details] [review]
Bug 37163: Fix the redirect after deleting a tag from an authority framework to load the right page

When you delete a tag from an authority framework, we intend to redirect you
right back to where you were, on the same page of tags, but because we pick
the wrong variable to set searchfield in the URL, we send you to the first
page instead.

Test plan:
1. Without the patch, Administration - Authority types - in the row for
   CHRON_TERM Actions menu, MARC Structure
2. In the Search for tag: input, type 092 and hit Enter
3. In the row for 092, Actions menu, Delete, in the page that loads click
   Yes, delete
4. In the page you are redirected to, note that you are at Tag 000, and the
   URL is ?searchfield=&authtypecode=CHRON_TERM
5. Apply patch, restart_all
6. Type 092 and hit Enter, Actions menu for the 093 row, Delete, Yes, delete
7. Note that now you have gone to the page where 093 used to be, because
   the URL is ?searchfield=092&authtypecode=CHRON_TERM and you can just
   keep deleting 09x tags one after another
Comment 2 Phil Ringnalda 2024-06-22 01:10:37 UTC
Well, the URL is ?searchfield=093, not 092, since searchfield is intentionally the one you deleted, not what was in the search field at the time. That was just a typo.
Comment 3 Lucas Gass 2024-06-24 14:47:53 UTC
Phil,

Without this patch applied I am unable to recreate the problem described in your test plan.
Comment 4 Phil Ringnalda 2024-06-24 15:12:33 UTC
Interesting. That means you have $input->param('tagfield') defined as 092 when you submit a form with four params: csrf_token, op, authtypecode, and searchfield.

How?
Comment 5 Sam Lau 2024-06-24 16:44:46 UTC
I am recreating this problem and applying the patch fixes the issue as described.
Comment 6 Sam Lau 2024-06-24 16:45:38 UTC
Created attachment 168031 [details] [review]
Bug 37163: Fix the redirect after deleting a tag from an authority framework to load the right page

When you delete a tag from an authority framework, we intend to redirect you
right back to where you were, on the same page of tags, but because we pick
the wrong variable to set searchfield in the URL, we send you to the first
page instead.

Test plan:
1. Without the patch, Administration - Authority types - in the row for
   CHRON_TERM Actions menu, MARC Structure
2. In the Search for tag: input, type 092 and hit Enter
3. In the row for 092, Actions menu, Delete, in the page that loads click
   Yes, delete
4. In the page you are redirected to, note that you are at Tag 000, and the
   URL is ?searchfield=&authtypecode=CHRON_TERM
5. Apply patch, restart_all
6. Type 092 and hit Enter, Actions menu for the 093 row, Delete, Yes, delete
7. Note that now you have gone to the page where 093 used to be, because
   the URL is ?searchfield=092&authtypecode=CHRON_TERM and you can just
   keep deleting 09x tags one after another

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 7 Nick Clemens (kidclamp) 2024-06-25 22:46:21 UTC
Created attachment 168110 [details] [review]
Bug 37163: Fix the redirect after deleting a tag from an authority framework to load the right page

When you delete a tag from an authority framework, we intend to redirect you
right back to where you were, on the same page of tags, but because we pick
the wrong variable to set searchfield in the URL, we send you to the first
page instead.

Test plan:
1. Without the patch, Administration - Authority types - in the row for
   CHRON_TERM Actions menu, MARC Structure
2. In the Search for tag: input, type 092 and hit Enter
3. In the row for 092, Actions menu, Delete, in the page that loads click
   Yes, delete
4. In the page you are redirected to, note that you are at Tag 000, and the
   URL is ?searchfield=&authtypecode=CHRON_TERM
5. Apply patch, restart_all
6. Type 092 and hit Enter, Actions menu for the 093 row, Delete, Yes, delete
7. Note that now you have gone to the page where 093 used to be, because
   the URL is ?searchfield=092&authtypecode=CHRON_TERM and you can just
   keep deleting 09x tags one after another

Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Katrin Fischer 2024-06-27 09:53:06 UTC
Pushed for 24.11!

Well done everyone, thank you!