use C4::Accounts;
use C4::Biblio;
use C4::Letters;
-use C4::Members::Attributes qw(SearchIdMatchingAttribute);
use C4::NewsChannels; #get slip news
use DateTime;
use Koha::Database;
@ISA = qw(Exporter);
@EXPORT_OK = qw(
extended_attributes_code_value_arrayref extended_attributes_merge
- SearchIdMatchingAttribute);
+ );
%EXPORT_TAGS = ( all => \@EXPORT_OK );
}
=head1 FUNCTIONS
-=head2 SearchIdMatchingAttribute
-
- my $matching_borrowernumbers = C4::Members::Attributes::SearchIdMatchingAttribute($filter);
-
-=cut
-use Koha::Patrons;
-sub SearchIdMatchingAttribute{
- my $filter = shift;
-
- my @borrowernumbers = Koha::Patrons->filter_by_attribute_value($filter)->get_column('borrowernumber');
- return \@borrowernumbers;
-}
-
=head2 extended_attributes_code_value_arrayref
my $patron_attributes = "homeroom:1150605,grade:01,extradata:foobar";
use C4::Context;
use C4::Utils::DataTables;
use Koha::DateUtils;
-use C4::Members::Attributes qw(SearchIdMatchingAttribute );
sub search {
my ( $params ) = @_;
if ( $searchfieldstype eq 'standard' and C4::Context->preference('ExtendedPatronAttributes') and $searchmember ) {
- my $matching_borrowernumbers = C4::Members::Attributes::SearchIdMatchingAttribute($searchmember);
+ my @matching_borrowernumbers = Koha::Patrons->filter_by_attribute_value($searchmember)->get_column('borrowernumber');
- for my $borrowernumber ( @$matching_borrowernumbers ) {
+ for my $borrowernumber ( @matching_borrowernumbers ) {
push @where_strs_or, "borrowers.borrowernumber = ?";
push @where_args, $borrowernumber;
}
} 'Koha::Exceptions::Patron::Attribute::UniqueIDConstraint';
-my $borrower_numbers = C4::Members::Attributes::SearchIdMatchingAttribute('attribute1');
-is( @$borrower_numbers, 0, 'SearchIdMatchingAttribute searchs only in attributes with staff_searchable=1' );
-for my $attr( split(' ', $attributes->[1]->{attribute}) ) {
- $borrower_numbers = C4::Members::Attributes::SearchIdMatchingAttribute($attr);
- is( $borrower_numbers->[0], $borrowernumber, 'SearchIdMatchingAttribute returns the borrower numbers matching' );
-}
-
-
$patron->get_extended_attribute($attribute->{code})->delete;
$borrower_attributes = $patron->extended_attributes;
is( $borrower_attributes->count, 2, 'delete attribute by code' );