Monday Minutes: Emailing Customized Patron Notices
In 19.05 Koha got a new enhancement that allows staff to generate and send custom notices based on report output! This enhancement was derived from bug 16149. This is a great way to create multiple notices for different situations to notify your patrons!
To accomplish this you will need to create a notice, a report to grab the information for the notice and then run a cronjob to send the notice (ByWater will handle that cronjob for our supported libraries).
Adding a Report
Let's create the report. Keep in mind, only columns in report are available for the sent notice.
In our example in the video our report runs the following SQL statement.
Title: Patrons who Owe a lot of Money
SELECT borrowernumber, coalesce(email,emailpro, B_email) as 'email', firstname, surname, round (sum(amountoutstanding),2) as total_fines
FROM borrowers LEFT JOIN accountlines using (borrowernumber)
GROUP BY borrowernumber
Reminder: All reports for this function need to include an emailaddress, borrowernumber and from field. Remember to also note the number of the report you created for the cronjob.
Add the Notice
Now that you have the data from the report that you want to email to your patrons, let's create a notice.
- Go to Tools › Notices & slips.
- Click on + New notice dropdown.
- Select the module you want to add the notice to ( remember this information for the cronjob).
- Create a code for the notice (all caps and under 10 characters as a rule of thumb). You will also need this code for the cronjob.
- Add a name for the notice.
- Add a message subject.
- Add in your message body (we use the template toolkit syntax in the example in our video).
- Click save.
Example from video:
Dear [% firstname %] [% surname %].
You owe us $[% total_fines %].
Please pay up.
Thank you so much!!
Setting Up the Cronjob
Once you have created the notice and set up the report, it's time to set up the cronjob. If ByWater Solutions is your support company, please just submit a ticket indicating set up for the cron job. You will want to include the 3 following items:
- The code of the notice (Tools - Notices and Slips)
- The module of the notice (Tools - Notices and Slips)
- The report number (Reports Module)
Also indicated when you want this run, daily, weekly, monthly, etc or a specific date and time.
example: Every Monday at 8:00am PST
Here is an example of the cronjob that will be run:
perl misc/cronjobs/patron_emailer.pl --report 48 --notice BIGFINE --module circulation --from email@example.com --commit
Read more by Jessie Zairo