From 614329c0e4c60581bce315bdf834afcafde4d4b2 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 30 Apr 2020 14:09:02 -0400 Subject: [PATCH] Bug 25333: Change message transport type for Talking Tech from "phone" to "itiva" From its inception, phone notices via Talking Tech have not behaved like other notices. Instead of reading notices generated by Koha, the Talking Tech scripts largely generate their own notices. We would like to pave the way to having "generic" phone notices that can be processed by plugins to support arbitrary telephony vendors ( we will be targeting Twilio initially ). To that end, it seems sensible to begin by changing the messaage transport type for Talking Tech from 'phone' to 'itiva' to highlight its specificity and difference from standard message transports. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Restart all the things! 4) Test Talking Tech outbound script 5) Note no changes in functionality Signed-off-by: Christopher Zorn --- C4/Reserves.pm | 2 +- installer/data/mysql/atomicupdate/bug_25333.perl | 9 ++++++ .../mysql/mandatory/message_transport_types.sql | 2 +- .../sample_notices_message_transports.sql | 34 +++++++++++----------- .../prog/en/includes/messaging-preference-form.inc | 22 +++++++------- .../intranet-tmpl/prog/en/modules/tools/letter.tt | 2 +- .../thirdparty/TalkingTech_itiva_outbound.pl | 10 +++---- 7 files changed, 45 insertions(+), 36 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_25333.perl diff --git a/C4/Reserves.pm b/C4/Reserves.pm index d971324f1b..87c02b2471 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1841,7 +1841,7 @@ sub _koha_notify_reserve { next if ( ( $mtt eq 'email' and not $to_address ) # No email address or ( $mtt eq 'sms' and not $patron->smsalertnumber ) # No SMS number - or ( $mtt eq 'phone' and C4::Context->preference('TalkingTechItivaPhoneNotification') ) # Notice is handled by TalkingTech_itiva_outbound.pl + or ( $mtt eq 'itiva' and C4::Context->preference('TalkingTechItivaPhoneNotification') ) # Notice is handled by TalkingTech_itiva_outbound.pl ); &$send_notification($mtt, $letter_code); diff --git a/installer/data/mysql/atomicupdate/bug_25333.perl b/installer/data/mysql/atomicupdate/bug_25333.perl new file mode 100644 index 0000000000..3c1c1859d2 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_25333.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q{ + UPDATE message_transport_types SET message_transport_type = "itiva" WHERE message_transport_type = "phone" + }); + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 25333, q{Change message transport type for Talking Tech from "phone" to "itiva"}); +} diff --git a/installer/data/mysql/mandatory/message_transport_types.sql b/installer/data/mysql/mandatory/message_transport_types.sql index ed3c4ad13a..6ea2ff8aac 100644 --- a/installer/data/mysql/mandatory/message_transport_types.sql +++ b/installer/data/mysql/mandatory/message_transport_types.sql @@ -4,4 +4,4 @@ values ('email'), ('print'), ('sms'), -('phone'); +('itiva'); diff --git a/installer/data/mysql/mandatory/sample_notices_message_transports.sql b/installer/data/mysql/mandatory/sample_notices_message_transports.sql index 5954bafc7b..268e963a28 100644 --- a/installer/data/mysql/mandatory/sample_notices_message_transports.sql +++ b/installer/data/mysql/mandatory/sample_notices_message_transports.sql @@ -1,20 +1,20 @@ insert into `message_transports` (`message_attribute_id`, `message_transport_type`, `is_digest`, `letter_module`, `letter_code`) values -(1, 'email', 0, 'circulation', 'DUE'), -(1, 'email', 1, 'circulation', 'DUEDGST'), -(1, 'sms', 0, 'circulation', 'DUE'), -(1, 'sms', 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'), -(4, 'email', 0, 'reserves', 'HOLD'), -(4, 'sms', 0, 'reserves', 'HOLD'), -(4, 'phone', 0, 'reserves', 'HOLD'), -(5, 'email', 0, 'circulation', 'CHECKIN'), -(5, 'sms', 0, 'circulation', 'CHECKIN'), -(6, 'email', 0, 'circulation', 'CHECKOUT'), -(6, 'sms', 0, 'circulation', 'CHECKOUT'); +(1, 'email', 0, 'circulation', 'DUE'), +(1, 'email', 1, 'circulation', 'DUEDGST'), +(1, 'sms', 0, 'circulation', 'DUE'), +(1, 'sms', 1, 'circulation', 'DUEDGST'), +(2, 'email', 0, 'circulation', 'PREDUE'), +(2, 'email', 1, 'circulation', 'PREDUEDGST'), +(2, 'sms', 0, 'circulation', 'PREDUE'), +(2, 'sms', 1, 'circulation', 'PREDUEDGST'), +(2, 'itiva', 0, 'circulation', 'PREDUE'), +(2, 'itiva', 1, 'circulation', 'PREDUEDGST'), +(4, 'email', 0, 'reserves', 'HOLD'), +(4, 'sms', 0, 'reserves', 'HOLD'), +(4, 'itiva', 0, 'reserves', 'HOLD'), +(5, 'email', 0, 'circulation', 'CHECKIN'), +(5, 'sms', 0, 'circulation', 'CHECKIN'), +(6, 'email', 0, 'circulation', 'CHECKOUT'), +(6, 'sms', 0, 'circulation', 'CHECKOUT'); 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 d2faaabb7d..e278919e57 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 @@ -79,31 +79,31 @@ [% END %] [% IF Koha.Preference('TalkingTechItivaPhoneNotification') %] - [% IF ( messaging_preference.transport_phone ) %] + [% IF ( messaging_preference.transport_itiva ) %] [% IF ( messaging_form_inactive ) %] - [% IF ( messaging_preference.transports_phone ) %] + [% IF ( messaging_preference.transports_itiva ) %] + value="itiva" checked="checked" disabled="disabled" /> [% ELSE %] + value="itiva" disabled="disabled" /> [% END %] [% ELSE %] - [% IF ( messaging_preference.transports_phone ) %] + [% IF ( messaging_preference.transports_itiva ) %] + value="itiva" checked="checked" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id | html %]" /> [% ELSE %] + value="itiva" class="active_notify" data-attr-id="[% messaging_preference.message_attribute_id | html %]" /> [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 9b0a977877..f30121056f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -404,7 +404,7 @@ SMS [% CASE 'feed' %] Feed - [% CASE 'phone' %] + [% CASE 'itiva' %] Phone [% CASE %] [% letter.message_transport_type | html %] diff --git a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl index dd4d2f9ff2..ae6a4f4e00 100755 --- a/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl +++ b/misc/cronjobs/thirdparty/TalkingTech_itiva_outbound.pl @@ -145,7 +145,7 @@ foreach my $type (@types) { biblio => $issues->{'biblionumber'}, biblioitems => $issues->{'biblionumber'}, }, - message_transport_type => 'phone', + message_transport_type => 'itiva', ); die "No letter found for type $type!... dying\n" unless $letter; @@ -155,7 +155,7 @@ foreach my $type (@types) { $message_id = C4::Letters::EnqueueLetter( { letter => $letter, borrowernumber => $issues->{'borrowernumber'}, - message_transport_type => 'phone', + message_transport_type => 'itiva', } ); } @@ -250,7 +250,7 @@ sub GetOverdueIssues { JOIN overduerules USING (categorycode) JOIN overduerules_transport_types USING ( overduerules_id ) WHERE ( overduerules.branchcode = borrowers.branchcode or overduerules.branchcode = '') - AND overduerules_transport_types.message_transport_type = 'phone' + AND overduerules_transport_types.message_transport_type = 'itiva' AND ( (TO_DAYS(NOW())-TO_DAYS(date_due) ) = delay1 OR (TO_DAYS(NOW())-TO_DAYS(date_due) ) = delay2 OR (TO_DAYS(NOW())-TO_DAYS(date_due) ) = delay3 ) @@ -292,7 +292,7 @@ sub GetPredueIssues { JOIN borrower_message_transport_preferences USING (borrower_message_preference_id) JOIN message_attributes USING (message_attribute_id) WHERE ( TO_DAYS( date_due ) - TO_DAYS( NOW() ) ) = days_in_advance - AND message_transport_type = 'phone' + AND message_transport_type = 'itiva' AND message_name = 'Advance_Notice' $patron_branchcode_filter "; @@ -323,7 +323,7 @@ sub GetWaitingHolds { JOIN borrower_message_transport_preferences USING (borrower_message_preference_id) JOIN message_attributes USING (message_attribute_id) WHERE ( reserves.found = 'W' ) - AND message_transport_type = 'phone' + AND message_transport_type = 'itiva' AND message_name = 'Hold_Filled' $patron_branchcode_filter "; -- 2.11.0