Modified SearchMember() so that if the patron attributes
feature is on (i.e., ExtendedPatronAttributes is ON), it
is possible to search for patrons on any attributes whose
type is set as staff searchable.
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
# FIXME - .= <<EOT;
}
- $query = $query . ") OR cardnumber LIKE ?
- order by $orderby";
+ $query = $query . ") OR cardnumber LIKE ? ";
push( @bind, $searchstring );
+ if (C4::Context->preference('ExtendedPatronAttributes')) {
+ $query .= "OR borrowernumber IN (
+SELECT borrowernumber
+FROM borrower_attributes
+JOIN borrower_attribute_types USING (code)
+WHERE staff_searchable = 1
+AND attribute like ?
+)";
+ push (@bind, $searchstring);
+ }
+ $query .= "order by $orderby";
# FIXME - .= <<EOT;
}