@@ -, +, @@ --- C4/Members.pm | 58 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 23 deletions(-) --- a/C4/Members.pm +++ a/C4/Members.pm @@ -409,34 +409,46 @@ sub GetMember { return; } my $dbh = C4::Context->dbh; - my $select = - q{SELECT borrowers.*, categories.category_type, categories.description - FROM borrowers - LEFT JOIN categories on borrowers.categorycode=categories.categorycode WHERE }; - my $more_p = 0; - my @values = (); - for (keys %information ) { - if ($more_p) { - $select .= ' AND '; - } - else { - $more_p++; - } + my $sth; + if (C4::Context->preference('UsernamesCaseSensitive') && defined $information{userid} ){ + my $select = "SELECT * FROM (SELECT borrowers.*, categories.category_type, categories.description + FROM borrowers + LEFT JOIN categories on borrowers.categorycode=categories.categorycode WHERE + userid = ? ) AS firstresult + WHERE BINARY userid = ?"; + $sth = $dbh->prepare($select); + $sth->execute($information{userid},$information{userid}); + } + else { + my $select = + q{SELECT borrowers.*, categories.category_type, categories.description + FROM borrowers + LEFT JOIN categories on borrowers.categorycode=categories.categorycode WHERE }; + my $more_p = 0; + my @values = (); + for (keys %information ) { + if ($more_p) { + $select .= ' AND '; + } + else { + $more_p++; + } - if (defined $information{$_}) { - $select .= "$_ = ?"; - push @values, $information{$_}; - } - else { - $select .= "$_ IS NULL"; + if (defined $information{$_}) { + $select .= "$_ = ?"; + push @values, $information{$_}; + } + else { + $select .= "$_ IS NULL"; + } } + $debug && warn $select, " ",values %information; + $sth = $dbh->prepare("$select"); + $sth->execute(@values); } - $debug && warn $select, " ",values %information; - my $sth = $dbh->prepare("$select"); - $sth->execute(@values); my $data = $sth->fetchall_arrayref({}); #FIXME interface to this routine now allows generation of a result set - #so whole array should be returned but bowhere in the current code expects this + #so whole array should be returned but nowhere in the current code expects this if (@{$data} ) { return $data->[0]; } --