|
Lines 36-45
my $borrower_number;
Link Here
|
| 36 |
|
36 |
|
| 37 |
#errors |
37 |
#errors |
| 38 |
my $hasError; |
38 |
my $hasError; |
|
|
39 |
my $resultCount; |
| 39 |
|
40 |
|
| 40 |
#email form error |
41 |
#email form error |
| 41 |
my $errNoBorrowerFound; |
42 |
my $errNoBorrowerFound; |
| 42 |
my $errNoBorrowerEmail; |
43 |
my $errNoBorrowerEmail; |
|
|
44 |
my $errMultipleAccountsForEmail; |
| 43 |
my $errAlreadyStartRecovery; |
45 |
my $errAlreadyStartRecovery; |
| 44 |
my $errTooManyEmailFound; |
46 |
my $errTooManyEmailFound; |
| 45 |
my $errBadEmail; |
47 |
my $errBadEmail; |
|
Lines 59-72
if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
Link Here
|
| 59 |
# Find the borrower by his userid or email |
61 |
# Find the borrower by his userid or email |
| 60 |
if ($username) { |
62 |
if ($username) { |
| 61 |
$search_results = [ Koha::Patrons->search( { userid => $username } ) ]; |
63 |
$search_results = [ Koha::Patrons->search( { userid => $username } ) ]; |
|
|
64 |
$resultCount = Koha::Patrons->search( { userid => $username } ) -> count |
| 62 |
} |
65 |
} |
| 63 |
elsif ($email) { |
66 |
elsif ($email) { |
| 64 |
$search_results = [ Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email => $email } } ) ]; |
67 |
$search_results = [ Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email => $email } } ) ]; |
|
|
68 |
$resultCount = Koha::Patrons->search( { -or => { email => $email, emailpro => $email, B_email => $email } } ) -> count; |
| 65 |
} |
69 |
} |
| 66 |
if ( not $search_results || scalar @$search_results > 1 ) { |
70 |
|
|
|
71 |
if ( not $search_results || $resultCount < 1) { |
| 72 |
$hasError = 1; |
| 73 |
$errNoBorrowerFound = 1; |
| 74 |
} |
| 75 |
elsif ( $username && scalar $resultCount > 1) { # Multiple accounts for username |
| 67 |
$hasError = 1; |
76 |
$hasError = 1; |
| 68 |
$errNoBorrowerFound = 1; |
77 |
$errNoBorrowerFound = 1; |
| 69 |
} |
78 |
} |
|
|
79 |
elsif ( $email && scalar $resultCount > 1) { # Muliple accounts for E-Mail |
| 80 |
$hasError = 1; |
| 81 |
$errMultipleAccountsForEmail = 1; |
| 82 |
} |
| 70 |
elsif ( $borrower = shift @$search_results ) { # One matching borrower |
83 |
elsif ( $borrower = shift @$search_results ) { # One matching borrower |
| 71 |
$username ||= $borrower->userid; |
84 |
$username ||= $borrower->userid; |
| 72 |
my @emails = ( $borrower->email, $borrower->emailpro, $borrower->B_email ); |
85 |
my @emails = ( $borrower->email, $borrower->emailpro, $borrower->B_email ); |
|
Lines 112-117
if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
Link Here
|
| 112 |
errAlreadyStartRecovery => $errAlreadyStartRecovery, |
125 |
errAlreadyStartRecovery => $errAlreadyStartRecovery, |
| 113 |
errBadEmail => $errBadEmail, |
126 |
errBadEmail => $errBadEmail, |
| 114 |
errNoBorrowerEmail => $errNoBorrowerEmail, |
127 |
errNoBorrowerEmail => $errNoBorrowerEmail, |
|
|
128 |
errMultipleAccountsForEmail => $errMultipleAccountsForEmail, |
| 115 |
password_recovery => 1, |
129 |
password_recovery => 1, |
| 116 |
email => HTML::Entities::encode($email), |
130 |
email => HTML::Entities::encode($email), |
| 117 |
username => $username |
131 |
username => $username |
| 118 |
- |
|
|