Adding a function in C4/Members/Attributes.pm
Adding a function to search an retrieve attributes
This commit is contained in:
parent
2a4f2098b4
commit
ff063c0486
1 changed files with 28 additions and 1 deletions
|
@ -32,7 +32,8 @@ BEGIN {
|
|||
$VERSION = 3.01;
|
||||
@ISA = qw(Exporter);
|
||||
@EXPORT_OK = qw(GetBorrowerAttributes CheckUniqueness SetBorrowerAttributes
|
||||
extended_attributes_code_value_arrayref extended_attributes_merge);
|
||||
extended_attributes_code_value_arrayref extended_attributes_merge
|
||||
SearchIdMatchingAttribute);
|
||||
%EXPORT_TAGS = ( all => \@EXPORT_OK );
|
||||
}
|
||||
|
||||
|
@ -101,6 +102,32 @@ sub GetBorrowerAttributes {
|
|||
return \@results;
|
||||
}
|
||||
|
||||
=head2 SearchIdMatchingAttribute
|
||||
|
||||
=over 4
|
||||
|
||||
my $matching_records = C4::Members::Attributes::SearchIdMatchingAttribute($filter);
|
||||
|
||||
=back
|
||||
|
||||
|
||||
=cut
|
||||
|
||||
sub SearchIdMatchingAttribute{
|
||||
my $filter = shift;
|
||||
|
||||
my $dbh = C4::Context->dbh();
|
||||
my $query = qq{
|
||||
SELECT borrowernumber
|
||||
FROM borrower_attributes
|
||||
JOIN borrower_attribute_types USING (code)
|
||||
WHERE staff_searchable = 1
|
||||
AND attribute like ?};
|
||||
my $sth = $dbh->prepare_cached($query);
|
||||
$sth->execute($filter);
|
||||
return $sth->fetchall_arrayref;
|
||||
}
|
||||
|
||||
=head2 CheckUniqueness
|
||||
|
||||
=over 4
|
||||
|
|
Loading…
Reference in a new issue