Summary: | Run report should have an option to only send the attachment | ||
---|---|---|---|
Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
Component: | Command-line Utilities | Assignee: | Nick Clemens (kidclamp) <nick> |
Status: | Failed QA --- | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, robin |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Attachments: |
Bug 36504: Add attach_only option to run report
Bug 36504: Add a test-email option |
Description
Nick Clemens (kidclamp)
2024-04-03 15:33:10 UTC
Created attachment 164385 [details] [review] Bug 36504: Add attach_only option to run report To test: 1 - Create a report in Koha 2 - Have koha setup to send emails 3 - perl misc/cronjobs/runreport.pl --to="example@example.org" --subject="Report cronjob" --format=csv --csv-header -a 1 4 - Note the email body and attachment contain the results 5 - Apply this patch 6 - Repeat above 7 - Note the email body says "Repost results attached" 8 - Confirm results attached 9 - Adjust report to have 0 results 10 - perl misc/cronjobs/runreport.pl --to="example@example.org" --subject="Report cronjob" --format=csv --csv-header -a 1 --send_empty 11 - Confirm the attachment exists, but message body indicates no results Created attachment 164386 [details] [review] Bug 36504: Add a test-email option This is not necessarily for pushing, but makes testing first patch easier as it doesn't require setting up email. Apply this patch, and add --test-email when runnign the script. The email object will be dumped to the screen and you can verofy the content of the body/attachment I only used the first patch, and set up KTD to use email [1]. Using the new -ao option when the report has results: no message in the body, attachment is called 'noname' (using just -a is called 'report1-YYYY-MM-DD.csv') Using the new -ao option when the report has no results: "No results were returned for the report" in the body and the attachment called 'report1-YYYY-MM-DD.csv'. So, I think this isn't working as intended when the report has results - there should be a message in the body ("Report results attached") and the report attached should be correctly named. Full details ============ After applying the patch, if I use the -ao (or --attach_only) option: 1. The email body is empty. 2. The attached file is called 'noname'. 3. Using just -a (before and after the patch is applied), the attachment is called 'report1-YYYY-MM-DD.csv'. 4. If the report is empty (using -a or -ao) I get a message with "No results were returned for the report" in the body and the attachment called 'report1-YYYY-MM-DD.csv'. [1] To test sending emails using a Google account: 1. Set up an App password for your Google Account 2. 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> I tested again, I couldn't get email working but the dumped email looks correct to me, could you test again? And maybe send the emails to my email so I see the problem ;-) (In reply to David Nind from comment #3) > Using the new -ao option when the report has results: no message in the > body, attachment is called 'noname' (using just -a is called > 'report1-YYYY-MM-DD.csv') Confirmed. > Using the new -ao option when the report has no results: "No results were > returned for the report" in the body and the attachment called > 'report1-YYYY-MM-DD.csv'. In my test the screen output is "NO OUTPUT: 0 results from execute_query" and there is no email. |