From 00c79c936454fe0f92b42e32ad2ccd5c5d10dc4c Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Wed, 15 Dec 2010 14:25:47 +0100 Subject: [PATCH 1/2] Bug 5904 : ysearch.pl members improvements (Independant branches behaviour) If IntependantBranchesPatron is set, then the search is limited to the librarian branch in circ member auto completion --- circ/ysearch.pl | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/circ/ysearch.pl b/circ/ysearch.pl index f8fc52a..5d4442b 100755 --- a/circ/ysearch.pl +++ b/circ/ysearch.pl @@ -46,8 +46,14 @@ my $sql = qq(SELECT surname, firstname, cardnumber, address, city, zipcode, coun 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%"); -- 1.7.1