@ -34,7 +34,7 @@ use Koha::Patron::Consent;
use Koha::Patron::Modification ;
use Koha::Patron::Modification ;
use Koha::Patron::Modifications ;
use Koha::Patron::Modifications ;
use C4::Scrubber ;
use C4::Scrubber ;
use Email::Valid ;
use Email::Address ;
use Koha::DateUtils ;
use Koha::DateUtils ;
use Koha::Libraries ;
use Koha::Libraries ;
use Koha::Patron::Attribute::Types ;
use Koha::Patron::Attribute::Types ;
@ -445,7 +445,7 @@ sub CheckForInvalidFields {
my $ borrower = shift ;
my $ borrower = shift ;
my @ invalidFields ;
my @ invalidFields ;
if ( $ borrower - > { 'email' } ) {
if ( $ borrower - > { 'email' } ) {
unless ( Email::Valid - > address ( $ borrower - > { 'email' } ) ) {
unless ( $ borrower - > { 'email' } =~ m/$Email::Address::mailbox/ ) {
push ( @ invalidFields , "email" ) ;
push ( @ invalidFields , "email" ) ;
} elsif ( C4::Context - > preference ( "PatronSelfRegistrationEmailMustBeUnique" ) ) {
} elsif ( C4::Context - > preference ( "PatronSelfRegistrationEmailMustBeUnique" ) ) {
my $ patrons_with_same_email = Koha::Patrons - > search ( # FIXME Should be search_limited?
my $ patrons_with_same_email = Koha::Patrons - > search ( # FIXME Should be search_limited?
@ -471,10 +471,10 @@ sub CheckForInvalidFields {
delete $ borrower - > { 'repeat_email' } ;
delete $ borrower - > { 'repeat_email' } ;
}
}
if ( $ borrower - > { 'emailpro' } ) {
if ( $ borrower - > { 'emailpro' } ) {
push ( @ invalidFields , "emailpro" ) if ( ! Email::Valid - > address ( $ borrower - > { 'emailpro' } ) ) ;
push ( @ invalidFields , "emailpro" ) if ( $ borrower - > { 'emailpro' } !~ m/$Email::Address::mailbox/ ) ;
}
}
if ( $ borrower - > { 'B_email' } ) {
if ( $ borrower - > { 'B_email' } ) {
push ( @ invalidFields , "B_email" ) if ( ! Email::Valid - > address ( $ borrower - > { 'B_email' } ) ) ;
push ( @ invalidFields , "B_email" ) if ( $ borrower - > { 'B_email' } !~ m/$Email::Address::mailbox/ ) ;
}
}
if ( defined $ borrower - > { 'password' }
if ( defined $ borrower - > { 'password' }
and $ borrower - > { 'password' } ne $ borrower - > { 'password2' } )
and $ borrower - > { 'password' } ne $ borrower - > { 'password2' } )