Bug 32548

Summary: Make illrequestattributes easily available to ILL notices
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: ILLAssignee: Katrin Fischer <katrin.fischer>
Status: Needs documenting --- QA Contact: Nick Clemens (kidclamp) <nick>
Severity: enhancement    
Priority: P5 - low CC: matt.blenkinsop, michaela.sieber, nick, pedro.amorim, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00
Attachments: Bug 32548: Make illrequestattributes available in ILL emails
Bug 32548: Add tests
Bug 32548: Replace while with map
Bug 32548: Make illrequestattributes available in ILL emails
Bug 32548: Add tests
Bug 32548: Replace while with map
Bug 32548: Make illrequestattributes available in ILL emails
Bug 32548: Add tests
Bug 32548: Replace while with map

Description Katrin Fischer 2022-12-29 15:02:35 UTC
Often the most interesting information about the title, like article_title is only available in illrequestattributes. It would be super nice if we had these available with a nice syntax in the ILL notices.
Comment 1 Katrin Fischer 2023-02-22 14:07:47 UTC
Created attachment 147157 [details] [review]
Bug 32548: Make illrequestattributes available in ILL emails

Without this ILL module only provides very limited data to
be included in the notices sent about the request itself.

We have the columns illrequests, but not the illrequestattributes,
that often will contain the more useful information needed.

This patch enables to use values of the illrequestattributs using
[% illrequestattributes.<attributname> %] in the notices.

To test:
* Apply patch
* First you'll need to activate the ILL module and install a
  backend to use it with. FreeForm was used for this test plan,
  BLDSS is usually also good for testing.
  See: https://wiki.koha-community.org/wiki/ILL_backends
* Also set up an SMTP server to use for notices and make
  sure the email address is set in KohaAdminEmailAddress
  and the user you are using for testing this with.
* Make sure your user has an email address and will receive
  ILL notices by seleting them in the messaging preferences.
* Create an ILL request with the FreeForm backend for your user.
* On the ILL request detail page: "Display supplier metadata"
  Pick some attributes you want to use in the notice
* Go to Tools > Notices and slips and edit ILL_REQUEST_UNAVAIL
* Add some of the attributes you picked. Example:
  [% illrequestattributes.type %]
  [% illrequestattributes.title %]
* Back to the ILL request detail page: Send notice to patron >
  ILL request unavailable
* Go to your patron's account and check the notices tab
* The generated notice shoudl show and include the information
  from the illrequestattributes you picked.
Comment 2 Katrin Fischer 2023-02-22 14:10:19 UTC
I am setting NSO, because this is testable as is, but since I am changing a method in Koha namespace... would someone be able to collaborate with me on writing the unit tests for this one?

Existing tests for get_notice are in t/db_dependent/Illrequests.t

They still pass with the patch applied.
Comment 3 Jonathan Druart 2023-03-31 12:12:23 UTC
Created attachment 149034 [details] [review]
Bug 32548: Add tests
Comment 4 Jonathan Druart 2023-03-31 12:12:28 UTC
Created attachment 149035 [details] [review]
Bug 32548: Replace while with map
Comment 5 Pedro Amorim 2023-04-01 18:12:23 UTC
Created attachment 149064 [details] [review]
Bug 32548: Make illrequestattributes available in ILL emails

Without this ILL module only provides very limited data to
be included in the notices sent about the request itself.

We have the columns illrequests, but not the illrequestattributes,
that often will contain the more useful information needed.

This patch enables to use values of the illrequestattributs using
[% illrequestattributes.<attributname> %] in the notices.

To test:
* Apply patch
* First you'll need to activate the ILL module and install a
  backend to use it with. FreeForm was used for this test plan,
  BLDSS is usually also good for testing.
  See: https://wiki.koha-community.org/wiki/ILL_backends
* Also set up an SMTP server to use for notices and make
  sure the email address is set in KohaAdminEmailAddress
  and the user you are using for testing this with.
* Make sure your user has an email address and will receive
  ILL notices by seleting them in the messaging preferences.
* Create an ILL request with the FreeForm backend for your user.
* On the ILL request detail page: "Display supplier metadata"
  Pick some attributes you want to use in the notice
