<<

NAME

advance_notices.pl - prepare messages to be sent to patrons for nearly due, or due, items

SYNOPSIS

       advance_notices.pl
         [ -n ][ -m <number of days> ][ --itemscontent <comma separated field list> ][ -c ]

DESCRIPTION

This script prepares pre-due and item due reminders to be sent to patrons. It queues them in the message queue, which is processed by the process_message_queue.pl cronjob. The type and timing of the messages can be configured by the patrons in their "My Alerts" tab in the OPAC.

OPTIONS

--help

Print a brief help message and exits.

--man

Prints the manual page and exits.

-v

Verbose. Without this flag set, only fatal errors are reported.

-n

Do not send any email. Advanced or due notices that would have been sent to the patrons are printed to standard out.

-m

Defines the maximum number of days in advance to send advance notices.

-c

Confirm flag: Add this option. The script will only print a usage statement otherwise.

--itemscontent

comma separated list of fields that get substituted into templates in places of the <<items.content>> placeholder. This defaults to date_due,title,author,barcode

Other possible values come from fields in the biblios, items and issues tables.

--digest-per-branch

Flag to indicate that generation of message digests should be performed separately for each branch.

A patron could potentially have loans at several different branches There is no natural branch to set as the sender on the aggregated message in this situation so the default behavior is to use the borrowers home branch. This could surprise to the borrower when message sender is a library where they have not borrowed anything.

Enabling this flag ensures that the issuing library is the sender of the digested message. It has no effect unless the borrower has chosen 'Digests only' on the advance messages.

--library

select notices for one specific library. Use the value in the branches.branchcode table. This option can be repeated in order to select notices for a group of libraries.

--frombranch

Set the from address for the notice to one of 'item-homebranch' or 'item-issuebranch'.

Defaults to 'item-issuebranch'

Configuration

This script pays attention to the advanced notice configuration performed by borrowers in the OPAC, or by staff in the patron detail page of the intranet. The content of the messages is configured in Tools -> Notices and slips. Advanced notices use the PREDUE template, due notices use DUE. More information about the use of this section of Koha is available in the Koha manual.

Outgoing emails

Typically, messages are prepared for each patron with due items, and who have selected (or the library has elected for them) Advance or Due notices.

These emails are staged in the outgoing message queue, as are messages produced by other features of Koha. This message queue must be processed regularly by the misc/cronjobs/process_message_queue.pl program.

In the event that the -n flag is passed to this program, no emails are sent. Instead, messages are sent on standard output from this program. They may be redirected to a file if desired.

Templates

Templates can contain variables enclosed in double angle brackets like <<this>>. Those variables will be replaced with values specific to the overdue items or relevant patron. Available variables are:

<<items.content>>

one line for each item, each line containing a tab separated list of date due, title, author, barcode

<<borrowers.*>>

any field from the borrowers table

<<branches.*>>

any field from the branches table

SEE ALSO

The misc/cronjobs/overdue_notices.pl program allows you to send messages to patrons when their messages are overdue.

METHODS

parse_letter

get_branch_info

send_digests

    send_digests({
        digests => ...,
        sth => ...,
        letter_code => ...,
        get_item_info => ...,
    })

Enqueue digested letters (or print them if -n was passed at command line).

Parameters:

$digests

Reference to the array of digested messages.

$sth

Prepared statement handle for fetching overdue issues.

$letter_code

String that denote the letter code.

$get_item_info

Subroutine for executing prepared statement. Takes parameters $sth, $borrowernumber and $borrower_parameters and return a generator function that produce the matching rows.

<<