A LibLime customer wants to be able to send emails or SMS messages to a patron whenever the patron checks out or returns an item.
The proposed feature would include the following elements
This will build upon the existing C4::Letters infrastructure.
Initial author: Daniel Sweeney (daniel dot sweeney at liblime dot com)
This specification adds a new feature to Koha that sends a list of items to patrons when several events take place:
Patrons will be able to choose how the alerts are delivered, and to opt out of the checkout and return notices individually as part of maintaining their patron record.
Administrators will be able to define which patrons are alerted by patron category, and which item types will be allowed in the alert. Each branch will be able to set its own policies for notifications.
The concept is that these notices are sent electronically—by email or SMS. It will likely be overkill to send a notice by postal mail for every checkout and return.
Koha will attempt to group together multiple items into a single message if a patron charges or returns multiple items during a single session, while still trying to deliver the message relatively quickly.
Koha includes a configurable notice system in the “Tools” area, so it’s possible for the library to add a new notice type that will be sent to patrons at any time. The notice can include a variety of information about a patron’s charged items, as well as message text. Each notice form is identified by a code that can be up to 10 letters long. The actual notice templates are stored in the ‘letters’ table.
Koha includes notice and status triggers—these are established branch-by-branch, with and are driven by overdue status on items. The queued notifications are stored in the ‘notifys’ table. These are not really relevant to this project.
Koha also includes letters and alerts, stored in the ‘letters’ and ‘alerts’ tables. Alerts are used for things like serial issue and virtual shelf alerts. We could extend this system with new alerts for item checkout and return.
Koha will have the following new types of alert:
Since the actual messages are processed and sent using a batch job running on the server, and interacting directly with the database, there are no Koha-side privileges to add or check.
The “Delivery Mechanisms” area in Administration will be controlled using a single yes/no privilege—if administrators lack this privilege they will be unable to enter this area. That being said, since Delivery Mechanisms are branch-specific, administrator’s branch affiliations will also allow or prevent them from editing Delivery Mechanisms for specific branches.
Circulation staff may edit patron’s delivery mechanisms if they have sufficient privileges to edit the patron itself—there is no specific permission controlling the alert delivery mechanisms.
Alerts and notices may be sent in several different ways—not just email. In particular libraries want to be able to add SMS messaging and RSS feeds.
This project adds a fair amount of infrastructure for delivery mechanisms—other alerts and notices should really be back-patched into this infrastructure. The big difference comes with RSS feeds—they work a little bit differently than emails or SMS because the client pulls them from the server, rather than the server pushing them out. RSS is such a key future feature that we need to be sure the infrastructure is set up to support them, possibly alongside a push-based messaging system.
There are really two approaches to the implementation of this feature—one is to store messages in a queue as they are generated and then process the queue; the other is to have a process that analyzes the contents of the transaction tables and generates a messages based on changes since a certain point. The first approach is simple, but does not lend itself well to pull-based reports like RSS feeds. Also, once the queue is processed, the information is lost—it’s not possible to run the job again if necessary. The second approach is more complicated but allows for recovery. Either or both approaches may be used in practice or for different jobs.
Alerts on returns may be gold-plating. It may be a good feature to remind patrons that they’ve got overdues, and also if they drop books in a book drop while the library is closed—the alert would tell them that someone actually checked the book in.
This project does not include a feature that sends a list of charged items to a patron on a schedule. This is a desirable enhancement, but doesn’t really mesh with this project because it is triggered on a schedule by the library, not by an event like a loan or return.
Running batch jobs on the server, or using cron, is straightforward for system administrators that control the server, but for installations that have limited access, for instance sites that are hosted at commercial web hosting providers, this may be a problem.
It’s a good idea to let patrons decide what types of alerts they receive at a more granular level than the yes/no flag above. For instance, patrons should really be able to decide whether they want alerts for items with particular item types. The problem is that patrons are unaware of the actual item types in the system, so it’s hard to present this information to them. One possible approach would be to map item types to “transaction types” based on the circulation policies in effect—any item types that have circ policies less than a day would be treated as “hourly loans” and any item types that have circ policies more than a day would be treated as “long-term loans.” Alternately, we could list out the possible circulation periods for all item types in the system and let patrons choose.
A more robust unsubscribe link might be a good idea—it’s a little tricky because there are actually several options the patron might want to edit, so it makes some sense to just direct them to the patron page.
In a multi-branch library, it’s easy to wind up with a lot of policy permutations. It’s unreasonable to expect patrons to manage their settings for each branch, so we proved a simple set of delivery mechanisms that apply to all branches.
It may be desirable to provide email verification, to ensure that a patron’s email address works and is valid before sending messages—patrons can supply email addresses to the system that may be incorrect or malicious.
For now, providing RSS feeds as a delivery mechanism is future functionality. It’s possible that delivery mechanisms could be implemented using a plug-in system, but this is also future