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

(-)a/C4/Installer/PerlDependencies.pm (-5 lines)
Lines 737-747 our $PERL_DEPS = { Link Here
737
        'required' => '0',
737
        'required' => '0',
738
        'min_ver'  => '0.89',
738
        'min_ver'  => '0.89',
739
    },
739
    },
740
    'Data::Validate::Email' => {
741
        'usage'    => 'Email validation',
742
        'required' => '1',
743
        'min_ver'  => '0.04',
744
    },
745
};
740
};
746
741
747
1;
742
1;
(-)a/C4/Letters.pm (-6 / +5 lines)
Lines 35-41 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
use Email::Valid;
39
39
40
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
40
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
41
41
Lines 407-413 sub SendAlerts { Link Here
407
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
407
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
408
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
408
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
409
            my $email = $sendAllEmailsTo;
409
            my $email = $sendAllEmailsTo;
410
            if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){
410
            if (!($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo))){
411
                $email = $borinfo->{email} or next;
411
                $email = $borinfo->{email} or next;
412
            }
412
            }
413
413
Lines 526-532 sub SendAlerts { Link Here
526
        my $emailsCC = join( ',', @cc);
526
        my $emailsCC = join( ',', @cc);
527
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
527
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
528
        # some validation.  This could be improved.
528
        # some validation.  This could be improved.
529
        if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ) {
529
        if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ) {
530
            $emailsTo = $sendAllEmailsTo;
530
            $emailsTo = $sendAllEmailsTo;
531
            $emailsCC = '';
531
            $emailsCC = '';
532
        }
532
        }
Lines 586-592 sub SendAlerts { Link Here
586
        my $email = Koha::Email->new();
586
        my $email = Koha::Email->new();
587
        my $emailaddr = $externalid->{'emailaddr'};
587
        my $emailaddr = $externalid->{'emailaddr'};
588
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
588
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
589
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) );
589
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) );
590
        my %mail  = $email->create_message_headers(
590
        my %mail  = $email->create_message_headers(
591
            {
591
            {
592
                to      => $emailaddr,
592
                to      => $emailaddr,
Lines 1155-1161 sub _send_message_by_email { Link Here
1155
        $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} );
1155
        $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} );
1156
    }
1156
    }
1157
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1157
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
1158
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) );
1158
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) );
1159
    unless ($to_address) {
1159
    unless ($to_address) {
1160
        if (!$member) {
1160
        if (!$member) {
1161
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1161
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
1162
- 

Return to bug 8000