Message transport types

From Koha Wiki
Jump to navigation Jump to search

Introduction

Currently one cannot define separate templates for different message delivery methods. There is only one default template, which is mainly used for email. This is problematic since some patrons don't have an email, or sms, or a print address. How do you contact such patrons? It is not smart to send email via sms, nor sms via printed letters.
Solution

Make it possible to define a template for each message transport type (email, sms, print, ...) in use for each letter. So our users can flexibly change the desired delivery method, and get meaningful messages delivered. It also enables librarians to claim overdues more flexibly, and with a larger impact.

This upgrade is done seamlessly by updating all existing letters under the email transport type, except the following:

the HOLD_PRINT and HOLD_PHONE (bug 10845) are moved under HOLD-letter.
PREDUE_PHONE and OVERDUE_PHONE (bug 11867) are moved under PREDUE- and OVERDUE-letters.

Technical implementation

Database changes

- adds a new column letter.message_transport_type
- adds a new table overduerules_transport_types : association table
between overduerules and message_transport_types.
- modifies the primary key for the letter table (become module, code,
branchcode, message_transport_type)

A new updatedatabase entry changes the DB structures changes and set all
the letter.message_transport_type to 'email'. The email type is the
default type everywhere in the code.

Letter code modifications overview

Reservations (bug 10845): HOLD => C4::Reserves::_koha_notify_reserve()
Advance notices (bug 10833): PREDUE => misc/cronjobs/advance_notices.pl
Checkin/out (bug 9016): CHECKIN/CHECKOUT => C4::Circulation::SendCirculationAlert()
Item due (bug 10833): DUE => misc/cronjobs/advance_notices.pl
Item overdues (bug 10832): ODUE => misc/cronjobs/overdue_notices.pl

Git patches:

http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9016
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10832
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10833
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10845
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11867

Bugfixes:

http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11208 (in main)
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11868

Instructions

Adding a letter template for a message transport type (MTT)

1. Navigate to Tools -> Notices & slips
2. Add a "New notice" or click "edit" on an existing one
2.1. You can find an empty template for each MTT, except the email which is the original letter.
2.2. Ignore the "HTML message"-checkbox unless otherwise instructed in some other instructable.
3. Fill a template as you would the letters before this feature.

Configuring overdue notifications

1. Navigate to Tools -> Overdue notice/status triggers
2. You will find the message transport types (MTT) as checkboxes.
2.1. You can select any combination of MTT letters to send when the defined delay in days has been reached. This feature sends one letter for each activated MTT. If the Patron doesn't have the contact information defined (email, smsalertnumber, ...) no letter can be sent via that MTT. If no letters can be delivered, the feature defaults to the print notification.

Message generation decision table
SMS EMAIL PRINT smsalertnumber email address
defined? generated? defined? generated? defined? generated?
x
ok ok
no no by default
x
ok ok
no no by default
x
ok ok
no ok
x
x
ok ok ok ok
no no ok ok
no no no no by default
x
x
ok ok ok ok
no no ok ok
no no no ok
ok ok no ok
x
x
x
ok ok ok ok ok ok
no no ok ok ok ok
no no no no ok ok
no no no no no ok
ok ok no no ok ok
ok ok no no no ok
no no ok ok no ok


Adding/removing message_transport_types

Currently one can only modify the available transport types for overdue rules / notice triggers.
For example:

INSERT INTO message_transport_types VALUES ('airplane');

This will add the transport type message for the tools/overduerules.pl and tools/letter.pl