Bug 30076: Add ability to check patron messaging preferences from a notice
authorKyle Hall <kyle@bywatersolutions.com>
Thu, 10 Feb 2022 17:19:22 +0000 (12:19 -0500)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 8 Apr 2022 13:49:16 +0000 (15:49 +0200)
commitf507b685be89fdfaff2dc7048ab7e024f80abe64
tree9f1aa10af71b41f73d346c2b02e0efa5b8527adf
parentac0f648b350f802585c69a9c4fde25b83098fabf
Bug 30076: Add ability to check patron messaging preferences from a notice

Some libraries want to be able to use a patron's messaging preferences to conditionally change the contents of a notice depending on the patron's other messaging preference. For example, a library has requested to have the note on the hold slip if the patron has requested phone messages for waiting holds. This really only entails adding a method to the Koha::Patron class to allow this type of looking.

Test plan:
1) Apply this patch
2) Enable item checkout notices for a patron for email, but not sms
3) Include the following in the notice:
   TEST1: [% borrower.has_messaging_preference({ message_name => 'Item_Checkout', message_transport_type => 'email' }) %]
   <br/>
   TEST2: [% borrower.has_messaging_preference({ message_name => 'Item_Checkout', message_transport_type => 'sms' }) %]
4) Generate a checkout and notice for that patron
5) Note the generated notice has a 1 for TEST1, but not for TEST2

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Patron.pm
t/db_dependent/Patron/Messaging.t [new file with mode: 0755]