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

(-)a/misc/cronjobs/overdue_notices.pl (-3 / +20 lines)
Lines 722-731 END_SQL Link Here
722
                    unless @message_transport_types;
722
                    unless @message_transport_types;
723
723
724
                my $print_sent = 0;    # A print notice is not yet sent for this patron
724
                my $print_sent = 0;    # A print notice is not yet sent for this patron
725
726
                my $guarantor_has_address;
727
                if ( C4::Context->preference('RedirectGuaranteeEmail') && $patron ) {
728
729
                    # Get guarantor addresses
730
                    my $guarantor_relationships = $patron->guarantor_relationships;
731
                    my @guarantors              = $guarantor_relationships->guarantors->as_list;
732
                    foreach my $guarantor (@guarantors) {
733
                        my $address = $guarantor->notice_email_address;
734
                        if ($address) {
735
                            $guarantor_has_address = 1;
736
                        }
737
                    }
738
                }
739
                if ($guarantor_has_address || scalar @emails_to_use) {
740
                    $print_sent = 1;
741
                }
742
725
                for my $mtt (@message_transport_types) {
743
                for my $mtt (@message_transport_types) {
726
                    next if $mtt eq 'itiva';
744
                    next if $mtt eq 'itiva';
727
                    my $effective_mtt = $mtt;
745
                    my $effective_mtt = $mtt;
728
                    if (   ( $mtt eq 'email' and not scalar @emails_to_use )
746
                    if (   ( $mtt eq 'email' and not scalar @emails_to_use and not $guarantor_has_address )
729
                        or ( $mtt eq 'sms' and not $data->{smsalertnumber} ) )
747
                        or ( $mtt eq 'sms' and not $data->{smsalertnumber} ) )
730
                    {
748
                    {
731
                        # email or sms is requested but not exist, do a print.
749
                        # email or sms is requested but not exist, do a print.
Lines 808-814 END_SQL Link Here
808
                            }
826
                            }
809
                            );
827
                            );
810
                    } else {
828
                    } else {
811
                        if (   ( $mtt eq 'email' and not scalar @emails_to_use )
829
                        if (   ( $mtt eq 'email' and not scalar @emails_to_use and not $guarantor_has_address)
812
                            or ( $mtt eq 'sms' and not $data->{smsalertnumber} ) )
830
                            or ( $mtt eq 'sms' and not $data->{smsalertnumber} ) )
813
                        {
831
                        {
814
                            push @output_chunks,
832
                            push @output_chunks,
815
- 

Return to bug 39646