Lines 51-71
C4::Members::Attributes - manage extend patron attributes
Link Here
|
51 |
my $matching_borrowernumbers = C4::Members::Attributes::SearchIdMatchingAttribute($filter); |
51 |
my $matching_borrowernumbers = C4::Members::Attributes::SearchIdMatchingAttribute($filter); |
52 |
|
52 |
|
53 |
=cut |
53 |
=cut |
54 |
|
54 |
use Koha::Patrons; |
55 |
sub SearchIdMatchingAttribute{ |
55 |
sub SearchIdMatchingAttribute{ |
56 |
my $filter = shift; |
56 |
my $filter = shift; |
57 |
$filter = [$filter] unless ref $filter; |
57 |
|
58 |
|
58 |
my @borrowernumbers = Koha::Patrons->filter_by_attribute_value($filter)->get_column('borrowernumber'); |
59 |
my $dbh = C4::Context->dbh(); |
59 |
return \@borrowernumbers; |
60 |
my $query = qq{ |
|
|
61 |
SELECT DISTINCT borrowernumber |
62 |
FROM borrower_attributes |
63 |
JOIN borrower_attribute_types USING (code) |
64 |
WHERE staff_searchable = 1 |
65 |
AND (} . join (" OR ", map "attribute like ?", @$filter) .qq{)}; |
66 |
my $sth = $dbh->prepare_cached($query); |
67 |
$sth->execute(map "%$_%", @$filter); |
68 |
return [map $_->[0], @{ $sth->fetchall_arrayref }]; |
69 |
} |
60 |
} |
70 |
|
61 |
|
71 |
=head2 extended_attributes_code_value_arrayref |
62 |
=head2 extended_attributes_code_value_arrayref |