Bug 20287: Move fixup_cardnumber
[koha.git] / opac / opac-password-recovery.pl
index 7e6ca2b..456aa97 100755 (executable)
@@ -104,6 +104,10 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
                 DeleteExpiredPasswordRecovery( $borrower->borrowernumber );
             }
         }
+        # Set the $email, if we don't have one.
+        if ( !$hasError && !$email ) {
+            $email = $firstNonEmptyEmail;
+        }
     }
     else {    # 0 matching borrower
         $hasError           = 1;
@@ -123,7 +127,7 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
             username                => $username
         );
     }
-    elsif ( SendPasswordRecoveryEmail( $borrower, $email, $query->param('resendEmail') ) ) {    # generate uuid and send recovery email
+    elsif ( SendPasswordRecoveryEmail( $borrower, $email, scalar $query->param('resendEmail') ) ) {    # generate uuid and send recovery email
         $template->param(
             mail_sent => 1,
             email     => $email