Lines 34-40
use Koha::DateUtils;
Link Here
|
34 |
use Date::Calc qw( Add_Delta_Days ); |
34 |
use Date::Calc qw( Add_Delta_Days ); |
35 |
use Encode; |
35 |
use Encode; |
36 |
use Carp; |
36 |
use Carp; |
37 |
use Data::Validate::Email qw(is_email); |
37 |
use Email::Valid; |
38 |
|
38 |
|
39 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
39 |
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); |
40 |
|
40 |
|
Lines 288-294
sub SendAlerts {
Link Here
|
288 |
my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); |
288 |
my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); |
289 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
289 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
290 |
my $email = $sendAllEmailsTo; |
290 |
my $email = $sendAllEmailsTo; |
291 |
if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){ |
291 |
if (!($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo))){ |
292 |
$email = $borinfo->{email} or next; |
292 |
$email = $borinfo->{email} or next; |
293 |
} |
293 |
} |
294 |
|
294 |
|
Lines 376-382
sub SendAlerts {
Link Here
|
376 |
|
376 |
|
377 |
my $allemails = join( ',', @email); |
377 |
my $allemails = join( ',', @email); |
378 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
378 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
379 |
$allemails = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); |
379 |
$allemails = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); |
380 |
# ... then send mail |
380 |
# ... then send mail |
381 |
my %mail = ( |
381 |
my %mail = ( |
382 |
To => $allemails, |
382 |
To => $allemails, |
Lines 417-423
sub SendAlerts {
Link Here
|
417 |
return { error => "no_email" } unless $externalid->{'emailaddr'}; |
417 |
return { error => "no_email" } unless $externalid->{'emailaddr'}; |
418 |
my $emailaddr = $externalid->{'emailaddr'}; |
418 |
my $emailaddr = $externalid->{'emailaddr'}; |
419 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
419 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
420 |
$emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); |
420 |
$emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); |
421 |
# ... then send mail |
421 |
# ... then send mail |
422 |
my %mail = ( |
422 |
my %mail = ( |
423 |
To => $emailaddr, |
423 |
To => $emailaddr, |
Lines 944-950
sub _send_message_by_email {
Link Here
|
944 |
$to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} ); |
944 |
$to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} ); |
945 |
} |
945 |
} |
946 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
946 |
my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); |
947 |
$to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); |
947 |
$to_address = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); |
948 |
unless ($to_address) { |
948 |
unless ($to_address) { |
949 |
if (!$member) { |
949 |
if (!$member) { |
950 |
warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; |
950 |
warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; |
951 |
- |
|
|