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 918-941 sub get_cardnumber_length { Link Here
918
    return ( $min, $max );
917
    return ( $min, $max );
919
}
918
}
920
919
921
=head2 GetFirstValidEmailAddress
922
923
  $email = GetFirstValidEmailAddress($borrowernumber);
924
925
Return the first valid email address for a borrower, given the borrowernumber.  For now, the order 
926
is defined as email, emailpro, B_email.  Returns the empty string if the borrower has no email 
927
addresses.
928
929
=cut
930
931
sub GetFirstValidEmailAddress {
932
    my $borrowernumber = shift;
933
934
    my $borrower = Koha::Patrons->find( $borrowernumber );
935
936
    return $borrower->first_valid_email_address();
937
}
938
939
=head2 GetNoticeEmailAddress
920
=head2 GetNoticeEmailAddress
940
921
941
  $email = GetNoticeEmailAddress($borrowernumber);
922
  $email = GetNoticeEmailAddress($borrowernumber);
Lines 951-957 sub GetNoticeEmailAddress { Link Here
951
    my $which_address = C4::Context->preference("AutoEmailPrimaryAddress");
932
    my $which_address = C4::Context->preference("AutoEmailPrimaryAddress");
952
    # if syspref is set to 'first valid' (value == OFF), look up email address
933
    # if syspref is set to 'first valid' (value == OFF), look up email address
953
    if ( $which_address eq 'OFF' ) {
934
    if ( $which_address eq 'OFF' ) {
954
        return GetFirstValidEmailAddress($borrowernumber);
935
        my $patron = Koha::Patrons->find( $borrowernumber );
936
        return $patron->first_valid_email_address();
955
    }
937
    }
956
    # specified email address field
938
    # specified email address field
957
    my $dbh = C4::Context->dbh;
939
    my $dbh = C4::Context->dbh;
(-)a/Koha/Patron.pm (+6 lines)
Lines 595-600 sub holds { Link Here
595
595
596
=head3 first_valid_email_address
596
=head3 first_valid_email_address
597
597
598
my $first_valid_email_address = $patron->first_valid_email_address
599
600
Return the first valid email address for a patron.
601
For now, the order  is defined as email, emailpro, B_email.
602
Returns the empty string if the borrower has no email addresses.
603
598
=cut
604
=cut
599
605
600
sub first_valid_email_address {
606
sub first_valid_email_address {
(-)a/circ/waitingreserves.pl (-1 / +1 lines)
Lines 131-137 foreach my $num (@getreserves) { Link Here
131
    $getreserv{'borrowerfirstname'} = $patron->firstname;
131
    $getreserv{'borrowerfirstname'} = $patron->firstname;
132
    $getreserv{'borrowerphone'}     = $patron->phone;
132
    $getreserv{'borrowerphone'}     = $patron->phone;
133
133
134
    my $borEmail = GetFirstValidEmailAddress( $borrowernum );
134
    my $borEmail = $patron->first_valid_email_address;
135
135
136
    if ( $borEmail ) {
136
    if ( $borEmail ) {
137
        $getreserv{'borrowermail'}  = $borEmail;
137
        $getreserv{'borrowermail'}  = $borEmail;
(-)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