View | Details | Raw Unified | Return to bug 15967
Collapse All | Expand All

(-)a/misc/cronjobs/overdue_notices.pl (-7 / +6 lines)
Lines 669-678 END_SQL Link Here
669
669
670
                my $print_sent = 0; # A print notice is not yet sent for this patron
670
                my $print_sent = 0; # A print notice is not yet sent for this patron
671
                for my $mtt ( @message_transport_types ) {
671
                for my $mtt ( @message_transport_types ) {
672
672
                    my $effective_mtt = $mtt;
673
                    if ( ($mtt eq 'email' and not scalar @emails_to_use) or ($mtt eq 'sms' and not $data->{smsalertnumber}) ) {
673
                    if ( ($mtt eq 'email' and not scalar @emails_to_use) or ($mtt eq 'sms' and not $data->{smsalertnumber}) ) {
674
                        # email or sms is requested but not exist, do a print.
674
                        # email or sms is requested but not exist, do a print.
675
                        $mtt = 'print';
675
                        $effective_mtt = 'print';
676
                    }
676
                    }
677
                    my $letter = parse_overdues_letter(
677
                    my $letter = parse_overdues_letter(
678
                        {   letter_code     => $overdue_rules->{"letter$i"},
678
                        {   letter_code     => $overdue_rules->{"letter$i"},
Lines 684-690 END_SQL Link Here
684
                                                'items.content' => $titles,
684
                                                'items.content' => $titles,
685
                                                'count'         => $itemcount,
685
                                                'count'         => $itemcount,
686
                                               },
686
                                               },
687
                            message_transport_type => $mtt,
687
                            message_transport_type => $effective_mtt,
688
                        }
688
                        }
689
                    );
689
                    );
690
                    unless ($letter) {
690
                    unless ($letter) {
Lines 744-762 END_SQL Link Here
744
                                }
744
                                }
745
                              );
745
                              );
746
                        }
746
                        }
747
                        unless ( $mtt eq 'print' and $print_sent == 1 ) {
747
                        unless ( $effective_mtt eq 'print' and $print_sent == 1 ) {
748
                            # Just sent a print if not already done.
748
                            # Just sent a print if not already done.
749
                            C4::Letters::EnqueueLetter(
749
                            C4::Letters::EnqueueLetter(
750
                                {   letter                 => $letter,
750
                                {   letter                 => $letter,
751
                                    borrowernumber         => $borrowernumber,
751
                                    borrowernumber         => $borrowernumber,
752
                                    message_transport_type => $mtt,
752
                                    message_transport_type => $effective_mtt,
753
                                    from_address           => $admin_email_address,
753
                                    from_address           => $admin_email_address,
754
                                    to_address             => join(',', @emails_to_use),
754
                                    to_address             => join(',', @emails_to_use),
755
                                }
755
                                }
756
                            );
756
                            );
757
                            # A print notice should be sent only once per overdue level.
757
                            # A print notice should be sent only once per overdue level.
758
                            # Without this check, a print could be sent twice or more if the library checks sms and email and print and the patron has no email or sms number.
758
                            # Without this check, a print could be sent twice or more if the library checks sms and email and print and the patron has no email or sms number.
759
                            $print_sent = 1 if $mtt eq 'print';
759
                            $print_sent = 1 if $effective_mtt eq 'print';
760
                        }
760
                        }
761
                    }
761
                    }
762
                }
762
                }
763
- 

Return to bug 15967