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

(-)a/C4/Members.pm (-20 / +2 lines)
Lines 64-70 BEGIN { Link Here
64
        &GetPendingIssues
64
        &GetPendingIssues
65
        &GetAllIssues
65
        &GetAllIssues
66
66
67
        &GetFirstValidEmailAddress
68
        &GetNoticeEmailAddress
67
        &GetNoticeEmailAddress
69
68
70
        &GetMemberAccountRecords
69
        &GetMemberAccountRecords
Lines 879-902 sub get_cardnumber_length { Link Here
879
    return ( $min, $max );
878
    return ( $min, $max );
880
}
879
}
881
880
882
=head2 GetFirstValidEmailAddress
883
884
  $email = GetFirstValidEmailAddress($borrowernumber);
885
886
Return the first valid email address for a borrower, given the borrowernumber.  For now, the order 
887
is defined as email, emailpro, B_email.  Returns the empty string if the borrower has no email 
888
addresses.
889
890
=cut
891
892
sub GetFirstValidEmailAddress {
893
    my $borrowernumber = shift;
894
895
    my $borrower = Koha::Patrons->find( $borrowernumber );
896
897
    return $borrower->first_valid_email_address();
898
}
899
900
=head2 GetNoticeEmailAddress
881
=head2 GetNoticeEmailAddress
901
882
902
  $email = GetNoticeEmailAddress($borrowernumber);
883
  $email = GetNoticeEmailAddress($borrowernumber);
Lines 912-918 sub GetNoticeEmailAddress { Link Here
912
    my $which_address = C4::Context->preference("AutoEmailPrimaryAddress");
893
    my $which_address = C4::Context->preference("AutoEmailPrimaryAddress");
913
    # if syspref is set to 'first valid' (value == OFF), look up email address
894
    # if syspref is set to 'first valid' (value == OFF), look up email address
914
    if ( $which_address eq 'OFF' ) {
895
    if ( $which_address eq 'OFF' ) {
915
        return GetFirstValidEmailAddress($borrowernumber);
896
        my $patron = Koha::Patrons->find( $borrowernumber );
897
        return $patron->first_valid_email_address();
916
    }
898
    }
917
    # specified email address field
899
    # specified email address field
918
    my $dbh = C4::Context->dbh;
900
    my $dbh = C4::Context->dbh;
(-)a/Koha/Patron.pm (+6 lines)
Lines 621-626 sub old_holds { Link Here
621
621
622
=head3 first_valid_email_address
622
=head3 first_valid_email_address
623
623
624
my $first_valid_email_address = $patron->first_valid_email_address
625
626
Return the first valid email address for a patron.
627
For now, the order  is defined as email, emailpro, B_email.
628
Returns the empty string if the borrower has no email addresses.
629
624
=cut
630
=cut
625
631
626
sub first_valid_email_address {
632
sub first_valid_email_address {
(-)a/opac/opac-sendbasket.pl (-2 / +1 lines)
Lines 59-65 if ( $email_add ) { Link Here
59
    });
59
    });
60
    my $email = Koha::Email->new();
60
    my $email = Koha::Email->new();
61
    my $patron = Koha::Patrons->find( $borrowernumber );
61
    my $patron = Koha::Patrons->find( $borrowernumber );
62
    my $user_email = GetFirstValidEmailAddress($borrowernumber)
62
    my $user_email = $patron->first_valid_email_address
63
    || C4::Context->preference('KohaAdminEmailAddress');
63
    || C4::Context->preference('KohaAdminEmailAddress');
64
64
65
    my $email_replyto = $patron->firstname . " " . $patron->surname . " <$user_email>";
65
    my $email_replyto = $patron->firstname . " " . $patron->surname . " <$user_email>";
66
- 

Return to bug 19303