Bug 20443: Remove SearchIdMatchingAttribute
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 16 Jul 2018 17:23:27 +0000 (14:23 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 23 Mar 2020 13:49:21 +0000 (13:49 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/Members.pm
C4/Members/Attributes.pm
C4/Utils/DataTables/Members.pm
t/db_dependent/Members/Attributes.t

index 9355436..6c10eee 100644 (file)
@@ -33,7 +33,6 @@ use C4::Reserves;
 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;
index 19b5b9e..76cd6a9 100644 (file)
@@ -32,7 +32,7 @@ BEGIN {
     @ISA = qw(Exporter);
     @EXPORT_OK = qw(
                     extended_attributes_code_value_arrayref extended_attributes_merge
-                    SearchIdMatchingAttribute);
+                    );
     %EXPORT_TAGS = ( all => \@EXPORT_OK );
 }
 
@@ -46,19 +46,6 @@ C4::Members::Attributes - manage extend patron attributes
 
 =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";
index c4726ec..b7887a8 100644 (file)
@@ -4,7 +4,6 @@ use Modern::Perl;
 use C4::Context;
 use C4::Utils::DataTables;
 use Koha::DateUtils;
-use C4::Members::Attributes qw(SearchIdMatchingAttribute );
 
 sub search {
     my ( $params ) = @_;
@@ -131,9 +130,9 @@ sub search {
 
 
         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;
             }
index 32e9c7e..33aa063 100644 (file)
@@ -182,14 +182,6 @@ throws_ok { # Creating a new one, but already exists!
 } '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' );