Bug 36758 - We should notify an assignee when they are assigned a ticket
Summary: We should notify an assignee when they are assigned a ticket
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Kyle M Hall (khall)
URL:
Keywords:
Depends on: 35657
Blocks: 15278 34255
  Show dependency treegraph
 
Reported: 2024-05-02 14:20 UTC by Martin Renvoize (ashimema)
Modified: 2024-10-28 14:21 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact: Caroline Cyr La Rose
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/957
Text to go in the release notes:
This enhancement to catalog concerns notifies staff when a new concern is assigned to them for action (when CatalogConcerns and OpacCatalogConcerns are enabled). It uses a new TICKET_ASSIGNED notice. No notice is sent when it is self-assigned. **Sponsored by** *PTFS Europe*
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 36758: Add TICKET_ASSIGNED notice (3.56 KB, patch)
2024-05-07 17:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36758: Add librarian object (1.30 KB, patch)
2024-05-07 17:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36758: Unit tests for assignee notification trigger (3.74 KB, patch)
2024-05-07 17:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36758: Add trigger for assignee notification trigger (3.29 KB, patch)
2024-05-07 17:00 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36758: Add TICKET_ASSIGNED notice (3.60 KB, patch)
2024-05-08 12:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 36758: Add librarian object (1.35 KB, patch)
2024-05-08 12:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 36758: Unit tests for assignee notification trigger (3.79 KB, patch)
2024-05-08 12:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 36758: Add trigger for assignee notification trigger (3.33 KB, patch)
2024-05-08 12:03 UTC, David Nind
Details | Diff | Splinter Review
Bug 36758: Add TICKET_ASSIGNED notice (3.66 KB, patch)
2024-07-19 15:25 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 36758: Add librarian object (1.40 KB, patch)
2024-07-19 15:25 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 36758: Unit tests for assignee notification trigger (3.84 KB, patch)
2024-07-19 15:25 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 36758: Add trigger for assignee notification trigger (3.39 KB, patch)
2024-07-19 15:25 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 36758: (follow-up) Fix unit tests (1.68 KB, patch)
2024-08-12 09:17 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 Martin Renvoize (ashimema) 2024-05-02 14:20:58 UTC
We introduce the ability to assign tickets/concerns to users in bug 35657 but we don't trigger a notification for that assigned user.

We should add the option to send a notice to the new assignee when you are not assigning to yourself.
Comment 1 Martin Renvoize (ashimema) 2024-05-07 17:00:06 UTC
Created attachment 166316 [details] [review]
Bug 36758: Add TICKET_ASSIGNED notice

This patch adds a new default TICKET_ASSIGNED notice to be used with
catalog concerns to notice the assigned staff user when a ticket has
been assigned to them.

Test plan
1) Run the database update and confirm that the new notice has been
   added to the database (If on the sandboxes, skip to the next patch)
Comment 2 Martin Renvoize (ashimema) 2024-05-07 17:00:08 UTC
Created attachment 166317 [details] [review]
Bug 36758: Add librarian object

This patch adds a 'librarian' object fetch to
C4::Letters::GetPreparedLetter when a called passes the 'want_librarian'
flag.

This allows for the notice to take full advantage of the patron object
for that librarian rather than requireing old non-TT syntax for this
feature.

Test plan
1) We use the 'librarian' object in the new TICKET_ASSIGNED default
   notice, use the next patch to test that the librarian title is
   correctly substituted into the notice.
Comment 3 Martin Renvoize (ashimema) 2024-05-07 17:00:10 UTC
Created attachment 166318 [details] [review]
Bug 36758: Unit tests for assignee notification trigger

This patch adds unit tests for the TICKET_ASSIGNED trigger being
introduced with this patchset.

Test plan
1) Run the unit tests prior to the next patch and confirm they fail
2) Apply the next patch and confirm the unit tests now pass
Comment 4 Martin Renvoize (ashimema) 2024-05-07 17:00:13 UTC
Created attachment 166319 [details] [review]
Bug 36758: Add trigger for assignee notification trigger

This patch adds a new notice trigger to allow notifying assigned staff
that they have been assigned a new catalog concern to action.

Test plan
1) Enable catalog concerns (either via staff or opac interfaces)
2) Report a new concern (either via staff or opac interfaces)
3) As a staff user, assign the concern to another staff user
4) Check that the new 'TICKET_ASSIGNED' notice has be queued for that
   staff user.
5) Re-assign the catalog concern to yourself
6) Note that you do not see a 'TICKET_ASSIGNED@ notice queued as you
   self-assigned.
Comment 5 Martin Renvoize (ashimema) 2024-05-07 17:02:10 UTC
Note to RM.. I introduce a new feature to C4::Letters::GetPreparedLetter in here (see 'Add librarian object').  It's perhaps wise to split this into it's own bug, but it's simplest to test inline here.  Let me know if you'd like it split out as it will inevitably be very helpful in the transition to TT notices everywhere.
Comment 6 David Nind 2024-05-08 12:03:44 UTC
Created attachment 166390 [details] [review]
Bug 36758: Add TICKET_ASSIGNED notice

This patch adds a new default TICKET_ASSIGNED notice to be used with
catalog concerns to notice the assigned staff user when a ticket has
been assigned to them.

