| Summary: | runreport.pl cronjob should optionally send an email when the report has no results | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
| Component: | Command-line Utilities | Assignee: | Bugs List <koha-bugs> |
| Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | caroline.cyr-la-rose, david, fridolin.somers, pedro.amorim, robin, victor |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Caroline Cyr La Rose | Documentation submission: | https://gitlab.com/koha-community/koha-manual/-/merge_requests/795 |
| Text to go in the release notes: |
This enhancement adds a new 'send_empty' option to runreport.pl. Currently, if there are no results for a report, then no email is sent. This option lets libraries know that a report was run overnight and that it had no results. Example: perl misc/cronjobs/runreport.pl 1 --send_empty --email
|
Version(s) released in: |
23.11.00,23.05.06
|
| Circulation function: | |||
| Attachments: |
Bug 35171: Add send_empty option to runreport
Bug 35171: Add send_empty option to runreport Bug 35171: Add send_empty option to runreport Bug 35171: (QA follow-up): tidy up POD |
||
|
Description
Nick Clemens (kidclamp)
2023-10-26 18:03:15 UTC
Created attachment 157944 [details] [review] Bug 35171: Add send_empty option to runreport This patch adds a new 'send_empty' option to runreport.pl To test: 1 - Create a report in Koha that will not return any results: SELECT barcode FROM items WHERE 1=2 2 - perl misc/cronjobs/runreport.pl 1 3 - Output is: NO OUTPUT: 0 results from execute_query 4 - perl misc/cronjobs/runreport.pl 1 --send_empty 5 - Output is: no results were returned for the report 6 - perl misc/cronjobs/runreport.pl 1 --send_empty --email 7 - It will die on an email error unless you have SMTP configured - this si good, it means we sent an email 8 - Bonus points: Test on a system that can correctly send emails, confirm it works :-) Created attachment 158016 [details] [review] Bug 35171: Add send_empty option to runreport This patch adds a new 'send_empty' option to runreport.pl To test: 1 - Create a report in Koha that will not return any results: SELECT barcode FROM items WHERE 1=2 2 - perl misc/cronjobs/runreport.pl 1 3 - Output is: NO OUTPUT: 0 results from execute_query 4 - perl misc/cronjobs/runreport.pl 1 --send_empty 5 - Output is: no results were returned for the report 6 - perl misc/cronjobs/runreport.pl 1 --send_empty --email 7 - It will die on an email error unless you have SMTP configured - this si good, it means we sent an email 8 - Bonus points: Test on a system that can correctly send emails, confirm it works :-) Signed-off-by: David Nind <david@davidnind.com> Testing notes (using KTD):
1. I tested using email, and the email message was received
1. To test sending emails using a Google account, set up an APP password for your Google account, edit /etc/koha/sites/kohadev/koha-conf.xml file and add this configuration near the end (where <user_name> = your Google email address; <password> = your APP password, not your Google account password):
<smtp_server>
<host>smtp.gmail.com</host>
<port>587</port>
<timeout>5</timeout>
<ssl_mode>STARTTLS</ssl_mode>
<user_name>GOOGLEACCOUNTUSER</user_name>
<password>GOOGLEAPPPASSWORD</password>
<debug>1</debug>
</smtp_server>
2. Change the KohaAdminEmailAddress system preference to a valid email address that you have access to.
3. Run flush_memcached and restart_all
Created attachment 158102 [details] [review] Bug 35171: Add send_empty option to runreport This patch adds a new 'send_empty' option to runreport.pl To test: 1 - Create a report in Koha that will not return any results: SELECT barcode FROM items WHERE 1=2 2 - perl misc/cronjobs/runreport.pl 1 3 - Output is: NO OUTPUT: 0 results from execute_query 4 - perl misc/cronjobs/runreport.pl 1 --send_empty 5 - Output is: no results were returned for the report 6 - perl misc/cronjobs/runreport.pl 1 --send_empty --email 7 - It will die on an email error unless you have SMTP configured - this si good, it means we sent an email 8 - Bonus points: Test on a system that can correctly send emails, confirm it works :-) Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Created attachment 158103 [details] [review] Bug 35171: (QA follow-up): tidy up POD Thanks David for the complete test :) Works, makes sense, QA script happy, code looks good, passing QA :) Pushed to master for 23.11. Nice work everyone, thanks! Pushed to 23.05.x for 23.05.06 |