diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 7bcd37538f..9be7e4d5ca 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -669,6 +669,10 @@ END_SQL my $print_sent = 0; # A print notice is not yet sent for this patron for my $mtt ( @message_transport_types ) { + if ( ($mtt eq 'email' and not scalar @emails_to_use) or ($mtt eq 'sms' and not $data->{smsalertnumber}) ) { + # email or sms is requested but not exist, do a print. + $mtt = 'print'; + } my $letter = parse_overdues_letter( { letter_code => $overdue_rules->{"letter$i"}, borrowernumber => $borrowernumber, @@ -721,8 +725,6 @@ END_SQL ); } else { if ( ($mtt eq 'email' and not scalar @emails_to_use) or ($mtt eq 'sms' and not $data->{smsalertnumber}) ) { - # email or sms is requested but not exist, do a print. - $mtt = 'print'; push @output_chunks, prepare_letter_for_printing( { letter => $letter,