From f44c0fd9994db0af8a1145dcda823fb71eae98cd Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 15 Apr 2021 13:26:55 +0000 Subject: [PATCH] Bug 28153: Add 'Hold reminder' messaging preference This adds a new preference for patrons to choose how they wish to receive 'Hold reminder' notices. The notice is always digested per branch To test: 1 - Apply patches 2 - Update database 3 - Ensure EnhancedMessagingPreferences and EnhancedMessagingPreferencesOPAC are enabled 4 - View a patron and note new messaging preference 5 - Confirm same on the opac for a patron account 6 - All transports should be disabled by default 7 - Place a hold for the patron and check it in to confirm 8 - Run hold reminder script perl misc/cronjobs/holds_reminder.pl -v -c 9 - No message should be queued for patron 10 - Enable the message in a transport for which 'HOLD_REMINDER' notice has content for the patron 11 - Run the script 12 - Patron should have a message queued 13 - Ensure a different transport has content for the notice 14 - Run the script forcing a transport perl misc/cronjobs/holds_reminder.pl -v -c -mtt=print 15 - The patron should have a message queued in the forced transport Signed-off-by: Andrew Fuerste-Henry --- ...28153_add_holdreminder_notice_preference.perl | 16 ++++++++++++++++ .../en/includes/messaging-preference-form.inc | 1 + .../bootstrap/en/modules/opac-messaging.tt | 1 + misc/cronjobs/holds/holds_reminder.pl | 6 +++--- 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_28153_add_holdreminder_notice_preference.perl diff --git a/installer/data/mysql/atomicupdate/bug_28153_add_holdreminder_notice_preference.perl b/installer/data/mysql/atomicupdate/bug_28153_add_holdreminder_notice_preference.perl new file mode 100644 index 0000000000..8fd4aa7cf8 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_28153_add_holdreminder_notice_preference.perl @@ -0,0 +1,16 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO `message_attributes` + (`message_attribute_id`, message_name, `takes_days`) + VALUES (10, 'Hold_Reminder', 0) + }); + $dbh->do( q{ + INSERT IGNORE INTO `message_transports` + (`message_attribute_id`, `message_transport_type`, `is_digest`, `letter_module`, `letter_code`) + VALUES (10, 'email', 0, 'circulation', 'HOLD_REMINDER'), + (10, 'sms', 0, 'circulation', 'HOLD_REMINDER'), + (10, 'phone', 0, 'circulation', 'HOLD_REMINDER') + }); + NewVersion( $DBversion, 28153, "Add Hold reminder messaging preference"); +} diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc index 1d508565d8..de6729cc62 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/messaging-preference-form.inc @@ -19,6 +19,7 @@ [% IF ( messaging_preference.Item_Due ) %]Item due [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice [% ELSIF ( messaging_preference.Hold_Filled ) %]Hold filled + [% ELSIF ( messaging_preference.Hold_Reminder ) %]Hold reminder [% ELSIF ( messaging_preference.Item_Check_in ) %]Item check-in [% ELSIF ( messaging_preference.Item_Checkout ) %] [% IF Koha.Preference( 'RenewalSendNotice' ) %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt index a1406a1af4..cdf96f3ac8 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-messaging.tt @@ -62,6 +62,7 @@ [% IF ( messaging_preference.Item_Due ) %]Item due [% ELSIF ( messaging_preference.Advance_Notice ) %]Advance notice [% ELSIF ( messaging_preference.Hold_Filled ) %]Hold filled + [% ELSIF ( messaging_preference.Hold_Reminder ) %]Hold reminder [% ELSIF ( messaging_preference.Item_Check_in ) %]Item check-in [% ELSIF ( messaging_preference.Item_Checkout ) %] [% IF Koha.Preference( 'RenewalSendNotice' ) %] diff --git a/misc/cronjobs/holds/holds_reminder.pl b/misc/cronjobs/holds/holds_reminder.pl index a255d8de6e..ee9d5a13c6 100755 --- a/misc/cronjobs/holds/holds_reminder.pl +++ b/misc/cronjobs/holds/holds_reminder.pl @@ -61,7 +61,7 @@ holds_reminder.pl -lettercode predefined notice to use, default is HOLD_REMINDER -library only deal with holds from this library (repeatable : several libraries can be given) -holidays use the calendar to not count holidays as waiting days - -mtt type of messages to send, default is to use patrons messaging preferences for Hold filled + -mtt type of messages to send, default is to use patrons messaging preferences for Hold reminder populating this will force send even if patron has not chosen to receive hold notices email and sms will fallback to print if borrower does not have an address/phone -date Send notices as would have been sent on a specific date @@ -265,8 +265,8 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP my %done; # If passed message transports we force use those, otherwise we will use the patrons preferences - # for the 'Hold_Filled' notice - my $sending_params = @mtts ? { message_transports => \@mtts } : { message_name => "Hold_Filled" }; + # for the 'Hold_Reminder' notice + my $sending_params = @mtts ? { message_transports => \@mtts } : { message_name => "Hold_Reminder" }; my %patrons; -- 2.20.1