From 0470b53ec67bdaa53e757b195e26cca7ceff5fdd Mon Sep 17 00:00:00 2001 From: Liz Rea Date: Wed, 12 Aug 2015 16:27:21 +1200 Subject: [PATCH] Bug 8753 - [followup] fix error when no information is provided To test: All normal checks plus make sure that a nice error is displayed when no data is provided. fixing the deprecated thing --- opac/opac-password-recovery.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/opac/opac-password-recovery.pl b/opac/opac-password-recovery.pl index 0688931..bafdb1e 100755 --- a/opac/opac-password-recovery.pl +++ b/opac/opac-password-recovery.pl @@ -54,7 +54,6 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { $email ||= ''; # avoid undef my $borrower; my $search_results; - # Find the borrower by his userid or email if( $username ){ $search_results = [ Koha::Borrowers->search({ userid => $username }) ]; @@ -62,8 +61,11 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) { elsif ( $email ){ $search_results = [ Koha::Borrowers->search({-or => {email => $email, emailpro=> $email, B_email=>$email }}) ]; } - - if(scalar @$search_results > 1){ # Many matching borrowers + if ( not $search_results ){ + $hasError = 1; + $errNoBorrowerFound = 1; + } + elsif(scalar @$search_results > 1){ # Many matching borrowers $hasError = 1; $errTooManyEmailFound = 1; } -- 1.9.1