Bug 18025: Simplify logic and avoid 1 call to ValidateBorrowernumber

Signed-off-by: Liz Rea <liz@catalyst.net.nz>
This is fine with me.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2017-02-15 17:14:11 +00:00 committed by Kyle M Hall
parent 01f69eb8a2
commit a471ad80bb

View file

@ -90,16 +90,14 @@ if ( $query->param('sendEmail') || $query->param('resendEmail') ) {
} }
# Check if a password reset already issued for this borrower AND we are not asking for a new email # Check if a password reset already issued for this borrower AND we are not asking for a new email
elsif ( ValidateBorrowernumber( $borrower->borrowernumber ) elsif ( not $query->param('resendEmail') ) {
&& !$query->param('resendEmail') ) if ( ValidateBorrowernumber( $borrower->borrowernumber ) ) {
{ $hasError = 1;
$hasError = 1; $errAlreadyStartRecovery = 1;
$errAlreadyStartRecovery = 1; }
} else {
elsif ( !ValidateBorrowernumber($borrower->borrowernumber) DeleteExpiredPasswordRecovery( $borrower->borrowernumber );
&& !$query->param('resendEmail') ) }
{
DeleteExpiredPasswordRecovery($borrower->borrowernumber);
} }
} }
else { # 0 matching borrower else { # 0 matching borrower