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 <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>
(cherry picked from commit 1885e6a214)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2018-11-06 15:02:47 +01:00 committed by Martin Renvoize
parent fc04b4b1bc
commit 28d1eda94a
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 2 additions and 1 deletions

View File

@ -76,7 +76,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 ) ) {