[Koha-bugs] [Bug 36025] New: Extended attributes clause added to patron search query even when there are no searchable attributes

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Feb 7 21:16:26 CET 2024


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36025

            Bug ID: 36025
           Summary: Extended attributes clause added to patron search
                    query even when there are no searchable attributes
 Change sponsored?: ---
           Product: Koha
           Version: 23.11
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P5 - low
         Component: Patrons
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: andreas.jonsson at kreablo.se
        QA Contact: testopia at bugs.koha-community.org
                CC: gmcharlt at gmail.com, kyle.m.hall at gmail.com

In bug 34519 there is a commit labelled "ensure we always have an array":

-            [% SET extended_attribute_types = ExtendedAttributeTypes.codes(
staff_searchable => 1 ) %]
+            [% SET extended_attribute_types = [ ExtendedAttributeTypes.codes(
staff_searchable => 1 ) ] %]

Somehow this expands into an array containing the empty string as an element if
no attributes are searchable by default.

This is likely a bug in DBIx::Class.  It would be better to add the workaround
for this in the ExtendedAtributeTypes template plugin.

The get_column method of ResultSet returns values of type ResultSetColumn
according to the documentation.  But in reality it does not.  It returns an
array.

So we must rely on a bug already by using this method.  Consistently using it
in list context might be helpful as a workaround.

sub codes {
    my ( $self, $params ) = @_;

    my @codes =
Koha::Patron::Attribute::Types->search($params)->get_column('code');

    return \@codes;
}

The consequence is that a clause for extended attributes is added to the patron
search query.  This is significantly slower than not having such a clause, due
to some other issues with DBIx::Class.  (Se bug 33554 and bug 35361.)

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list