Bugzilla – Attachment 173582 Details for
Bug 34324
Merge OPACProblemReport and CatalogConcern functions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34324: Add support for additional fields to /tickets
Bug-34324-Add-support-for-additional-fields-to-tic.patch (text/plain), 2.89 KB, created by
Martin Renvoize (ashimema)
on 2024-10-28 17:44:47 UTC
(
hide
)
Description:
Bug 34324: Add support for additional fields to /tickets
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-10-28 17:44:47 UTC
Size:
2.89 KB
patch
obsolete
>From ecef48accbd7ff1573ecb3e0e7ece90174ff6e52 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 20 Dec 2023 16:14:53 +0000 >Subject: [PATCH] Bug 34324: Add support for additional fields to /tickets > >We need to store page_url as part of the opac_report functionality. > >Rather than adding fields to the core tickets table, it makes sense to >utilise the additional_fields functionality. >--- > Koha/REST/V1/Tickets.pm | 10 ++++++++++ > Koha/Ticket.pm | 2 +- > api/v1/swagger/definitions/ticket.yaml | 7 +++++++ > api/v1/swagger/paths/tickets.yaml | 1 + > 4 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/Koha/REST/V1/Tickets.pm b/Koha/REST/V1/Tickets.pm >index 5fca8e443b1..9fc6b2225ec 100644 >--- a/Koha/REST/V1/Tickets.pm >+++ b/Koha/REST/V1/Tickets.pm >@@ -82,8 +82,18 @@ sub add { > # FIXME: We should allow impersonation at a later date to > # allow an API user to submit on behalf of a user > >+ # Capture additional_fields >+ my $extended_attributes = delete $body->{extended_attributes} // []; >+ >+ # Create ticket > my $ticket = Koha::Ticket->new_from_api($body)->store; > $ticket->discard_changes; >+ >+ # Set additional_fields >+ my @extended_attributes = map { {'id' => $_->{field_id}, 'value' => $_->{value}} } @{$extended_attributes}; >+ $ticket->extended_attributes(\@extended_attributes); >+ >+ # Respond > $c->res->headers->location( > $c->req->url->to_string . '/' . $ticket->id ); > return $c->render( >diff --git a/Koha/Ticket.pm b/Koha/Ticket.pm >index 18f9c672a39..d28a51c3b04 100644 >--- a/Koha/Ticket.pm >+++ b/Koha/Ticket.pm >@@ -17,7 +17,7 @@ package Koha::Ticket; > > use Modern::Perl; > >-use base qw(Koha::Object); >+use base qw(Koha::Object Koha::Object::Mixin::AdditionalFields); > > use C4::Letters; > >diff --git a/api/v1/swagger/definitions/ticket.yaml b/api/v1/swagger/definitions/ticket.yaml >index 47c366bb784..e3e0fe73f15 100644 >--- a/api/v1/swagger/definitions/ticket.yaml >+++ b/api/v1/swagger/definitions/ticket.yaml >@@ -9,6 +9,7 @@ properties: > type: string > enum: > - catalog >+ - opac_problem > reported_date: > type: > - string >@@ -76,6 +77,12 @@ properties: > - integer > - "null" > description: Number of updates >+ extended_attributes: >+ type: >+ - array >+ items: >+ $ref: additional_field_value.yaml >+ description: Related additional field values > _strings: > type: > - object >diff --git a/api/v1/swagger/paths/tickets.yaml b/api/v1/swagger/paths/tickets.yaml >index c3010dfafa6..828a1c0594e 100644 >--- a/api/v1/swagger/paths/tickets.yaml >+++ b/api/v1/swagger/paths/tickets.yaml >@@ -30,6 +30,7 @@ > - biblio > - updates+count > - +strings >+ - extended_attributes > collectionFormat: csv > responses: > "200": >-- >2.47.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34324
:
160199
|
160200
|
160201
|
160202
|
160203
|
160204
|
160205
|
160206
|
173580
|
173581
|
173582
|
173583
|
173584
|
173585
|
173586
|
173587
|
173671
|
173672
|
173673
|
173674
|
173675
|
173676
|
173677
|
173678
|
173679
|
173680