Lines 409-442
sub GetMember {
Link Here
|
409 |
return; |
409 |
return; |
410 |
} |
410 |
} |
411 |
my $dbh = C4::Context->dbh; |
411 |
my $dbh = C4::Context->dbh; |
412 |
my $select = |
412 |
my $sth; |
413 |
q{SELECT borrowers.*, categories.category_type, categories.description |
413 |
if (C4::Context->preference('UsernamesCaseSensitive') && defined $information{userid} ){ |
414 |
FROM borrowers |
414 |
my $select = "SELECT * FROM (SELECT borrowers.*, categories.category_type, categories.description |
415 |
LEFT JOIN categories on borrowers.categorycode=categories.categorycode WHERE }; |
415 |
FROM borrowers |
416 |
my $more_p = 0; |
416 |
LEFT JOIN categories on borrowers.categorycode=categories.categorycode WHERE |
417 |
my @values = (); |
417 |
userid = ? ) AS firstresult |
418 |
for (keys %information ) { |
418 |
WHERE BINARY userid = ?"; |
419 |
if ($more_p) { |
419 |
$sth = $dbh->prepare($select); |
420 |
$select .= ' AND '; |
420 |
$sth->execute($information{userid},$information{userid}); |
421 |
} |
421 |
} |
422 |
else { |
422 |
else { |
423 |
$more_p++; |
423 |
my $select = |
424 |
} |
424 |
q{SELECT borrowers.*, categories.category_type, categories.description |
|
|
425 |
FROM borrowers |
426 |
LEFT JOIN categories on borrowers.categorycode=categories.categorycode WHERE }; |
427 |
my $more_p = 0; |
428 |
my @values = (); |
429 |
for (keys %information ) { |
430 |
if ($more_p) { |
431 |
$select .= ' AND '; |
432 |
} |
433 |
else { |
434 |
$more_p++; |
435 |
} |
425 |
|
436 |
|
426 |
if (defined $information{$_}) { |
437 |
if (defined $information{$_}) { |
427 |
$select .= "$_ = ?"; |
438 |
$select .= "$_ = ?"; |
428 |
push @values, $information{$_}; |
439 |
push @values, $information{$_}; |
429 |
} |
440 |
} |
430 |
else { |
441 |
else { |
431 |
$select .= "$_ IS NULL"; |
442 |
$select .= "$_ IS NULL"; |
|
|
443 |
} |
432 |
} |
444 |
} |
|
|
445 |
$debug && warn $select, " ",values %information; |
446 |
$sth = $dbh->prepare("$select"); |
447 |
$sth->execute(@values); |
433 |
} |
448 |
} |
434 |
$debug && warn $select, " ",values %information; |
|
|
435 |
my $sth = $dbh->prepare("$select"); |
436 |
$sth->execute(@values); |
437 |
my $data = $sth->fetchall_arrayref({}); |
449 |
my $data = $sth->fetchall_arrayref({}); |
438 |
#FIXME interface to this routine now allows generation of a result set |
450 |
#FIXME interface to this routine now allows generation of a result set |
439 |
#so whole array should be returned but bowhere in the current code expects this |
451 |
#so whole array should be returned but nowhere in the current code expects this |
440 |
if (@{$data} ) { |
452 |
if (@{$data} ) { |
441 |
return $data->[0]; |
453 |
return $data->[0]; |
442 |
} |
454 |
} |
443 |
- |
|
|