From: Marcel de Rooy Date: Tue, 6 Nov 2018 14:02:47 +0000 (+0100) Subject: Bug 21771: (follow-up) Revert the shift statement X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=1885e6a2146dfab4784e3d9560161d5f097cfcae;p=koha.git Bug 21771: (follow-up) Revert the shift statement Obviously you should never shift an items from an array if you need that item later on :) Signed-off-by: Marcel de Rooy Tested with entering userid as well as entering email.. Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- diff --git a/opac/opac-password-recovery.pl b/opac/opac-password-recovery.pl index 8a2614730c..2b39e52303 100755 --- a/opac/opac-password-recovery.pl +++ b/opac/opac-password-recovery.pl @@ -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 ) ) {