From b0884b4d59bc411d427511fbaa8db608b25aa13b Mon Sep 17 00:00:00 2001 From: Mason James Date: Sat, 17 Jan 2015 13:19:06 +1300 Subject: [PATCH] Revert commit for bug 13502 --- C4/Members.pm | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/C4/Members.pm b/C4/Members.pm index 8d2a1843f3..9a499011e6 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -863,21 +863,19 @@ sub AddMember { =cut sub Check_Userid { - my ( $uid, $borrowernumber ) = @_; - - return 0 unless ($uid); # userid is a unique column, we should assume NULL is not unique - - return 0 if ( $uid eq C4::Context->config('user') ); - - my $rs = Koha::Database->new()->schema()->resultset('Borrower'); - - my $params; - $params->{userid} = $uid; - $params->{borrowernumber} = { '!=' => $borrowernumber } if ($borrowernumber); - - my $count = $rs->count( $params ); - - return $count ? 0 : 1; + my ($uid,$member) = @_; + my $dbh = C4::Context->dbh; + my $sth = + $dbh->prepare( + "SELECT * FROM borrowers WHERE userid=? AND borrowernumber != ?"); + $sth->execute( $uid, $member ); + if ( (( $uid ne '' ) && ( my $row = $sth->fetchrow_hashref )) or + (( $uid ne '' ) && ( $uid eq C4::Context->config('user') )) ) { + return 0; + } + else { + return 1; + } } =head2 Generate_Userid -- 2.39.5