From b1bb6df88362f2feaf0446e78f374c15956d87aa Mon Sep 17 00:00:00 2001 From: slef Date: Fri, 26 Sep 2003 11:59:36 +0000 Subject: [PATCH] related fix to not change userid if blank --- member-password.pl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/member-password.pl b/member-password.pl index 4a5cd34090..491ccb84ee 100755 --- a/member-password.pl +++ b/member-password.pl @@ -52,14 +52,15 @@ if ( $newpassword ) { my $uid = $input->param('newuserid'); my $dbh=C4::Context->dbh; - #Make sure the userid chosen is unique and not theirs. If it is not, - #Then we need to tell the user and have them create a new one. - my $sth2=$dbh->prepare("select * from borrowers where userid=? and borrowernumber != ?"); - $sth2->execute($uid,$member); + if ($uid eq '') { $uid = $bor->{userid'} } + #Make sure the userid chosen is unique and not theirs. If it is not, + #Then we need to tell the user and have them create a new one. + my $sth2=$dbh->prepare("select * from borrowers where userid=? and borrowernumber != ?"); + $sth2->execute($uid,$member); - if ( $sth2->fetchrow ) { + if ( $sth2->fetchrow ) { #The userid exists so we should display a warning. - my $warn = 1; + my $warn = 1; $template->param( warn => $warn, othernames => $bor->{'othernames'}, surname => $bor->{'surname'}, @@ -67,11 +68,11 @@ if ( $newpassword ) { userid => $bor->{'userid'}, defaultnewpassword => $newpassword ); } else { - #Everything is good so we can update the information. - my $sth=$dbh->prepare("update borrowers set userid=?, password=? where borrowernumber=?"); + #Everything is good so we can update the information. + my $sth=$dbh->prepare("update borrowers set userid=?, password=? where borrowernumber=?"); $sth->execute($uid, $digest, $member); - $template->param(newpassword => $newpassword); - } + $template->param(newpassword => $newpassword); + } } else { my $userid = $bor->{'userid'}; -- 2.11.0