X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=circ%2Fysearch.pl;h=628838748e05c2682da15f0fa46d73bd2bbbf444;hb=d52221b316b86d9d239706ebc8854eacb9ac5b8d;hp=136ca76f7baf44b55bcc6eb9a3e6ce4cf494ae7f;hpb=fcdf913432d0f575816630d11ae48f642cd89b53;p=koha.git diff --git a/circ/ysearch.pl b/circ/ysearch.pl index 136ca76f7b..628838748e 100755 --- a/circ/ysearch.pl +++ b/circ/ysearch.pl @@ -45,8 +45,14 @@ my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode FROM borrowers WHERE surname LIKE ? OR firstname LIKE ? - OR cardnumber LIKE ? - ORDER BY surname, firstname); + OR cardnumber LIKE ?); +if (C4::Context->preference("IndependentBranchPatron")){ + if (C4::Context->userenv && (C4::Context->userenv->{flags} % 2) !=1 && C4::Context->userenv->{'branch'}){ + $sql.=" AND borrowers.branchcode =".$dbh->quote(C4::Context->userenv->{'branch'}) unless (C4::Context->userenv->{'branch'} eq "insecure"); + } +} + +$sql .= qq( ORDER BY surname, firstname); my $sth = $dbh->prepare( $sql ); $sth->execute("$query%", "$query%", "$query%");