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

(-)a/C4/Installer/PerlDependencies.pm (+5 lines)
Lines 699-704 our $PERL_DEPS = { Link Here
699
        'required' => '0',
699
        'required' => '0',
700
        'min_ver'  => '0.73',
700
        'min_ver'  => '0.73',
701
    },
701
    },
702
    'Data::Validate::Email' => {
703
        'usage'    => 'Email validation',
704
        'required' => '1',
705
        'min_ver'  => '0.04',
706
    },
702
};
707
};
703
708
704
1;
709
1;
(-)a/C4/Letters.pm (-5 / +5 lines)
Lines 33-38 use Koha::DateUtils; Link Here
33
use Date::Calc qw( Add_Delta_Days );
33
use Date::Calc qw( Add_Delta_Days );
34
use Encode;
34
use Encode;
35
use Carp;
35
use Carp;
36
use Data::Validate::Email qw(is_email);
36
37
37
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
38
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
38
39
Lines 286-292 sub SendAlerts { Link Here
286
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
287
            my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'});
287
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
288
            my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
288
            my $email = $sendAllEmailsTo;
289
            my $email = $sendAllEmailsTo;
289
            if (!($sendAllEmailsTo && $sendAllEmailsTo =~ /@/) ){ # some validation.  This could be improved.
290
            if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){ 
290
                $email = $borinfo->{email} or next;
291
                $email = $borinfo->{email} or next;
291
            }
292
            }
292
293
Lines 374-380 sub SendAlerts { Link Here
374
375
375
        my $allemails = join( ',', @email);
376
        my $allemails = join( ',', @email);
376
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
377
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
377
        $allemails = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
378
        $allemails = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) );
378
        # ... then send mail
379
        # ... then send mail
379
        my %mail = (
380
        my %mail = (
380
            To             => $allemails,
381
            To             => $allemails,
Lines 415-421 sub SendAlerts { Link Here
415
        return { error => "no_email" } unless $externalid->{'emailaddr'};
416
        return { error => "no_email" } unless $externalid->{'emailaddr'};
416
        my $emailaddr = $externalid->{'emailaddr'};
417
        my $emailaddr = $externalid->{'emailaddr'};
417
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
418
        my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
418
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
419
        $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); 
419
        # ... then send mail
420
        # ... then send mail
420
        my %mail = (
421
        my %mail = (
421
                To      => $emailaddr,
422
                To      => $emailaddr,
Lines 938-944 sub _send_message_by_email { Link Here
938
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
939
    my $member = C4::Members::GetMember( 'borrowernumber' => $message->{'borrowernumber'} );
939
    my $to_address = $message->{'to_address'};
940
    my $to_address = $message->{'to_address'};
940
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
941
    my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo');
941
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && $sendAllEmailsTo =~ /@/ ); # some validation.  This could be improved.
942
    $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); 
942
    unless ($to_address) {
943
    unless ($to_address) {
943
        unless ($member) {
944
        unless ($member) {
944
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
945
            warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})";
945
- 

Return to bug 8000