From 0ea789dae3dfcb1119316c11e1efa437a5e729b1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 19 Mar 2014 10:37:57 +0100 Subject: [PATCH] Bug 8000: Replace Data::Validate::Email with Email::Valid --- C4/Installer/PerlDependencies.pm | 5 ----- C4/Letters.pm | 10 +++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index 36d097b..57c5972 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -737,11 +737,6 @@ our $PERL_DEPS = { 'required' => '0', 'min_ver' => '0.89', }, - 'Data::Validate::Email' => { - 'usage' => 'Email validation', - 'required' => '1', - 'min_ver' => '0.04', - }, }; 1; diff --git a/C4/Letters.pm b/C4/Letters.pm index bcf0a49..9f96f6f 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -35,7 +35,7 @@ use Date::Calc qw( Add_Delta_Days ); use Encode; use Carp; use Koha::Email; -use Data::Validate::Email qw(is_email); +use Email::Valid; use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); @@ -407,7 +407,7 @@ sub SendAlerts { my $borinfo = C4::Members::GetMember('borrowernumber' => $_->{'borrowernumber'}); my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); my $email = $sendAllEmailsTo; - if (!($sendAllEmailsTo && is_email($sendAllEmailsTo))){ + if (!($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo))){ $email = $borinfo->{email} or next; } @@ -526,7 +526,7 @@ sub SendAlerts { my $emailsCC = join( ',', @cc); my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); # some validation. This could be improved. - if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ) { + if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ) { $emailsTo = $sendAllEmailsTo; $emailsCC = ''; } @@ -586,7 +586,7 @@ sub SendAlerts { my $email = Koha::Email->new(); my $emailaddr = $externalid->{'emailaddr'}; my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); - $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); + $emailaddr = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); my %mail = $email->create_message_headers( { to => $emailaddr, @@ -1155,7 +1155,7 @@ sub _send_message_by_email { $to_address = C4::Members::GetNoticeEmailAddress( $message->{'borrowernumber'} ); } my $sendAllEmailsTo = C4::Context->preference('SendAllEmailsTo'); - $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && is_email($sendAllEmailsTo) ); + $to_address = $sendAllEmailsTo if ($sendAllEmailsTo && Email::Valid->address($sendAllEmailsTo) ); unless ($to_address) { if (!$member) { warn "FAIL: No 'to_address' and INVALID borrowernumber ($message->{borrowernumber})"; -- 2.1.4