=item SearchMember
- ($count, $borrowers) = &SearchMember($searchstring, $type,$category_type,$filter,$showallbranches);
+ ($count, $borrowers) = &SearchMember($searchstring, $type,$category_type);
Looks up patrons (borrowers) by name.
must match the beginning a borrower's surname, first name, or other
name.
-C<$filter> is assumed to be a list of elements to filter results on
-
-C<$showallbranches> is used in IndependantBranches Context to display all branches results.
-
C<&SearchMember> returns a two-element list. C<$borrowers> is a
reference-to-array; each element is a reference-to-hash, whose keys
are the fields of the C<borrowers> table in the Koha database.
#used by member enquiries from the intranet
#called by member.pl
sub SearchMember {
- my ($searchstring, $orderby, $type,$category_type,$filter,$showallbranches ) = @_;
+ my ($searchstring, $orderby, $type,$category_type ) = @_;
my $dbh = C4::Context->dbh;
my $query = "";
my $count;
if ( $type eq "simple" ) # simple search for one letter only
{
$query =
- "SELECT *
- FROM borrowers
- LEFT JOIN categories ON borrowers.categorycode=categories.categorycode ".
- ($category_type?" AND category_type = ".$dbh->quote($category_type):"");
- $query .=
- " WHERE (surname LIKE ? OR cardnumber like ?) ";
- if (C4::Context->preference("IndependantBranches") && !$showallbranches){
- if (C4::Context->userenv && C4::Context->userenv->{flags}!=1 && C4::Context->userenv->{'branch'}){
- $query.=" AND borrowers.branchcode =".$dbh->quote(C4::Context->userenv->{'branch'}) unless (C4::Context->userenv->{'branch'} eq "insecure");
- }
- }
- $query.=" ORDER BY $orderby";
+ "SELECT * FROM borrowers
+ LEFT JOIN categories ON borrowers.categorycode=categories.categorycode ".
+ ($category_type?" AND category_type = ".$dbh->quote($category_type):"").
+ " WHERE surname LIKE ? OR cardnumber like ? ORDER BY $orderby";
@bind = ("$searchstring%","$searchstring");
}
else # advanced search looking in surname, firstname and othernames
$count = @data;
$query = "SELECT * FROM borrowers
LEFT JOIN categories ON borrowers.categorycode=categories.categorycode
- WHERE ";
- if (C4::Context->preference("IndependantBranches") && !$showallbranches){
- if (C4::Context->userenv && C4::Context->userenv->{flags}!=1 && C4::Context->userenv->{'branch'}){
- $query.=" borrowers.branchcode =".$dbh->quote(C4::Context->userenv->{'branch'})." AND " unless (C4::Context->userenv->{'branch'} eq "insecure");
- }
- }
- $query.="((surname LIKE ? OR surname LIKE ?
- OR firstname LIKE ? OR firstname LIKE ?
- OR othernames LIKE ? OR othernames LIKE ?)
+ WHERE ((surname LIKE ? OR surname LIKE ?
+ OR firstname LIKE ? OR firstname LIKE ?
+ OR othernames LIKE ? OR othernames LIKE ?)
".
($category_type?" AND category_type = ".$dbh->quote($category_type):"");
@bind = (
my $sth = $dbh->prepare($query);
-# warn "Q $orderby : $query";
+ # warn "Q $orderby : $query";
$sth->execute(@bind);
my @results;
my $data = $sth->fetchall_arrayref({});
<!-- TMPL_IF NAME="borrowernumber" -->
<div id="BorrowerDetails">
- <fieldset>
- <legend><!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" -->
- </legend>
- <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR name="borrowernumber" -->">details</a>
- / <a href="/cgi-bin/koha/members/memberentry.pl?borrowernumber=<!-- TMPL_VAR name="borrowernumber" -->&op=modify&destination=circ&categorycode=<!-- TMPL_VAR name="categorycode" -->">edit</a>
- <p>
- <!--TMPL_IF Name="warndeparture"--><p class="problem"> Patron card expires on <!-- TMPL_VAR name="warndeparture" -->.</p><!--/TMPL_IF-->
- <!-- TMPL_IF NAME="streetaddress"-->
- <!-- TMPL_VAR NAME="streetaddress" -->,
- <!-- TMPL_ELSE -->
- <span class="problem">No address stored for patron.</span>
- <!-- /TMPL_IF -->
- <!-- TMPL_IF NAME="city" -->
- <!-- TMPL_VAR NAME="city" -->
- <!-- TMPL_ELSE -->
- No city stored.
- <!-- /TMPL_IF -->
- <!--TMPL_IF NAME="phone" -->
- <!-- TMPL_VAR NAME="phone" -->
- <!-- TMPL_ELSE -->
- <span class="problem">No phone stored.</span>
- <!-- /TMPL_IF -->
- </p>
- <!-- TMPL_IF NAME="emailaddress" -->
- <a href="mailto:<!-- TMPL_VAR NAME="emailaddress" -->"><!-- TMPL_VAR NAME="emailaddress" --></a>
- <!-- /TMPL_IF -->
- <p>Category: <!-- TMPL_VAR name="categorycode" --></p>
- </fieldset>
+
+
+
<!-- TMPL_IF NAME="overduecount" -->
<span class="problem"><b><big>This borrower has <!-- TMPL_VAR name="overduecount" --> overdue(s) items</big></b></span>
<!--/TMPL_IF-->
<div class="searchresults">
<table>
<tr>
- <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&orderby=cardnumber">Card</a></th>
- <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&orderby=surname">Name</a></th>
- <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&orderby=borrowers.categorycode">Cat</a></th>
- <th><a href="member.pl?member=<!--TMPL_VAR Name="member" -->&orderby=branchcode">Branch</a></th>
+ <th>Card</th>
+ <th>Name</th>
+ <th>Cat</th>
<th>OD/Issues</th>
<th>Fines</th>
<th>Notes</th>
<!-- TMPL_VAR NAME="streetaddress" --> <!-- TMPL_VAR NAME="city" -->
</td>
<td><!-- TMPL_VAR NAME="category_description" --> (<!-- TMPL_VAR name="category_type" -->)</td>
- <td><!-- TMPL_VAR NAME="branchcode" --></td>
<td><!-- TMPL_VAR NAME="odissue" --></td>
<td><!-- TMPL_VAR NAME="fines" --></td>
<td><!-- TMPL_VAR NAME="borrowernotes" --></td>