@@ -, +, @@ --- Koha/Patron.pm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) mode change 100644 => 100755 Koha/Patron.pm --- a/Koha/Patron.pm +++ a/Koha/Patron.pm @@ -1325,6 +1325,8 @@ Returns the empty string if no email address. sub notice_email_address{ my ( $self ) = @_; + my $address; + my $guarantor_address; my $which_address = C4::Context->preference("AutoEmailPrimaryAddress"); # if syspref is set to 'first valid' (value == OFF), look up email address @@ -1334,7 +1336,22 @@ sub notice_email_address{ $address = $self->$which_address || ''; } - return $self->$which_address || ''; + my $use_guarantor = C4::Context->preference('RedirectGuaranteeEmail'); + if ($use_guarantor) { + my $guarantor = $self->guarantor; + if ($guarantor) { + if ( $which_address eq 'OFF' ) { + $guarantor_address = $guarantor->first_valid_email_address; + } else { + $guarantor_address = $guarantor->$which_address || ''; + } + if ($address){ + $address .= ', '; + } + $address .= $guarantor_address if $guarantor_address; + } + } + return $address; } =head3 first_valid_email_address --