From b65605855529284780526b7cccbb4b42b2e85f5a Mon Sep 17 00:00:00 2001 From: Alex Buckley Date: Tue, 6 Nov 2018 04:46:49 +0000 Subject: [PATCH] Bug 21241: (follow-up) Renamed system preference Sponsored-By: Brimbank Library, Australia --- C4/Suggestions.pm | 4 ++-- ..._to_control_fallback_to_sms_if_no_email_defined.sql | 2 +- .../prog/en/modules/admin/preferences/patrons.pref | 2 +- t/db_dependent/Suggestions.t | 18 +++++++++--------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/C4/Suggestions.pm b/C4/Suggestions.pm index 27ee447..aa96273 100644 --- a/C4/Suggestions.pm +++ b/C4/Suggestions.pm @@ -504,8 +504,8 @@ sub ModSuggestion { my $full_suggestion = GetSuggestion( $suggestion->{suggestionid} ); my $patron = Koha::Patrons->find( $full_suggestion->{suggestedby} ); my $transport; - #If MessageTransportTypeFallbackToSMSIfNoPatronEmail syspref is enabled and the patron has a smsalertnumber but no email address then set message_transport_type of suggestion notice to sms - if (C4::Context->preference("MessageTransportTypeFallbackToSMSIfNoPatronEmail")) { + #If FallbackToSMSIfNoEmail syspref is enabled and the patron has a smsalertnumber but no email address then set message_transport_type of suggestion notice to sms + if (C4::Context->preference("FallbackToSMSIfNoEmail")) { if (($patron->smsalertnumber) && (!$patron->email)) { $transport="sms"; } else { diff --git a/installer/data/mysql/atomicupdate/bug_21241-add_syspref_to_control_fallback_to_sms_if_no_email_defined.sql b/installer/data/mysql/atomicupdate/bug_21241-add_syspref_to_control_fallback_to_sms_if_no_email_defined.sql index 04d5752..6528f3d 100644 --- a/installer/data/mysql/atomicupdate/bug_21241-add_syspref_to_control_fallback_to_sms_if_no_email_defined.sql +++ b/installer/data/mysql/atomicupdate/bug_21241-add_syspref_to_control_fallback_to_sms_if_no_email_defined.sql @@ -1 +1 @@ -INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('MessageTransportTypeFallbackToSMSIfNoPatronEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo'); +INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('FallbackToSMSIfNoEmail', 0, 'Enable|Disable', 'Send messages by SMS if no patron email is defined', 'YesNo'); 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 857b8b5..12d8577 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 @@ -7,7 +7,7 @@ Patrons: no: "Don't send" - an email to newly created patrons with their account details. - - - pref: MessageTransportTypeFallbackToSMSIfNoPatronEmail + - pref: FallbackToSMSIfNoEmail choices: yes: Enable no: Disable diff --git a/t/db_dependent/Suggestions.t b/t/db_dependent/Suggestions.t index 4996051..16e0dd2 100644 --- a/t/db_dependent/Suggestions.t +++ b/t/db_dependent/Suggestions.t @@ -209,8 +209,8 @@ my $mod_suggestion3 = { #Test the message_transport_type of suggestion notices -#Check the message_transport_type when the 'MessageTransportTypeFallbackToSMSIfNoPatronEmail' syspref is disabled -t::lib::Mocks::mock_preference( 'MessageTransportTypeFallbackToSMSIfNoPatronEmail', 0 ); +#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is disabled +t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 0 ); $status = ModSuggestion($mod_suggestion3); is( $status, 1, 'ModSuggestion modifies one entry' ); $suggestion = GetSuggestion($my_suggestionid); @@ -219,22 +219,22 @@ $messages = C4::Letters::GetQueuedMessages({ borrowernumber => $borrowernumber, }); is( @$messages, 1, 'ModSuggestion sends an email if the status is updated' ); -is ($messages->[0]->{message_transport_type}, 'email', 'When MessageTransportTypeFallbackToSMSIfNoPatronEmail syspref is disabled the suggestion message_transport_type is always email'); +is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEmail syspref is disabled the suggestion message_transport_type is always email'); is( CountSuggestion('CHECKED'), 1, 'CountSuggestion returns the correct number of suggestions' ); -#Check the message_transport_type when the 'MessageTransportTypeFallbackToSMSIfNoPatronEmail' syspref is enabled and the borrower has a smsalertnumber and no email -t::lib::Mocks::mock_preference( 'MessageTransportTypeFallbackToSMSIfNoPatronEmail', 1 ); +#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is enabled and the borrower has a smsalertnumber and no email +t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); ModSuggestion($mod_suggestion3); $messages = C4::Letters::GetQueuedMessages({ borrowernumber => $borrowernumber, }); -is ($messages->[1]->{message_transport_type}, 'sms', 'When MessageTransportTypeFallbackToSMSIfNoPatronEmail syspref is enabled the suggestion message_transport_type is sms if the borrower has no email'); +is ($messages->[1]->{message_transport_type}, 'sms', 'When FallbackToSMSIfNoEmail syspref is enabled the suggestion message_transport_type is sms if the borrower has no email'); #Make a new suggestion for a borrower with defined email and no smsalertnumber my $my_suggestion_2_id = NewSuggestion($my_suggestion_with_budget2); -#Check the message_transport_type when the 'MessageTransportTypeFallbackToSMSIfNoPatronEmail' syspref is enabled and the borrower has a defined email and no smsalertnumber -t::lib::Mocks::mock_preference( 'MessageTransportTypeFallbackToSMSIfNoPatronEmail', 1 ); +#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is enabled and the borrower has a defined email and no smsalertnumber +t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); my $mod_suggestion4 = { STATUS => 'CHECKED', suggestionid => $my_suggestion_2_id, @@ -243,7 +243,7 @@ ModSuggestion($mod_suggestion4); $messages = C4::Letters::GetQueuedMessages({ borrowernumber => $borrowernumber2, }); -is ($messages->[0]->{message_transport_type}, 'email', 'When MessageTransportTypeFallbackToSMSIfNoPatronEmail syspref is enabled the suggestion message_transport_type is email if the borrower has an email'); +is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEmail syspref is enabled the suggestion message_transport_type is email if the borrower has an email'); is( GetSuggestionInfo(), undef, 'GetSuggestionInfo without the suggestion id returns undef' ); $suggestion = GetSuggestionInfo($my_suggestionid); -- 2.1.4