View | Details | Raw Unified | Return to bug 12532
Collapse All | Expand All

(-)a/Koha/Patron.pm (-12 / +10 lines)
Lines 1411-1443 Returns the empty string if no email address. Link Here
1411
1411
1412
=cut
1412
=cut
1413
1413
1414
sub notice_email_address{
1414
sub notice_email_address {
1415
    my ( $self ) = @_;
1415
    my ($self) = @_;
1416
    my $address;
1416
    my $address;
1417
    my $guarantor_address;
1417
    my $guarantor_address;
1418
1418
1419
    my $which_address = C4::Context->preference("EmailFieldPrimary");
1419
    my $which_address = C4::Context->preference("EmailFieldPrimary");
1420
1420
    # if syspref is set to 'first valid' (value == OFF), look up email address
1421
    # if syspref is set to 'first valid' (value == OFF), look up email address
1421
    if ( $which_address eq 'OFF' ) {
1422
    if ( $which_address eq 'OFF' ) {
1422
        $address = $self->first_valid_email_address;
1423
        $address = $self->first_valid_email_address;
1423
    } else {
1424
    }
1425
    else {
1424
        $address = $self->$which_address || '';
1426
        $address = $self->$which_address || '';
1425
    }
1427
    }
1426
1428
1427
    my $use_guarantor = C4::Context->preference('RedirectGuaranteeEmail');
1429
    my $use_guarantor = C4::Context->preference('RedirectGuaranteeEmail');
1428
    if ($use_guarantor) {
1430
    if ($use_guarantor) {
1429
        my @guarantors = map { $_->guarantors->as_list } $self->guarantor_relationships();
1431
        my @guarantors =
1432
          map { $_->guarantors->as_list } $self->guarantor_relationships();
1430
        if (@guarantors) {
1433
        if (@guarantors) {
1431
            foreach my $guarantor (@guarantors) {
1434
            foreach my $guarantor (@guarantors) {
1432
                if ( $which_address eq 'OFF' ) {
1435
                $guarantor_address = $guarantor->notice_email_address;
1433
                    $guarantor_address = $guarantor->first_valid_email_address;
1436
                if ($address) {
1434
                } else {
1435
                    $guarantor_address = $guarantor->$which_address || '';
1436
                }
1437
                if ($address){
1438
                    $address .= ', ';
1437
                    $address .= ', ';
1439
                }
1438
                }
1440
                $address .=  $guarantor_address if $guarantor_address;
1439
                $address .= $guarantor_address if $guarantor_address;
1441
            }
1440
            }
1442
        }
1441
        }
1443
    }
1442
    }
1444
- 

Return to bug 12532