Bugzilla – Attachment 160374 Details for
Bug 35657
Add ability to assign tickets to librarians for catalog concerns
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35657: Add support for assignee_id to ticket_updates endpoint
Bug-35657-Add-support-for-assigneeid-to-ticketupda.patch (text/plain), 6.19 KB, created by
Martin Renvoize (ashimema)
on 2023-12-29 17:49:20 UTC
(
hide
)
Description:
Bug 35657: Add support for assignee_id to ticket_updates endpoint
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-12-29 17:49:20 UTC
Size:
6.19 KB
patch
obsolete
>From 6df1687c5a7d0837290dbaa912b0e9790cd14426 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 28 Dec 2023 15:03:36 +0000 >Subject: [PATCH] Bug 35657: Add support for assignee_id to ticket_updates > endpoint > >This patch starts to add support for cross-synced ticket.assignee_id >updates. You should be able to either set assignee at the time of >adding a ticket_update or directly on the ticket.. but in both cases end >up with a ticket_update with the fine details of when and who set the >assigee. >--- > Koha/REST/V1/Tickets.pm | 17 ++++++++++++++++- > Koha/Ticket.pm | 13 +++++++++++++ > Koha/Ticket/Update.pm | 13 +++++++++++++ > api/v1/swagger/definitions/ticket.yaml | 8 ++++++++ > api/v1/swagger/definitions/ticket_update.yaml | 8 ++++++++ > api/v1/swagger/paths/tickets.yaml | 2 ++ > .../prog/en/modules/cataloguing/concerns.tt | 3 ++- > 7 files changed, 62 insertions(+), 2 deletions(-) > >diff --git a/Koha/REST/V1/Tickets.pm b/Koha/REST/V1/Tickets.pm >index 6d13183343d..c5cb018e349 100644 >--- a/Koha/REST/V1/Tickets.pm >+++ b/Koha/REST/V1/Tickets.pm >@@ -116,9 +116,18 @@ sub update { > ); > } > >+ my $assignee_before = $ticket->assignee_id; > return try { > $ticket->set_from_api( $c->req->json ); > $ticket->store(); >+ >+ # Create update if assignee changed >+ if ( $assignee_before ne $ticket->assignee_id ) { >+ my $patron = $c->stash('koha.user'); >+ my $update = >+ { user_id => $patron->id, ticket_id => $ticket->id, public => 0, assignee_id => $ticket->assignee_id }; >+ Koha::Ticket::Updates->new($update)->store(); >+ } > return $c->render( status => 200, openapi => $ticket->to_api ); > } > catch { >@@ -197,7 +206,7 @@ sub add_update { > ); > } > >- # Set reporter from session >+ # Set user from session > $ticket_update->{user_id} = $patron->id; > # FIXME: We should allow impersonation at a later date to > # allow an API user to submit on behalf of a user >@@ -226,6 +235,12 @@ sub add_update { > $ticket->set( { status => $ticket_update->{status} } )->store; > } > >+ # Update ticket assignee if needed >+ if ( $ticket_update->{assignee_id} ) { >+ my $ticket = $update->ticket; >+ $ticket->set( { assignee_id => $ticket_update->{assignee_id} } )->store; >+ } >+ > # Optionally add to message_queue here to notify reporter > if ( $update->public ) { > my $notice = >diff --git a/Koha/Ticket.pm b/Koha/Ticket.pm >index 59792e24bfc..836259485a0 100644 >--- a/Koha/Ticket.pm >+++ b/Koha/Ticket.pm >@@ -47,6 +47,19 @@ sub reporter { > return Koha::Patron->_new_from_dbic($rs); > } > >+=head3 assignee >+ >+Return the patron who submitted this ticket >+ >+=cut >+ >+sub assignee { >+ my ($self) = @_; >+ my $rs = $self->_result->assignee; >+ return unless $rs; >+ return Koha::Patron->_new_from_dbic($rs); >+} >+ > =head3 resolver > > Return the user who resolved this ticket >diff --git a/Koha/Ticket/Update.pm b/Koha/Ticket/Update.pm >index dad68226f0a..6ea262997aa 100644 >--- a/Koha/Ticket/Update.pm >+++ b/Koha/Ticket/Update.pm >@@ -55,6 +55,19 @@ sub user { > return Koha::Patron->_new_from_dbic($rs); > } > >+=head3 assignee >+ >+Return the patron who is assigned at this update >+ >+=cut >+ >+sub assignee { >+ my ($self) = @_; >+ my $rs = $self->_result->assignee; >+ return unless $rs; >+ return Koha::Patron->_new_from_dbic($rs); >+} >+ > =head2 Internal methods > > =head3 to_api_mapping >diff --git a/api/v1/swagger/definitions/ticket.yaml b/api/v1/swagger/definitions/ticket.yaml >index 8699e455f43..70898918664 100644 >--- a/api/v1/swagger/definitions/ticket.yaml >+++ b/api/v1/swagger/definitions/ticket.yaml >@@ -42,6 +42,14 @@ properties: > reporter_id: > type: integer > description: Internal identifier for the patron who reported the ticket >+ assignee: >+ type: >+ - object >+ - "null" >+ assignee_id: >+ type: >+ - integer >+ - "null" > resolver: > type: > - object >diff --git a/api/v1/swagger/definitions/ticket_update.yaml b/api/v1/swagger/definitions/ticket_update.yaml >index 7e956643123..7851b4a69df 100644 >--- a/api/v1/swagger/definitions/ticket_update.yaml >+++ b/api/v1/swagger/definitions/ticket_update.yaml >@@ -18,6 +18,14 @@ properties: > user_id: > type: integer > description: Internal identifier for the patron who added the update >+ assignee: >+ type: >+ - object >+ - "null" >+ assignee_id: >+ type: >+ - integer >+ - "null" > date: > type: > - string >diff --git a/api/v1/swagger/paths/tickets.yaml b/api/v1/swagger/paths/tickets.yaml >index b28dc4fca01..a76239c66f4 100644 >--- a/api/v1/swagger/paths/tickets.yaml >+++ b/api/v1/swagger/paths/tickets.yaml >@@ -24,6 +24,7 @@ > items: > type: string > enum: >+ - assignee > - reporter > - resolver > - biblio >@@ -237,6 +238,7 @@ > items: > type: string > enum: >+ - assignee > - user > - +strings > collectionFormat: csv >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >index 853ee6456ab..2d09c5e4afb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/concerns.tt >@@ -102,6 +102,7 @@ > "url": tickets_url > }, > "embed": [ >+ "assignee", > "reporter", > "resolver", > "biblio", >@@ -160,7 +161,7 @@ > "orderable": true > }, > { >- "data": "resolver.firstname:resolver.surname:resolved_date:status", >+ "data": "assignee.firstname:assignee.surname:resolver.firstname:resolver.surname:resolved_date:status", > "render": function(data, type, row, meta) { > let result = ''; > if (row.resolved_date) { >-- >2.43.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 35657
:
160365
|
160366
|
160367
|
160368
|
160369
|
160372
|
160373
|
160374
|
160375
|
160376
|
160377
|
164923
|
164924
|
164925
|
164926
|
164927
|
164928
|
164932
|
164933
|
164934
|
164935
|
164974
|
164975
|
164976
|
164977
|
165666
|
165667
|
165668
|
165669
|
165670
|
165671
|
165672
|
165673
|
165674
|
165675
|
165676
|
165677
|
165678
|
165679
|
165786
|
165787
|
165788
|
165789
|
165790
|
165791
|
165792
|
165878
|
165879
|
165880
|
165881
|
165882
|
165883
|
165884
|
165885
|
165886
|
166067