Lines 44-56
if ($auth_status ne "ok") {
Link Here
|
44 |
} |
44 |
} |
45 |
|
45 |
|
46 |
my $dbh = C4::Context->dbh; |
46 |
my $dbh = C4::Context->dbh; |
47 |
my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, country |
47 |
my $sql = q( |
48 |
FROM borrowers |
48 |
SELECT surname, firstname, cardnumber, address, city, zipcode, country |
49 |
WHERE surname LIKE ? |
49 |
FROM borrowers |
50 |
OR firstname LIKE ? |
50 |
WHERE ( surname LIKE ? |
51 |
OR cardnumber LIKE ? |
51 |
OR firstname LIKE ? |
52 |
ORDER BY surname, firstname |
52 |
OR cardnumber LIKE ? ) |
53 |
LIMIT 10); |
53 |
); |
|
|
54 |
if (C4::Context->preference("IndependentBranches")){ |
55 |
if ( C4::Context->userenv |
56 |
&& (C4::Context->userenv->{flags} % 2) !=1 |
57 |
&& C4::Context->userenv->{'branch'} |
58 |
){ |
59 |
$sql .= " AND borrowers.branchcode =" . $dbh->quote(C4::Context->userenv->{'branch'}); |
60 |
} |
61 |
} |
62 |
|
63 |
$sql .= q( ORDER BY surname, firstname LIMIT 10); |
54 |
my $sth = $dbh->prepare( $sql ); |
64 |
my $sth = $dbh->prepare( $sql ); |
55 |
$sth->execute("$query%", "$query%", "$query%"); |
65 |
$sth->execute("$query%", "$query%", "$query%"); |
56 |
|
66 |
|
Lines 68-71
while ( my $rec = $sth->fetchrow_hashref ) {
Link Here
|
68 |
"}"; |
78 |
"}"; |
69 |
$i++; |
79 |
$i++; |
70 |
} |
80 |
} |
71 |
print "]"; |
81 |
print "]"; |
72 |
- |
|
|