From ff063c0486956cf3dd75dd475da21b4902a68115 Mon Sep 17 00:00:00 2001 From: Henri-Damien LAURENT Date: Fri, 18 Sep 2009 16:31:07 +0200 Subject: [PATCH] Adding a function in C4/Members/Attributes.pm Adding a function to search an retrieve attributes --- C4/Members/Attributes.pm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/C4/Members/Attributes.pm b/C4/Members/Attributes.pm index 88c6c091be..55e255c8fc 100644 --- a/C4/Members/Attributes.pm +++ b/C4/Members/Attributes.pm @@ -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 -- 2.39.5