From 361c26887f8d822564373a19898d15fba4a9090b Mon Sep 17 00:00:00 2001
From: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Date: Tue, 16 Apr 2024 18:22:41 +0100
Subject: [PATCH] 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>
---
 Koha/Ticket.pm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Koha/Ticket.pm b/Koha/Ticket.pm
index 83b84bc97e..6a5f2c5641 100644
--- a/Koha/Ticket.pm
+++ b/Koha/Ticket.pm
@@ -168,6 +168,20 @@ sub store {
 
 =cut
 
+=head3 public_read_list
+
+This method returns the list of publicly readable database fields for both API and UI output purposes
+
+=cut
+
+sub public_read_list {
+    return [
+        'ticket_id',   'title',         'body',
+        'reporter_id', 'reported_date', 'resolved_date',
+        'biblio_id'
+    ];
+}
+
 =head3 to_api_mapping
 
 This method returns the mapping for representing a Koha::Ticket object
-- 
2.30.2