From 3ffe1d6aa541f65c6a8e60be013cb0eaf82fa054 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 11 Aug 2023 19:31:57 +0000 Subject: [PATCH] Bug 34517: Add option search patron attributes by default This patch moves form any staff_searchable attribute being automatically included in the the Standard patron serch, to allowing the librarian to choose. Current searchable attributes will be marked as 'searched_by_default' To test: 1 - Add a searchable patron attribute type 2 - Add some values 3 - Confirm they are searched in a 'Standard' patron search 4 - Apply patch 5 - Go to admin - >patron attribute types 6 - Note new 'Searching' column 7 - Confirm attribute is 'Searched by default' 8 - Confirm searches work as before 9 - Edit the attribute type 10 - Uncheck 'searched_by_default' 11 - Save 12 - Confirm attribute not searched in 'Standard' search 13 - Select the attribute in patron search dropdowns 14 - Confirm it is correctly searched Signed-off-by: Kelly McElligott Signed-off-by: Katrin Fischer --- admin/patron-attr-types.pl | 2 + .../prog/en/includes/patron-search.inc | 2 +- .../en/modules/admin/patron-attr-types.tt | 44 ++++++++++++++++++- .../intranet-tmpl/prog/js/staff-global.js | 2 +- 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/admin/patron-attr-types.pl b/admin/patron-attr-types.pl index e89b892776..ca5d2fca47 100755 --- a/admin/patron-attr-types.pl +++ b/admin/patron-attr-types.pl @@ -117,6 +117,7 @@ sub add_update_attribute_type { my $opac_display = $input->param('opac_display') ? 1 : 0; my $opac_editable = $input->param('opac_editable') ? 1 : 0; my $staff_searchable = $input->param('staff_searchable') ? 1 : 0; + my $searched_by_default = $input->param('searched_by_default') ? 1 : 0; my $keep_for_pseudonymization = $input->param('keep_for_pseudonymization') ? 1 : 0; my $mandatory = $input->param('mandatory') ? 1 : 0; my $authorised_value_category = $input->param('authorised_value_category'); @@ -152,6 +153,7 @@ sub add_update_attribute_type { opac_display => $opac_display, opac_editable => $opac_editable, staff_searchable => $staff_searchable, + searched_by_default => $searched_by_default, keep_for_pseudonymization => $keep_for_pseudonymization, mandatory => $mandatory, authorised_value_category => $authorised_value_category, 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 36e58d10dd..60015b594c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -233,7 +233,7 @@ }, {}); [% IF Koha.Preference('ExtendedPatronAttributes') %] - [% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1 ) ] %] + [% SET extended_attribute_types = [ ExtendedAttributeTypes.codes( staff_searchable => 1, searched_by_default => 1 ) ] %] let extended_attribute_types = [% To.json(extended_attribute_types || []) | $raw %]; [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt index 0251a18309..fe792072b1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt @@ -169,7 +169,21 @@ [% ELSE %] [% END %] - Check to make this attribute staff_searchable in the staff patron search. + + Check to make this attribute searchable in staff patron searches. If + checked, this attribute will appear in patron search dropdowns. + + +
  • + [% IF attribute_type AND attribute_type.searched_by_default %] + + [% ELSE %] + + [% END %] + + If checked, this field will be included in 'Standard' patron searches. Requires + field to be marked as searchable above +
  • [% IF attribute_type AND attribute_type.mandatory %] @@ -301,6 +315,7 @@ Library limitation Authorized value category Mandatory + Searching Actions @@ -340,6 +355,17 @@ No [% END %] + + [% IF ( item.staff_searchable ) %] + [% IF( item.searched_by_default ) %] + Searched by default + [% ELSE %] + Searchable + [% END %] + [% ELSE %] + Not searchable + [% END %] + Edit Delete @@ -374,6 +400,22 @@ [% INCLUDE 'columns_settings.inc' %]