Test plan
1) Run the database update and confirm that the new notice has been
   added to the database (If on the sandboxes, skip to the next patch)

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2024-05-08 12:03:47 UTC
Created attachment 166391 [details] [review]
Bug 36758: Add librarian object

This patch adds a 'librarian' object fetch to
C4::Letters::GetPreparedLetter when a called passes the 'want_librarian'
flag.

This allows for the notice to take full advantage of the patron object
for that librarian rather than requireing old non-TT syntax for this
feature.

Test plan
1) We use the 'librarian' object in the new TICKET_ASSIGNED default
   notice, use the next patch to test that the librarian title is
   correctly substituted into the notice.

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 David Nind 2024-05-08 12:03:50 UTC
Created attachment 166392 [details] [review]
Bug 36758: Unit tests for assignee notification trigger

This patch adds unit tests for the TICKET_ASSIGNED trigger being
introduced with this patchset.

Test plan
1) Run the unit tests prior to the next patch and confirm they fail
2) Apply the next patch and confirm the unit tests now pass

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2024-05-08 12:03:53 UTC
Created attachment 166393 [details] [review]
Bug 36758: Add trigger for assignee notification trigger

This patch adds a new notice trigger to allow notifying assigned staff
that they have been assigned a new catalog concern to action.

Test plan
1) Enable catalog concerns (either via staff or opac interfaces)
2) Report a new concern (either via staff or opac interfaces)
3) As a staff user, assign the concern to another staff user
4) Check that the new 'TICKET_ASSIGNED' notice has be queued for that
   staff user.
5) Re-assign the catalog concern to yourself
6) Note that you do not see a 'TICKET_ASSIGNED@ notice queued as you
   self-assigned.

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 Kyle M Hall (khall) 2024-07-19 15:25:35 UTC
Created attachment 169238 [details] [review]
Bug 36758: Add TICKET_ASSIGNED notice

This patch adds a new default TICKET_ASSIGNED notice to be used with
catalog concerns to notice the assigned staff user when a ticket has
been assigned to them.

Test plan
1) Run the database update and confirm that the new notice has been
   added to the database (If on the sandboxes, skip to the next patch)

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Kyle M Hall (khall) 2024-07-19 15:25:50 UTC
Created attachment 169239 [details] [review]
Bug 36758: Add librarian object

This patch adds a 'librarian' object fetch to
C4::Letters::GetPreparedLetter when a called passes the 'want_librarian'
flag.

This allows for the notice to take full advantage of the patron object
for that librarian rather than requireing old non-TT syntax for this
feature.

Test plan
1) We use the 'librarian' object in the new TICKET_ASSIGNED default
   notice, use the next patch to test that the librarian title is
   correctly substituted into the notice.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 12 Kyle M Hall (khall) 2024-07-19 15:25:52 UTC
Created attachment 169240 [details] [review]
Bug 36758: Unit tests for assignee notification trigger

This patch adds unit tests for the TICKET_ASSIGNED trigger being
introduced with this patchset.

Test plan
1) Run the unit tests prior to the next patch and confirm they fail
2) Apply the next patch and confirm the unit tests now pass

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 13 Kyle M Hall (khall) 2024-07-19 15:25:53 UTC
Created attachment 169241 [details] [review]
Bug 36758: Add trigger for assignee notification trigger

This patch adds a new notice trigger to allow notifying assigned staff
that they have been assigned a new catalog concern to action.

Test plan
1) Enable catalog concerns (either via staff or opac interfaces)
2) Report a new concern (either via staff or opac interfaces)
3) As a staff user, assign the concern to another staff user
4) Check that the new 'TICKET_ASSIGNED' notice has be queued for that
   staff user.
5) Re-assign the catalog concern to yourself
6) Note that you do not see a 'TICKET_ASSIGNED@ notice queued as you
   self-assigned.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 14 Katrin Fischer 2024-08-09 15:46:31 UTC
I have fixed this typo:
[%- INCLUDE 'patron-title.inc' patron => libraian -%]

(In reply to Martin Renvoize from comment #5)
> Note to RM.. I introduce a new feature to C4::Letters::GetPreparedLetter in
> here (see 'Add librarian object').  It's perhaps wise to split this into
> it's own bug, but it's simplest to test inline here.  Let me know if you'd
> like it split out as it will inevitably be very helpful in the transition to
> TT notices everywhere.

I think if this is needed for backport, maybe we could do the separate bug then. Keeping it in this patch set for now.
Comment 15 Katrin Fischer 2024-08-09 16:49:12 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 16 Katrin Fischer 2024-08-09 18:51:20 UTC
I am sorry, but this is breaking the tests. I did 3 follow-up patches, please look at them as well. They should only be the normal DBRev, Tidy and a few typo fixes in docs and letter.
Comment 17 Martin Renvoize (ashimema) 2024-08-12 09:17:32 UTC
Created attachment 170226 [details] [review]
Bug 36758: (follow-up) Fix unit tests

We do two things here..

* We're making the improvement to C4::Letters that sets librarian to a
  patron object more resilient by testing for the userenv first.
* We correct the logic in Koha::Ticket such that we always store changes
  when there's a ticket update

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 18 Katrin Fischer 2024-08-12 11:59:59 UTC
Follow-up pushed to main, confirmed it fixes the tests locally. Fingers crossed!
Comment 19 Lucas Gass (lukeg) 2024-09-11 16:16:21 UTC
Enhancement will not be backported to 24.05.x