Bug 29046: Use EmailFieldPrecedence in first_valid_email_address
This patch update the Koha::Patron->first_valid_email_address method to use the newly defined EmailFieldPrecedence preference. Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
ca4283c585
commit
fb7bf8f95e
1 changed files with 10 additions and 1 deletions
|
@ -1436,7 +1436,16 @@ Returns the empty string if the borrower has no email addresses.
|
|||
sub first_valid_email_address {
|
||||
my ($self) = @_;
|
||||
|
||||
return $self->email() || $self->emailpro() || $self->B_email() || q{};
|
||||
my $email = q{};
|
||||
|
||||
my @fields = split /\s*\|\s*/,
|
||||
C4::Context->preference('EmailFieldPrecedence');
|
||||
for my $field (@fields) {
|
||||
$email = $self->$field;
|
||||
last if ( $email ne q{} );
|
||||
}
|
||||
|
||||
return $email;
|
||||
}
|
||||
|
||||
=head3 get_club_enrollments
|
||||
|
|
Loading…
Reference in a new issue