Bug 36612

Summary: The public tickets endpoint needs public fields list
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: REST APIAssignee: Martin Renvoize <martin.renvoize>
Status: Pushed to main --- QA Contact:
Severity: major    
Priority: P5 - low CC: m.de.rooy, me, paul.derscheid, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00
Bug Depends on: 28948, 31028    
Bug Blocks: 34255    
Attachments: Bug 36612: Unit test for public ticket add
Bug 36612: Add public_read_list to Koha::Ticket
Bug 36612: Add public_read_list to Koha::Ticket
Bug 36612: Unit test for public ticket add
Bug 36612: Add public_read_list to Koha::Ticket
Bug 36612: (QA follow-up) Add 'source' to public_read_list

Description Martin Renvoize 2024-04-16 17:21:55 UTC
We missed adding the public_read_list routine to Koha::Ticket somewhere along the line.

We need said list to prevent a 500 response from the POST /api/v1/public/tickets endpoint which is used by the OPAC for adding catalog concerns.
Comment 1 Martin Renvoize 2024-04-16 17:50:09 UTC
Created attachment 164960 [details] [review]
Bug 36612: Unit test for public ticket add
Comment 2 Martin Renvoize 2024-04-16 17:50:12 UTC
Created attachment 164961 [details] [review]
Bug 36612: Add public_read_list to Koha::Ticket

Without the public_read_list to define which fields should be accessible
from the public endpoints we will always return a 500 from the API on
otherwise successfull additions of tickets via the OPAC.

Test plan
1) Enable OPACCatalogConcerns
2) Login to the OPAC and "Report a concern"
3) Note the error message in the UI "There was an error when submitting
   your concern, please contact a librarian."
4) Confirm that the concern is actually created regardless
5) Apply the patch here and restart plack
6) Submit another 'Report a concern' and now note the success message
   "Your concern was successfully submitted."
Comment 3 David Nind 2024-04-22 11:35:29 UTC Comment hidden (obsolete)
Comment 4 David Nind 2024-04-22 11:40:47 UTC
Created attachment 165269 [details] [review]
Bug 36612: Unit test for public ticket add

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2024-04-22 11:40:49 UTC
Created attachment 165270 [details] [review]
Bug 36612: Add public_read_list to Koha::Ticket

Without the public_read_list to define which fields should be accessible
from the public endpoints we will always return a 500 from the API on
otherwise successfull additions of tickets via the OPAC.

Test plan
1) Enable OPACCatalogConcerns
2) Login to the OPAC and "Report a concern"
3) Note the error message in the UI "There was an error when submitting
   your concern, please contact a librarian."
4) Confirm that the concern is actually created regardless
5) Apply the patch here and restart plack
6) Submit another 'Report a concern' and now note the success message
   "Your concern was successfully submitted."

Signed-off-by: David Nind <david@davidnind.com>
Comment 6 Katrin Fischer 2024-05-03 09:00:03 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 7 Martin Renvoize 2024-05-07 12:03:23 UTC
The combination of bug 35616 and this bug introduces failures in the new tests introduced here.

Working on the fix now.
Comment 8 Martin Renvoize 2024-05-07 12:08:38 UTC
Created attachment 166261 [details] [review]
Bug 36612: (QA follow-up) Add 'source' to public_read_list

This patch adds the required 'source' field to the public_read_list for
tickets.
Comment 9 Katrin Fischer 2024-05-07 13:56:15 UTC
Pushed for 24.05!

Well done everyone, thank you!