Bug 21771: (follow-up) Revert the shift statement
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tue, 6 Nov 2018 14:02:47 +0000 (15:02 +0100)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 6 Nov 2018 17:42:20 +0000 (17:42 +0000)
Obviously you should never shift an items from an array if you need that
item later on :)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Tested with entering userid as well as entering email..

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
opac/opac-password-recovery.pl

index 8a26147..2b39e52 100755 (executable)
@@ -75,7 +75,8 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
     elsif ( $borrower = $search_results->next() ) {    # One matching borrower
         my @emails = grep { $_ } ( $borrower->email, $borrower->emailpro, $borrower->B_email );
 
-        my $firstNonEmptyEmail = shift @emails;
+        my $firstNonEmptyEmail;
+        $firstNonEmptyEmail = $emails[0] if @emails;
 
         # Is the given email one of the borrower's ?
         if ( $email && !( grep /^$email$/i, @emails ) ) {