Lines 1426-1458
Returns the empty string if no email address.
Link Here
|
1426 |
|
1426 |
|
1427 |
=cut |
1427 |
=cut |
1428 |
|
1428 |
|
1429 |
sub notice_email_address{ |
1429 |
sub notice_email_address { |
1430 |
my ( $self ) = @_; |
1430 |
my ($self) = @_; |
1431 |
my $address; |
1431 |
my $address; |
1432 |
my $guarantor_address; |
1432 |
my $guarantor_address; |
1433 |
|
1433 |
|
1434 |
my $which_address = C4::Context->preference("EmailFieldPrimary"); |
1434 |
my $which_address = C4::Context->preference("EmailFieldPrimary"); |
|
|
1435 |
|
1435 |
# if syspref is set to 'first valid' (value == OFF), look up email address |
1436 |
# if syspref is set to 'first valid' (value == OFF), look up email address |
1436 |
if ( $which_address eq 'OFF' ) { |
1437 |
if ( $which_address eq 'OFF' ) { |
1437 |
$address = $self->first_valid_email_address; |
1438 |
$address = $self->first_valid_email_address; |
1438 |
} else { |
1439 |
} |
|
|
1440 |
else { |
1439 |
$address = $self->$which_address || ''; |
1441 |
$address = $self->$which_address || ''; |
1440 |
} |
1442 |
} |
1441 |
|
1443 |
|
1442 |
my $use_guarantor = C4::Context->preference('RedirectGuaranteeEmail'); |
1444 |
my $use_guarantor = C4::Context->preference('RedirectGuaranteeEmail'); |
1443 |
if ($use_guarantor) { |
1445 |
if ($use_guarantor) { |
1444 |
my @guarantors = map { $_->guarantors->as_list } $self->guarantor_relationships(); |
1446 |
my @guarantors = |
|
|
1447 |
map { $_->guarantors->as_list } $self->guarantor_relationships(); |
1445 |
if (@guarantors) { |
1448 |
if (@guarantors) { |
1446 |
foreach my $guarantor (@guarantors) { |
1449 |
foreach my $guarantor (@guarantors) { |
1447 |
if ( $which_address eq 'OFF' ) { |
1450 |
$guarantor_address = $guarantor->notice_email_address; |
1448 |
$guarantor_address = $guarantor->first_valid_email_address; |
1451 |
if ($address) { |
1449 |
} else { |
|
|
1450 |
$guarantor_address = $guarantor->$which_address || ''; |
1451 |
} |
1452 |
if ($address){ |
1453 |
$address .= ', '; |
1452 |
$address .= ', '; |
1454 |
} |
1453 |
} |
1455 |
$address .= $guarantor_address if $guarantor_address; |
1454 |
$address .= $guarantor_address if $guarantor_address; |
1456 |
} |
1455 |
} |
1457 |
} |
1456 |
} |
1458 |
} |
1457 |
} |
1459 |
- |
|
|