<<

NAME

C4::Members::Messaging - manage patron messaging preferences

SYNOPSIS

  use C4::Members::Messaging

DESCRIPTION

This module lets you modify a patron's messaging preferences.

FUNCTIONS

GetMessagingPreferences

  my $preferences = C4::Members::Messaging::GetMessagingPreferences( { borrowernumber => $borrower->{'borrowernumber'},
                                                                       message_name   => 'Item_Due ' } );

  my $preferences = C4::Members::Messaging::GetMessagingPreferences( { categorycode => 'LIBRARY',
                                                                       message_name   => 'Item_Due ' } );

returns: a hashref of messaging preferences for a borrower or patron category for a particlar message_name

Requires either a borrowernumber or a categorycode key, but not both.

message_name argument is a message attribute name.

SetMessagingPreference

This method defines how a user (or a default for a patron category) wants to get a certain message delivered. The list of valid message types can be delivered can be found in the message_attributes table, and the list of valid message transports can be found in the message_transport_types table.

  C4::Members::Messaging::SetMessagingPreference( { borrowernumber          => $borrower->{'borrowernumber'}
                                                    message_attribute_id    => $message_attribute_id,
                                                    message_transport_types => [ qw( email sms ) ],
                                                    days_in_advance         => 5
                                                    wants_digest            => 1 } )

returns nothing useful.

GetMessagingOptions

  my $messaging_options = C4::Members::Messaging::GetMessagingOptions()

returns a hashref of messaging options available.

SetMessagingPreferencesFromDefaults

  C4::Members::Messaging::SetMessagingPreferencesFromDefaults( { borrowernumber => $borrower->{'borrowernumber'}
                                                                categorycode   => 'CPL' } );

Given a borrowernumber and a patron category code (from the borrowernumber and categorycode keys in the parameter hashref), replace all of the patron's current messaging preferences with whatever defaults are defined for the patron category.

TABLES

message_queue

The actual messages which will be sent via a cron job running misc/cronjobs/process_message_queue.pl.

message_attributes

What kinds of messages can be sent?

message_transport_types

What transports can messages be sent vith? (email, sms, etc.)

message_transports

How are message_attributes and message_transport_types correlated?

borrower_message_preferences

What messages do the borrowers want to receive?

borrower_message_transport_preferences

What transport should a message be sent with?

CONFIG

Adding a New Kind of Message to the System

  1. Add a new template to the `letter` table.
  2. Insert a row into the `message_attributes` table.
  3. Insert rows into `message_transports` for each message_transport_type.

SEE ALSO

C4::Letters

AUTHOR

Koha Development Team <http://koha-community.org/>

Andrew Moore <andrew.moore@liblime.com>

<<