Lines 18-24
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use DateTime::Duration; |
20 |
use DateTime::Duration; |
21 |
use Test::More tests => 92; |
21 |
use Test::More tests => 94; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
24 |
use t::lib::Mocks; |
24 |
use t::lib::Mocks; |
Lines 64-69
$dbh->do(q|DELETE FROM borrowers|);
Link Here
|
64 |
$dbh->do(q|DELETE FROM letter|); |
64 |
$dbh->do(q|DELETE FROM letter|); |
65 |
$dbh->do(q|DELETE FROM message_queue|); |
65 |
$dbh->do(q|DELETE FROM message_queue|); |
66 |
$dbh->do(q|INSERT INTO letter(module, code, content) VALUES ('suggestions', 'CHECKED', 'my content')|); |
66 |
$dbh->do(q|INSERT INTO letter(module, code, content) VALUES ('suggestions', 'CHECKED', 'my content')|); |
|
|
67 |
$dbh->do(q|INSERT INTO letter(module, code, content) VALUES ('suggestions', 'ORDERED', 'my content')|); |
67 |
$dbh->do(q|INSERT INTO letter(module, code, content) VALUES ('suggestions', 'NEW_SUGGESTION', 'Content for new suggestion')|); |
68 |
$dbh->do(q|INSERT INTO letter(module, code, content) VALUES ('suggestions', 'NEW_SUGGESTION', 'Content for new suggestion')|); |
68 |
|
69 |
|
69 |
# Add CPL if missing. |
70 |
# Add CPL if missing. |
Lines 242-248
is ($messages->[0]->{message_transport_type}, 'email', 'When FallbackToSMSIfNoEm
Link Here
|
242 |
|
243 |
|
243 |
#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is enabled and the borrower has a smsalertnumber and no email |
244 |
#Check the message_transport_type when the 'FallbackToSMSIfNoEmail' syspref is enabled and the borrower has a smsalertnumber and no email |
244 |
t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); |
245 |
t::lib::Mocks::mock_preference( 'FallbackToSMSIfNoEmail', 1 ); |
245 |
ModSuggestion($mod_suggestion3); |
246 |
my $mod_suggestion3a = { |
|
|
247 |
STATUS => 'ORDERED', |
248 |
suggestionid => $my_suggestionid, |
249 |
}; |
250 |
ModSuggestion($mod_suggestion3a); |
246 |
$messages = C4::Letters::GetQueuedMessages({ |
251 |
$messages = C4::Letters::GetQueuedMessages({ |
247 |
borrowernumber => $borrowernumber |
252 |
borrowernumber => $borrowernumber |
248 |
}); |
253 |
}); |
Lines 264-269
$messages = C4::Letters::GetQueuedMessages({
Link Here
|
264 |
}); |
269 |
}); |
265 |
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'); |
270 |
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'); |
266 |
|
271 |
|
|
|
272 |
# changing STATUS from ORDERED to CHECKED should generate a message |
273 |
my $mod_suggestion5 = { |
274 |
STATUS => 'CHECKED', |
275 |
suggestionid => $my_suggestionid, |
276 |
}; |
277 |
$status = ModSuggestion($mod_suggestion5); |
278 |
$messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber } ); |
279 |
is( @$messages, 3, 'ModSuggestions does send a message if the status has been changed' ); |
280 |
|
281 |
# modifying suggestion without changing STATUS should not generate a message |
282 |
$status = ModSuggestion($mod_suggestion5); |
283 |
$messages = C4::Letters::GetQueuedMessages( { borrowernumber => $borrowernumber } ); |
284 |
is( @$messages, 3, 'ModSuggestions does send a message if the status has been changed' ); |
285 |
|
267 |
{ |
286 |
{ |
268 |
# Hiding the expected warning displayed by DBI |
287 |
# Hiding the expected warning displayed by DBI |
269 |
# DBD::mysql::st execute failed: Incorrect date value: 'invalid date!' for column 'manageddate' |
288 |
# DBD::mysql::st execute failed: Incorrect date value: 'invalid date!' for column 'manageddate' |
270 |
- |
|
|