Bug 37959 - Item circulation alerts table appears to be broken
Summary: Item circulation alerts table appears to be broken
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P3 major
Assignee: Phil Ringnalda
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on: 36192
Blocks:
  Show dependency treegraph
 
Reported: 2024-09-18 19:24 UTC by Esther Melander
Modified: 2024-10-21 23:28 UTC (History)
6 users (show)

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


Attachments
Bug 37979: Toggling Item circulation alerts table cells needs to send csrf_token (1.96 KB, patch)
2024-09-19 02:48 UTC, Phil Ringnalda
Details | Diff | Splinter Review
Bug 37979: Toggling Item circulation alerts table cells needs to send csrf_token (2.01 KB, patch)
2024-09-19 06:40 UTC, Jan Kissig
Details | Diff | Splinter Review
Bug 37979: Toggling Item circulation alerts table cells needs to send csrf_token (2.11 KB, patch)
2024-09-20 07:21 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Esther Melander 2024-09-18 19:24:57 UTC
To replicate:

1. Click on a cell in the table.

The cell changes to save "Saving..." and then appears to become stuck. Nothing ever happens. Refreshing the page returns to the table to its original state.
Comment 1 Phil Ringnalda 2024-09-19 02:35:15 UTC
Well, one thing happens when you have the browser console open: POST /cgi-bin/koha/admin/item_circulation_alerts.pl returns a 403, since the ajax request doesn't include the csrf_token.
Comment 2 Phil Ringnalda 2024-09-19 02:48:08 UTC
Created attachment 171699 [details] [review]
Bug 37979: Toggling Item circulation alerts table cells needs to send csrf_token

When you click on a cell in the Item circulation alerts table, the page sends
a POST to /cgi-bin/koha/admin/item_circulation_alerts.pl without including a
csrf_token, which gets back a 403 error because that's sketchy behavior. It
needs to include the token.

Test plan:
1. Administration - Item circulation alerts
2. Open the browser devtools to the console
3. Click on any green table cell
4. It should have turned red, but instead your console turned red with a 403
5. Apply patch, reload
6. Click on any green table cell, it will turn red

Sponsored-by: Chetco Community Public Library
Comment 3 Jan Kissig 2024-09-19 06:40:00 UTC
Created attachment 171701 [details] [review]
Bug 37979: Toggling Item circulation alerts table cells needs to send csrf_token

When you click on a cell in the Item circulation alerts table, the page sends
a POST to /cgi-bin/koha/admin/item_circulation_alerts.pl without including a
csrf_token, which gets back a 403 error because that's sketchy behavior. It
needs to include the token.

Test plan:
1. Administration - Item circulation alerts
2. Open the browser devtools to the console
3. Click on any green table cell
4. It should have turned red, but instead your console turned red with a 403
5. Apply patch, reload
6. Click on any green table cell, it will turn red

Sponsored-by: Chetco Community Public Library

https://bugs.koha-community.org/show_bug.cgi?id=37959
Signed-off-by: Jan Kissig <jkissig@th-wildau.de>
Comment 4 Marcel de Rooy 2024-09-20 07:21:55 UTC
Created attachment 171821 [details] [review]
Bug 37979: Toggling Item circulation alerts table cells needs to send csrf_token

When you click on a cell in the Item circulation alerts table, the page sends
a POST to /cgi-bin/koha/admin/item_circulation_alerts.pl without including a
csrf_token, which gets back a 403 error because that's sketchy behavior. It
needs to include the token.

Test plan:
1. Administration - Item circulation alerts
2. Open the browser devtools to the console
3. Click on any green table cell
4. It should have turned red, but instead your console turned red with a 403
5. Apply patch, reload
6. Click on any green table cell, it will turn red

Sponsored-by: Chetco Community Public Library

Signed-off-by: Jan Kissig <jkissig@th-wildau.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Martin Renvoize (ashimema) 2024-09-30 14:20:24 UTC
Katrin has pushed this, but the bug number in the commit doesn't correspond to the bug number here so it didn't get closed.. 

Closing on her behalf now
Comment 6 Martin Renvoize (ashimema) 2024-09-30 14:21:26 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 7 Katrin Fischer 2024-10-02 14:17:20 UTC
(In reply to Martin Renvoize (ashimema) from comment #6)
> Thanks for all the hard work!
> 
> Pushed to main for the next 24.11.00 release as RM Assistant

Thanks for noticing, I will keep a note for checking in the release notes.
Comment 8 Lucas Gass (lukeg) 2024-10-09 20:00:03 UTC
I can't find the correct commit in main to cherry-pick:

kohadev-koha@kohadevbox:koha(rmain2405)$ git log --pretty=oneline main | grep '37959'
000668a6fb1a7d6e0b58785a5fc827e3155b27bb Bug 37959: Correct bug number mistake.

Going to just git bz apply this one
Comment 9 Lucas Gass (lukeg) 2024-10-09 20:00:50 UTC
Backported to 24.05.x for upcoming 24.05.05
Comment 10 Phil Ringnalda 2024-10-09 20:02:48 UTC
It was https://git.koha-community.org/Koha-community/Koha/commit/66eabead5f9a2041c864da197deed38733ffefef

I'll try to stop thinking I can type bug numbers in commits, and only copy-paste them.
Comment 11 Katrin Fischer 2024-10-10 11:56:09 UTC
There was a mistake in the bug number in the attached patch file (might want to fix before you push):
https://git.koha-community.org/Koha-community/Koha/commits/branch/main/search?q=37979&all=
Comment 12 Fridolin Somers 2024-10-21 13:21:40 UTC
Not for 23.11.x