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

(-)a/C4/Installer/PerlDependencies.pm (+5 lines)
Lines 737-742 our $PERL_DEPS = { Link Here
737
        'required' => '0',
737
        'required' => '0',
738
        'min_ver'  => '5.61',
738
        'min_ver'  => '5.61',
739
    },
739
    },
740
    'Data::Validate::Email' => {
741
        'usage'    => 'Email validation',
742
        'required' => '1',
743
        'min_ver'  => '0.04',
744
    },
740
};
745
};
741
746
742
1;
747
1;
(-)a/C4/Letters.pm (-5 / +5 lines)
Lines 35-40 use Date::Calc qw( Add_Delta_Days ); Link Here
35
use Encode;
35
use Encode;
36
use Carp;
36
use Carp;
37
use Koha::Email;
37
use Koha::Email;
38
use Data::Validate::Email qw(is_email);
38
39
39
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
40
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
40
41
Lines 405-411 sub SendAlerts { Link Here
405
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
406
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
406
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
407
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
407
            my $email = $sendAllEmailsTo;
408
            my $email = $sendAllEmailsTo;
408
            if (!($sendAllEmailsTo && $sendAllEmailsTo =~ /@/) ){ # some validation.  This could be improved.
409
            if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){
409
                $email = $borinfo->{email} or next;
410
                $email = $borinfo->{email} or next;
410
            }
411
            }
411
412
Lines 524-530 sub SendAlerts { Link Here
524
        my $emailsCC = join( ',', @cc);
525
        my $emailsCC = join( ',', @cc);
525
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
526
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
526
        # some validation.  This could be improved.
527
        # some validation.  This could be improved.
527
        if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ) {
528
        if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ) {
528
            $emailsTo = $sendAllEmailsTo;
529
            $emailsTo = $sendAllEmailsTo;
529
            $emailsCC = '';
530
            $emailsCC = '';
530
        }
531
        }
Lines 584-590 sub SendAlerts { Link Here
584
        my $email = Koha::Email->new();
585
        my $email = Koha::Email->new();
585
        my $emailaddr = $externalid->{'emailaddr'};
586
        my $emailaddr = $externalid->{'emailaddr'};
586
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
587
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
587
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
588
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) );
588
        my %mail  = $email->create_message_headers(
589
        my %mail  = $email->create_message_headers(
589
            {
590
            {
590
                to      => $emailaddr,
591
                to      => $emailaddr,
Lines 1149-1155 sub _send_message_by_email { Link Here
1149
        $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} );
1150
        $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} );
1150
    }
1151
    }
1151
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1152
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1152
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
1153
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) );
1153
    unless ($to_address) {
1154
    unless ($to_address) {
1154
        if (!$member) {
1155
        if (!$member) {
1155
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1156
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1156
- 

Return to bug 8000