Bug 27884 - Add HTML mail support for patron emailer script
Summary: Add HTML mail support for patron emailer script
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low trivial
Assignee: David Gustafsson
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-05 15:46 UTC by David Gustafsson
Modified: 2022-06-06 20:25 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.05,20.11.12
Circulation function:


Attachments
Bug 123123: Add html support for report mails (796 bytes, patch)
2021-03-05 15:48 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 123123: Add html support for report mails (1.39 KB, patch)
2021-03-08 17:59 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 123123: Add html support for report mails (1.43 KB, patch)
2021-03-08 18:00 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 123123: Add html support for report mails (1.47 KB, patch)
2021-03-29 04:17 UTC, Amit Gupta
Details | Diff | Splinter Review
Bug 27884: Add html support for report mails (1.42 KB, patch)
2021-09-15 13:33 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 27884: Add tests (3.02 KB, patch)
2021-09-15 13:33 UTC, David Gustafsson
Details | Diff | Splinter Review
Bug 27884: Add html support for report mails (1.47 KB, patch)
2021-10-06 02:26 UTC, David Nind
Details | Diff | Splinter Review
Bug 27884: Add tests (3.06 KB, patch)
2021-10-06 02:26 UTC, David Nind
Details | Diff | Splinter Review
Bug 27884: Add html support for report mails (1.53 KB, patch)
2021-11-01 17:19 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 27884: Add tests (3.13 KB, patch)
2021-11-01 17:19 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 David Gustafsson 2021-03-05 15:46:15 UTC
In bug 16149 patron_emailer.pl was added so reports can send mail to users. This mail is administered in the same way as other notice-templates (tools, notices and slips). When creating mail templates there is an option for plaintext or html mail. This setting is not respected for emails handled by patron_emailer.pl which this patch should fix.
Comment 1 David Gustafsson 2021-03-05 15:48:45 UTC
Created attachment 117869 [details] [review]
Bug 123123: Add html support for report mails
Comment 2 Michal Denar 2021-03-07 20:36:58 UTC
Hi David,any test plan?

Thank you.
Comment 3 David Gustafsson 2021-03-08 17:59:15 UTC Comment hidden (obsolete)
Comment 4 David Gustafsson 2021-03-08 18:00:43 UTC
Created attachment 117943 [details] [review]
Bug 123123: Add html support for report mails

To test:
1) Create a new notice, for example with Koha module "Patrons",
   name/code TEST and message body "<strong>testing<strong>".
2) Create a new sql report, the query could be someting like:
   SELECT "<number>" as `borrowernumber`, "to@example.com", as `email`, "from@example.com" as `from`;
   where "<number>" is a valid borrowernumber.
3) Run patron_emailer.pl --report=<id> --notice=TEST --module=members -commit
   where <id> is the report id.
4) Check the message_queue table that the content_type column has been
   set to text/html; charset="UTF-8".
5) Ideally process the message queue and veriy that the sent email is displayed
   as rendered html.
Comment 5 Amit Gupta 2021-03-29 04:17:08 UTC
Created attachment 118929 [details] [review]
Bug 123123: Add html support for report mails

To test:
1) Create a new notice, for example with Koha module "Patrons",
   name/code TEST and message body "<strong>testing<strong>".
2) Create a new sql report, the query could be someting like:
   SELECT "<number>" as `borrowernumber`, "to@example.com", as `email`, "from@example.com" as `from`;
   where "<number>" is a valid borrowernumber.
3) Run patron_emailer.pl --report=<id> --notice=TEST --module=members -commit
   where <id> is the report id.
4) Check the message_queue table that the content_type column has been
   set to text/html; charset="UTF-8".
5) Ideally process the message queue and veriy that the sent email is displayed
   as rendered html.
Comment 6 Joonas Kylmälä 2021-04-01 09:02:56 UTC
Looks good but an automated test is still needed for this in t/db_dependent/Reports/Guided.t
Comment 7 Joonas Kylmälä 2021-04-01 09:05:06 UTC
The bug number was also not right in the patch title.
Comment 8 David Gustafsson 2021-09-15 13:33:08 UTC
Created attachment 124890 [details] [review]
Bug 27884: Add html support for report mails

To test:
1) Create a new notice, for example with Koha module "Patrons",
   name/code TEST and message body "<strong>testing<strong>".
2) Create a new sql report, the query could be someting like:
   SELECT "<number>" as `borrowernumber`, "to@example.com", as `email`, "from@example.com" as `from`;
   where "<number>" is a valid borrowernumber.
3) Run patron_emailer.pl --report=<id> --notice=TEST --module=members -commit
   where <id> is the report id.
4) Check the message_queue table that the content_type column has been
   set to text/html; charset="UTF-8".
5) Ideally process the message queue and veriy that the sent email is displayed
   as rendered html.
6) Run tests in t/db_dependent/Reports/Guided.t
Comment 9 David Gustafsson 2021-09-15 13:33:12 UTC
Created attachment 124891 [details] [review]
Bug 27884: Add tests
Comment 10 David Nind 2021-10-06 02:26:06 UTC
Created attachment 125755 [details] [review]
Bug 27884: Add html support for report mails

To test:
1) Create a new notice, for example with Koha module "Patrons",
   name/code TEST and message body "<strong>testing<strong>".
2) Create a new sql report, the query could be someting like:
   SELECT "<number>" as `borrowernumber`, "to@example.com", as `email`, "from@example.com" as `from`;
   where "<number>" is a valid borrowernumber.
3) Run patron_emailer.pl --report=<id> --notice=TEST --module=members -commit
   where <id> is the report id.
4) Check the message_queue table that the content_type column has been
   set to text/html; charset="UTF-8".
5) Ideally process the message queue and veriy that the sent email is displayed
   as rendered html.
6) Run tests in t/db_dependent/Reports/Guided.t

Signed-off-by: David Nind <david@davidnind.com>
Comment 11 David Nind 2021-10-06 02:26:11 UTC
Created attachment 125756 [details] [review]
Bug 27884: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Comment 12 Martin Renvoize (ashimema) 2021-11-01 17:19:39 UTC
Created attachment 127184 [details] [review]
Bug 27884: Add html support for report mails

To test:
1) Create a new notice, for example with Koha module "Patrons",
   name/code TEST and message body "<strong>testing<strong>".
2) Create a new sql report, the query could be someting like:
   SELECT "<number>" as `borrowernumber`, "to@example.com", as `email`, "from@example.com" as `from`;
   where "<number>" is a valid borrowernumber.
3) Run patron_emailer.pl --report=<id> --notice=TEST --module=members -commit
   where <id> is the report id.
4) Check the message_queue table that the content_type column has been
   set to text/html; charset="UTF-8".
5) Ideally process the message queue and veriy that the sent email is displayed
   as rendered html.
6) Run tests in t/db_dependent/Reports/Guided.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 13 Martin Renvoize (ashimema) 2021-11-01 17:19:43 UTC
Created attachment 127185 [details] [review]
Bug 27884: Add tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 14 Martin Renvoize (ashimema) 2021-11-01 17:20:15 UTC
Trivial fix covered by tests.. works well..

Passing QA
Comment 15 Jonathan Druart 2021-11-02 15:53:02 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 16 Kyle M Hall (khall) 2021-11-05 15:55:12 UTC
Pushed to 21.05.x for 21.05.05
Comment 17 Fridolin Somers 2021-11-11 01:38:41 UTC
Pushed to 20.11.x for 20.11.12
Comment 18 Victor Grousset/tuxayo 2021-11-16 07:40:43 UTC
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.