[Koha] Printing overdue letters

Mark Alexander marka at pobox.com
Sun Jan 5 14:27:31 NZDT 2020


My librarian has asked me to make Koha do something that doesn't sound
easy to me.  She'd like to be able to generate letters to each patron
having overdues more than N days (where N is a variable).  The letter
would be then be printed, stuffed into an envelope, and mailed with
the postal service.  I know that sounds old-fashioned, but she seems
to really want to do this instead of using Koha's ability to email
notices and messages.  I can understand this, knowing that in this part
of rural New England, many of our patrons are elderly and either don't
have email, or have it but don't want to give us their email
addresses.

I am not sure I can do this in a simple SQL report, which generates
a table, not a form letter.  So my next idea was to write
a report that outputs the needed information (patron name, address,
list of overdue books and their replacement price).  Then I'd
export the results of the report to a CSV file.  Then I'd
do a mail merge in Libre Office Writer (or Word, which the
librarian uses) using the data in the CSV file.

The generated letter might look like this:

  To: PATRON_ADDRESS

  Dear PATRON_NAME,

  You have the following overdue books:

     BOOK1_TITLE, BOOK1_PRICE
     BOOK2_TITLE, BOOK1_PRICE
     ...

  Thanks,
  Your library


I think this might work, except that I can't figure out how to get a
patron's list of overdue books into the generated letter.  The SQL
would need to produce a CSV file with a single row for each patron,
containing the patron name, address, and an arbitrarily long list of
overdue books.  I am not sure that is possible, but then, my SQL
skills are not so great.

Any help with this would be appreciated greatly.


More information about the Koha mailing list