From ebbee18822f73c8e8f2236b13a66ba653bebe03f 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 Signed-off-by: Katrin Fischer JD amended patch: remove uneeded indentation change in sample_notices_message_transports.sql Signed-off-by: Jonathan Druart --- C4/Reserves.pm | 2 +- .../data/mysql/atomicupdate/bug_25333.perl | 9 ++++++++ .../mandatory/message_transport_types.sql | 2 +- .../sample_notices_message_transports.sql | 6 ++--- .../en/includes/messaging-preference-form.inc | 22 +++++++++---------- .../prog/en/modules/tools/letter.tt | 2 +- .../thirdparty/TalkingTech_itiva_outbound.pl | 10 ++++----- 7 files changed, 31 insertions(+), 22 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_25333.perl diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 8b7fafd8cf..dabce115d2 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1853,7 +1853,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..f22fbe2f59 100644 --- a/installer/data/mysql/mandatory/sample_notices_message_transports.sql +++ b/installer/data/mysql/mandatory/sample_notices_message_transports.sql @@ -9,11 +9,11 @@ values (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, 'itiva', 0, 'circulation', 'PREDUE'), +(2, 'itiva', 1, 'circulation', 'PREDUEDGST'), (4, 'email', 0, 'reserves', 'HOLD'), (4, 'sms', 0, 'reserves', 'HOLD'), -(4, 'phone', 0, 'reserves', 'HOLD'), +(4, 'itiva', 0, 'reserves', 'HOLD'), (5, 'email', 0, 'circulation', 'CHECKIN'), (5, 'sms', 0, 'circulation', 'CHECKIN'), (6, 'email', 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.39.5