|
Lines 209-216
my $mod_suggestion3 = {
Link Here
|
| 209 |
|
209 |
|
| 210 |
#Test the message_transport_type of suggestion notices |
210 |
#Test the message_transport_type of suggestion notices |
| 211 |
|
211 |
|
| 212 |
#Check the message_transport_type when the 'MessageTransportTypeFallbackToSMSIfNoPatronEmail' syspref is disabled |
212 |
#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is disabled |
| 213 |
t::lib::Mocks::mock_preference( 'MessageTransportTypeFallbackToSMSIfNoPatronEmail', 0 ); |
213 |
t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 0 ); |
| 214 |
$status = ModSuggestion($mod_suggestion3); |
214 |
$status = ModSuggestion($mod_suggestion3); |
| 215 |
is( $status, 1, 'ModSuggestion modifies one entry' ); |
215 |
is( $status, 1, 'ModSuggestion modifies one entry' ); |
| 216 |
$suggestion = GetSuggestion($my_suggestionid); |
216 |
$suggestion = GetSuggestion($my_suggestionid); |
|
Lines 219-240
$messages = C4::Letters::GetQueuedMessages({
Link Here
|
| 219 |
borrowernumber => $borrowernumber, |
219 |
borrowernumber => $borrowernumber, |
| 220 |
}); |
220 |
}); |
| 221 |
is( @$messages, 1, 'ModSuggestion sends an email if the status is updated' ); |
221 |
is( @$messages, 1, 'ModSuggestion sends an email if the status is updated' ); |
| 222 |
is ($messages->[0]->{message_transport_type}, 'email', 'When MessageTransportTypeFallbackToSMSIfNoPatronEmail syspref is disabled the suggestion message_transport_type is always email'); |
222 |
is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEmail syspref is disabled the suggestion message_transport_type is always email'); |
| 223 |
is( CountSuggestion('CHECKED'), 1, 'CountSuggestion returns the correct number of suggestions' ); |
223 |
is( CountSuggestion('CHECKED'), 1, 'CountSuggestion returns the correct number of suggestions' ); |
| 224 |
|
224 |
|
| 225 |
#Check the message_transport_type when the 'MessageTransportTypeFallbackToSMSIfNoPatronEmail' syspref is enabled and the borrower has a smsalertnumber and no email |
225 |
#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is enabled and the borrower has a smsalertnumber and no email |
| 226 |
t::lib::Mocks::mock_preference( 'MessageTransportTypeFallbackToSMSIfNoPatronEmail', 1 ); |
226 |
t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); |
| 227 |
ModSuggestion($mod_suggestion3); |
227 |
ModSuggestion($mod_suggestion3); |
| 228 |
$messages = C4::Letters::GetQueuedMessages({ |
228 |
$messages = C4::Letters::GetQueuedMessages({ |
| 229 |
borrowernumber => $borrowernumber, |
229 |
borrowernumber => $borrowernumber, |
| 230 |
}); |
230 |
}); |
| 231 |
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'); |
231 |
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'); |
| 232 |
|
232 |
|
| 233 |
#Make a new suggestion for a borrower with defined email and no smsalertnumber |
233 |
#Make a new suggestion for a borrower with defined email and no smsalertnumber |
| 234 |
my $my_suggestion_2_id = NewSuggestion($my_suggestion_with_budget2); |
234 |
my $my_suggestion_2_id = NewSuggestion($my_suggestion_with_budget2); |
| 235 |
|
235 |
|
| 236 |
#Check the message_transport_type when the 'MessageTransportTypeFallbackToSMSIfNoPatronEmail' syspref is enabled and the borrower has a defined email and no smsalertnumber |
236 |
#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is enabled and the borrower has a defined email and no smsalertnumber |
| 237 |
t::lib::Mocks::mock_preference( 'MessageTransportTypeFallbackToSMSIfNoPatronEmail', 1 ); |
237 |
t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); |
| 238 |
my $mod_suggestion4 = { |
238 |
my $mod_suggestion4 = { |
| 239 |
STATUS => 'CHECKED', |
239 |
STATUS => 'CHECKED', |
| 240 |
suggestionid => $my_suggestion_2_id, |
240 |
suggestionid => $my_suggestion_2_id, |
|
Lines 243-249
ModSuggestion($mod_suggestion4);
Link Here
|
| 243 |
$messages = C4::Letters::GetQueuedMessages({ |
243 |
$messages = C4::Letters::GetQueuedMessages({ |
| 244 |
borrowernumber => $borrowernumber2, |
244 |
borrowernumber => $borrowernumber2, |
| 245 |
}); |
245 |
}); |
| 246 |
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'); |
246 |
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'); |
| 247 |
|
247 |
|
| 248 |
is( GetSuggestionInfo(), undef, 'GetSuggestionInfo without the suggestion id returns undef' ); |
248 |
is( GetSuggestionInfo(), undef, 'GetSuggestionInfo without the suggestion id returns undef' ); |
| 249 |
$suggestion = GetSuggestionInfo($my_suggestionid); |
249 |
$suggestion = GetSuggestionInfo($my_suggestionid); |
| 250 |
- |
|
|