diff --git a/Koha/Template/Plugin/ExtendedAttributeTypes.pm b/Koha/Template/Plugin/ExtendedAttributeTypes.pm index 9511b7325e..837e014fa8 100644 --- a/Koha/Template/Plugin/ExtendedAttributeTypes.pm +++ b/Koha/Template/Plugin/ExtendedAttributeTypes.pm @@ -33,7 +33,9 @@ sub all { sub codes { my ( $self, $params ) = @_; + return Koha::Patron::Attribute::Types->search($params)->get_column('code'); + } 1; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index ba17bf990f..46dee3a0cd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -286,7 +286,8 @@ }, {}); [% IF Koha.Preference('ExtendedPatronAttributes') %] - [% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) ] %] + [% SET extended_attribute_types = ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) %] + [% IF ( extended_attribute_types ) %][% extended_attribute_types = [ extended_attribute_types ] %][% END %] var extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 522689055f..b219551f6f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -909,7 +909,7 @@ function buildPatronSearchQuery(term, options) { if ( typeof options !== "undefined" && ((options.search_fields == "standard" && - options.extended_attribute_types) || + options.extended_attribute_types.length > 0) || searched_attribute_fields.length > 0) && extendedPatronAttributes ) {