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.
Created attachment 117869 [details] [review] Bug 123123: Add html support for report mails
Hi David,any test plan? Thank you.
Created attachment 117942 [details] [review] Bug 123123: Add html support for report mails To test: 1) Create a new notice, for example with Koha module "Patrons" and name/code TEST 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.
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.
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.
Looks good but an automated test is still needed for this in t/db_dependent/Reports/Guided.t
The bug number was also not right in the patch title.
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
Created attachment 124891 [details] [review] Bug 27884: Add tests
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>
Created attachment 125756 [details] [review] Bug 27884: Add tests Signed-off-by: David Nind <david@davidnind.com>
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>
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>
Trivial fix covered by tests.. works well.. Passing QA
Pushed to master for 21.11, thanks to everybody involved!
Pushed to 21.05.x for 21.05.05
Pushed to 20.11.x for 20.11.12
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.