From 7a439fcc9122a999ea475660c552818edbb57a71 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 30 Apr 2020 13:35:48 -0400 Subject: [PATCH] Bug 25334: Add generic 'phone' message transport type As bug 25333 changed the 'phone' transport type to 'talkingtech', we can now re-add 'phone' as a transport type again, and allow it to behave and support the same notices as the email transport type. --- C4/Reserves.pm | 1 + .../data/mysql/atomicupdate/bug_25334.perl | 27 +++++++++++++++ .../mandatory/message_transport_types.sql | 1 + .../sample_notices_message_transports.sql | 9 ++++- installer/data/mysql/sysprefs.sql | 1 + .../en/includes/messaging-preference-form.inc | 34 ++++++++++++++++++- .../en/modules/admin/preferences/patrons.pref | 8 +++++ 7 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_25334.perl diff --git a/C4/Reserves.pm b/C4/Reserves.pm index dc030d69ae..75adb3b35a 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1806,6 +1806,7 @@ sub _koha_notify_reserve { ( $mtt eq 'email' and not $to_address ) # No email address or ( $mtt eq 'sms' and not $patron->smsalertnumber ) # No SMS number or ( $mtt eq 'talkingtech' and C4::Context->preference('TalkingTechItivaPhoneNotification') ) # Notice is handled by TalkingTech_itiva_outbound.pl + or ( $mtt eq 'phone' and not $patron->phone ) # No phone number to call ); &$send_notification($mtt, $letter_code); diff --git a/installer/data/mysql/atomicupdate/bug_25334.perl b/installer/data/mysql/atomicupdate/bug_25334.perl new file mode 100644 index 0000000000..1d4f96c7b3 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_25334.perl @@ -0,0 +1,27 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES + ('PhoneNotification','0',NULL,'If ON, enables generation of phone notifications to be sent by plugins','YesNo') + }); + + $dbh->do(q{ + INSERT INTO message_transport_types (message_transport_type) VALUES ('phone') + }); + + $dbh->do(q{ + INSERT IGNORE INTO `message_transports` + (`message_attribute_id`, `message_transport_type`, `is_digest`, `letter_module`, `letter_code`) + VALUES + (1, 'phone', 0, 'circulation', 'DUE'), + (1, 'phone', 1, 'circulation', 'DUEDGST'), + (2, 'phone', 0, 'circulation', 'PREDUE'), + (2, 'phone', 1, 'circulation', 'PREDUEDGST'), + (4, 'phone', 0, 'reserves', 'HOLD'), + (5, 'phone', 0, 'circulation', 'CHECKIN'), + (6, 'phone', 0, 'circulation', 'CHECKOUT'); + }); + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 12345, "Description"); +} diff --git a/installer/data/mysql/mandatory/message_transport_types.sql b/installer/data/mysql/mandatory/message_transport_types.sql index fa83aa9b96..65389a27d5 100644 --- a/installer/data/mysql/mandatory/message_transport_types.sql +++ b/installer/data/mysql/mandatory/message_transport_types.sql @@ -4,4 +4,5 @@ values ('email'), ('print'), ('sms'), +('phone'), ('talkingtech'); diff --git a/installer/data/mysql/mandatory/sample_notices_message_transports.sql b/installer/data/mysql/mandatory/sample_notices_message_transports.sql index 8fe6fc1838..ee924615de 100644 --- a/installer/data/mysql/mandatory/sample_notices_message_transports.sql +++ b/installer/data/mysql/mandatory/sample_notices_message_transports.sql @@ -5,16 +5,23 @@ values (1, 'email', 1, 'circulation', 'DUEDGST'), (1, 'sms', 0, 'circulation', 'DUE'), (1, 'sms', 1, 'circulation', 'DUEDGST'), +(1, 'phone', 0, 'circulation', 'DUE'), +(1, 'phone', 1, 'circulation', 'DUEDGST'), (2, 'email', 0, 'circulation', 'PREDUE'), (2, 'email', 1, 'circulation', 'PREDUEDGST'), (2, 'sms', 0, 'circulation', 'PREDUE'), (2, 'sms', 1, 'circulation', 'PREDUEDGST'), +(2, 'phone', 0, 'circulation', 'PREDUE'), +(2, 'phone', 1, 'circulation', 'PREDUEDGST'), (2, 'talkingtech', 0, 'circulation', 'PREDUE'), (2, 'talkingtech', 1, 'circulation', 'PREDUEDGST'), (4, 'email', 0, 'reserves', 'HOLD'), (4, 'sms', 0, 'reserves', 'HOLD'), +(4, 'phone', 0, 'reserves', 'HOLD'), (4, 'talkingtech', 0, 'reserves', 'HOLD'), (5, 'email', 0, 'circulation', 'CHECKIN'), (5, 'sms', 0, 'circulation', 'CHECKIN'), +(5, 'phone', 0, 'circulation', 'CHECKIN'), (6, 'email', 0, 'circulation', 'CHECKOUT'), -(6, 'sms', 0, 'circulation', 'CHECKOUT'); +(6, 'sms', 0, 'circulation', 'CHECKOUT'), +(6, 'phone', 0, 'circulation', 'CHECKOUT'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index ead29651f5..0e871a0083 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -640,6 +640,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('TagsShowOnDetail','10','','Number of tags to display on detail page. 0 is off.','Integer'), ('TagsShowOnList','6','','Number of tags to display on search results list. 0 is off.','Integer'), ('TalkingTechItivaPhoneNotification','0',NULL,'If ON, enables Talking Tech I-tiva phone notifications','YesNo'), +('PhoneNotification','0',NULL,'If ON, enables generation of phone notifications to be sent by plugins','YesNo'), ('template','prog','','Define the preferred staff interface template','Themes'), ('ThingISBN','0','','Use with FRBRizeEditions. If ON, Koha will use the ThingISBN web service in the Editions tab on the detail pages.','YesNo'), ('TimeFormat','24hr','12hr|24hr','Defines the global time format for visual output.','Choice'), 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 6e6e74c74a..458536f8fd 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 @@ -7,7 +7,7 @@ Days in advance [% IF Koha.Preference('SMSSendDriver') %]SMS[% END %] - [% IF Koha.Preference('TalkingTechItivaPhoneNotification') %]Phone[% END %] + [% IF Koha.Preference('TalkingTechItivaPhoneNotification') || Koha.Preference('PhoneNotification') %]Phone[% END %] Email Digests only @@ -105,6 +105,38 @@ [% ELSE %] - [% END %] + [% ELSIF Koha.Preference('PhoneNotification') %] + [% IF ( messaging_preference.transport_phone ) %] + + [% IF ( messaging_form_inactive ) %] + [% IF ( messaging_preference.transports_phone ) %] + + [% ELSE %] + + [% END %] + [% ELSE %] + [% IF ( messaging_preference.transports_phone ) %] + + [% ELSE %] + + [% END %] + [% END %] + + [% ELSE %] + - + [% END %] [% END %] [% IF ( messaging_preference.transport_email ) %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index b9a0ee6261..2ad6bdb260 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -149,6 +149,14 @@ Patrons: yes: Enable no: Disable - patron phone notifications using Talking Tech i-tiva (overdues, predues and holds notices currently supported). + -
If TalkingTechItivaPhoneNotification is enabled, PhoneNotification should be disabled. + - + - pref: PhoneNotification + choices: + yes: Enable + no: Disable + - patron phone notifications generation. A plugin will be required to process the phone notifications. + -
If PhoneNotification is enabled, TalkingTechItivaPhoneNotification should be disabled. - - "Use the SMS::Send::" - pref: SMSSendDriver -- 2.24.2 (Apple Git-127)