* Go to Tools > Notices and slips and edit ILL_REQUEST_UNAVAIL
* Add some of the attributes you picked. Example:
  [% illrequestattributes.type %]
  [% illrequestattributes.title %]
* Back to the ILL request detail page: Send notice to patron >
  ILL request unavailable
* Go to your patron's account and check the notices tab
* The generated notice shoudl show and include the information
  from the illrequestattributes you picked.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 6 Pedro Amorim 2023-04-01 18:12:25 UTC
Created attachment 149065 [details] [review]
Bug 32548: Add tests

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 7 Pedro Amorim 2023-04-01 18:12:28 UTC
Created attachment 149066 [details] [review]
Bug 32548: Replace while with map

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 8 Pedro Amorim 2023-04-01 18:13:34 UTC
I think this needs to be properly documented, or included in the fields list somehow, or maybe a note mentioning this in the UI? I have no idea.
Comment 9 Katrin Fischer 2023-04-15 23:56:05 UTC
(In reply to Pedro Amorim from comment #8)
> I think this needs to be properly documented, or included in the fields list
> somehow, or maybe a note mentioning this in the UI? I have no idea.

I'll be happy to add it to the wiki where we keep hints on the TT notices right now. I just added some first notes on ILL notices:
https://wiki.koha-community.org/wiki/Notices_with_Template_Toolkit (table at the bottom)
Comment 10 Nick Clemens (kidclamp) 2023-04-28 17:09:36 UTC
Created attachment 150400 [details] [review]
Bug 32548: Make illrequestattributes available in ILL emails

Without this ILL module only provides very limited data to
be included in the notices sent about the request itself.

We have the columns illrequests, but not the illrequestattributes,
that often will contain the more useful information needed.

This patch enables to use values of the illrequestattributs using
[% illrequestattributes.<attributname> %] in the notices.

To test:
* Apply patch
* First you'll need to activate the ILL module and install a
  backend to use it with. FreeForm was used for this test plan,
  BLDSS is usually also good for testing.
  See: https://wiki.koha-community.org/wiki/ILL_backends
* Also set up an SMTP server to use for notices and make
  sure the email address is set in KohaAdminEmailAddress
  and the user you are using for testing this with.
* Make sure your user has an email address and will receive
  ILL notices by seleting them in the messaging preferences.
* Create an ILL request with the FreeForm backend for your user.
* On the ILL request detail page: "Display supplier metadata"
  Pick some attributes you want to use in the notice
* Go to Tools > Notices and slips and edit ILL_REQUEST_UNAVAIL
* Add some of the attributes you picked. Example:
  [% illrequestattributes.type %]
  [% illrequestattributes.title %]
* Back to the ILL request detail page: Send notice to patron >
  ILL request unavailable
* Go to your patron's account and check the notices tab
* The generated notice shoudl show and include the information
  from the illrequestattributes you picked.

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Nick Clemens (kidclamp) 2023-04-28 17:09:38 UTC
Created attachment 150401 [details] [review]
Bug 32548: Add tests

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 12 Nick Clemens (kidclamp) 2023-04-28 17:09:40 UTC
Created attachment 150402 [details] [review]
Bug 32548: Replace while with map

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 13 Nick Clemens (kidclamp) 2023-04-28 17:10:38 UTC
Just to be pedantic, it is possible to use these before these patches, but it is inconvenient:

[% FOREACH attribute IN illrequest.illrequestattributes %]
  [% IF attribute.type == 'title' %]
    [% attribute.value %]
  [% END %]
[% END %]
Comment 14 Katrin Fischer 2023-04-29 11:03:08 UTC
(In reply to Nick Clemens from comment #13)
> Just to be pedantic, it is possible to use these before these patches, but
> it is inconvenient:
> 
> [% FOREACH attribute IN illrequest.illrequestattributes %]
>   [% IF attribute.type == 'title' %]
>     [% attribute.value %]
>   [% END %]
> [% END %]

Thank you, Nick :)
Comment 15 Tomás Cohen Arazi 2023-05-09 14:47:49 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 16 Matt Blenkinsop 2023-05-15 12:13:30 UTC
Enhancement - not backporting to 22.11.x