my $opac_only = @_ ? shift : 0;
my $dbh = C4::Context->dbh();
- my $query = "SELECT code, description, attribute, lib, password
+ my $query = "SELECT code, description, attribute, lib, password, display_checkout
FROM borrower_attributes
JOIN borrower_attribute_types USING (code)
LEFT JOIN authorised_values ON (category = authorised_value_category AND attribute = authorised_value)
value => $row->{'attribute'},
value_description => $row->{'lib'},
password => $row->{'password'},
+ display_checkout => $row->{'display_checkout'},
}
}
return \@results;
=head2 SearchIdMatchingAttribute
- my $matching_records = C4::Members::Attributes::SearchIdMatchingAttribute($filter);
+ my $matching_borrowernumbers = C4::Members::Attributes::SearchIdMatchingAttribute($filter);
=cut
sub SearchIdMatchingAttribute{
my $filter = shift;
- my $finalfilter=$filter->[0];
+ $filter = [$filter] unless ref $filter;
+
my $dbh = C4::Context->dbh();
my $query = qq{
-SELECT borrowernumber
+SELECT DISTINCT borrowernumber
FROM borrower_attributes
JOIN borrower_attribute_types USING (code)
WHERE staff_searchable = 1
-AND attribute like ?};
+AND (} . join (" OR ", map "attribute like ?", @$filter) .qq{)};
my $sth = $dbh->prepare_cached($query);
- $sth->execute("%$finalfilter%");
- return $sth->fetchall_arrayref;
+ $sth->execute(map "%$_%", @$filter);
+ return [map $_->[0], @{ $sth->fetchall_arrayref }];
}
=head2 CheckUniqueness