Bug 39212 - Error when attempting to edit a booking
Summary: Error when attempting to edit a booking
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Lucas Gass (lukeg)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-02-27 21:46 UTC by Lucas Gass (lukeg)
Modified: 2025-03-07 14:43 UTC (History)
4 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:
25.05.00
Circulation function:


Attachments
Bug 39212: Explicitly set the contentType to JSON (1.28 KB, patch)
2025-02-27 22:36 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 39212: Explicitly set the contentType to JSON (1.18 KB, patch)
2025-02-27 22:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 39212: Explicitly set the contentType to JSON (1.24 KB, patch)
2025-02-28 20:20 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 39212: Explicitly set the contentType to JSON (1.31 KB, patch)
2025-03-04 16:41 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2025-02-27 21:46:44 UTC
To recreate:

1. Make an item or item type 'Bookable'
2. Place a booking for that item 
3. Go the 'Bookings' tab for that item.
4. Edit the booking
5. Submit the edit request and see at the top of the modal "Failure"

I also see something like this in the console:

PUT http://localhost:8081/api/v1/bookings/10 400 error
Comment 1 Lucas Gass (lukeg) 2025-02-27 22:33:30 UTC
It looks like the ajax request when doing PUT isn't assuming JSON.
Comment 2 Lucas Gass (lukeg) 2025-02-27 22:36:08 UTC
Created attachment 178811 [details] [review]
Bug 39212: Explicitly set the contentType to JSON

To test:
1. Make an item or item type 'Bookable'
2. Place a booking for that item
3. Go the 'Bookings' tab for that item.
4. Edit the booking
5. Submit the edit request and see at the top of the modal "Failure"
6. APPLY PATCH
7. Try editing bookings, now it should work.
Comment 3 Lucas Gass (lukeg) 2025-02-27 22:38:00 UTC
Created attachment 178812 [details] [review]
Bug 39212: Explicitly set the contentType to JSON

To test:
1. Make an item or item type 'Bookable'
2. Place a booking for that item
3. Go the 'Bookings' tab for that item.
4. Edit the booking
5. Submit the edit request and see at the top of the modal "Failure"
6. APPLY PATCH
7. Try editing bookings, now it should work.
Comment 4 Lucas Gass (lukeg) 2025-02-27 23:04:43 UTC
I don't really know why I need this because in `api/v1/swagger/paths/bookings.yaml` is says:


  consumes:
    - application/json
  produces:
    - application/json
Comment 5 Andrew Fuerste-Henry 2025-02-28 20:20:59 UTC
Created attachment 178871 [details] [review]
Bug 39212: Explicitly set the contentType to JSON

To test:
1. Make an item or item type 'Bookable'
2. Place a booking for that item
3. Go the 'Bookings' tab for that item.
4. Edit the booking
5. Submit the edit request and see at the top of the modal "Failure"
6. APPLY PATCH
7. Try editing bookings, now it should work.

Signed-off-by: Kristi Krueger <KKRUEGER@cuyahogalibrary.org>
Comment 6 Martin Renvoize (ashimema) 2025-03-04 16:41:57 UTC
Created attachment 178930 [details] [review]
Bug 39212: Explicitly set the contentType to JSON

To test:
1. Make an item or item type 'Bookable'
2. Place a booking for that item
3. Go the 'Bookings' tab for that item.
4. Edit the booking
5. Submit the edit request and see at the top of the modal "Failure"
6. APPLY PATCH
7. Try editing bookings, now it should work.

Signed-off-by: Kristi Krueger <KKRUEGER@cuyahogalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize (ashimema) 2025-03-04 16:42:50 UTC
Thanks for fixing this Lucas.. it's odd, I would have expected to notice this a lot earlier.. it feels like either this is browser specific or a jQuery change.. either way, being explicit about contentType is a positive change.

Passing QA
Comment 8 Katrin Fischer 2025-03-07 14:43:06 UTC
Pushed for 25.05!

Well done everyone, thank you!