Bugzilla – Attachment 154392 Details for
Bug 34517
Add option to search patron attribute in standard search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34517: Add option search patron attributes by default
Bug-34517-Add-option-search-patron-attributes-by-d.patch (text/plain), 6.94 KB, created by
Nick Clemens (kidclamp)
on 2023-08-11 19:37:30 UTC
(
hide
)
Description:
Bug 34517: Add option search patron attributes by default
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-08-11 19:37:30 UTC
Size:
6.94 KB
patch
obsolete
>From a38b4d07734e7846c1a9fb0f8ac90702d4d60c34 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >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 >--- > admin/patron-attr-types.pl | 2 + > .../prog/en/includes/patron-search.inc | 2 +- > .../en/modules/admin/patron-attr-types.tt | 44 ++++++++++++++++++- > 3 files changed, 46 insertions(+), 2 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 8ea0b10db5..feb0246327 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 c7d2afb18c..fb6993f68f 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 >@@ -165,7 +165,21 @@ Patron attribute types › Administration › Koha > [% ELSE %] > <input type="checkbox" id="staff_searchable" name="staff_searchable" /> > [% END %] >- <span class="hint">Check to make this attribute staff_searchable in the staff patron search.</span> >+ <span class="hint"> >+ Check to make this attribute searchable in staff patron searches. If >+ checked, this attribute will appear in patron search dropdowns. >+ </span> >+ </li> >+ <li><label for="searched_by_default">Search by default: </label> >+ [% IF attribute_type AND attribute_type.searched_by_default %] >+ <input type="checkbox" id="searched_by_default" name="searched_by_default" checked="checked" /> >+ [% ELSE %] >+ <input type="checkbox" id="searched_by_default" name="searched_by_default" /> >+ [% END %] >+ <span class="hint"> >+ If checked, this field will be included in 'Standard' patron searches. Requires >+ field to be marked as searchable above >+ </span> > </li> > <li><label for="mandatory">Mandatory: </label> > [% IF attribute_type AND attribute_type.mandatory %] >@@ -295,6 +309,7 @@ Patron attribute types › Administration › Koha > <th>Library limitation</th> > <th>Authorized value category</th> > <th>Mandatory</th> >+ <th>Searching</th> > <th class="NoSort noExport">Actions</th> > </tr> > </thead> >@@ -334,6 +349,17 @@ Patron attribute types › Administration › Koha > <span>No</span> > [% END %] > </td> >+ <td> >+ [% IF ( item.staff_searchable ) %] >+ [% IF( item.searched_by_default ) %] >+ <span>Searched by default</span> >+ [% ELSE %] >+ <span>Searchable</span> >+ [% END %] >+ [% ELSE %] >+ <span>Not searchable</span> >+ [% END %] >+ </td> > <td class="actions"> > <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=edit_attribute_type&code=[% item.code | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> > <a class="btn btn-default btn-xs" href="[% script_name | url %]?op=delete_attribute_type&code=[% item.code | uri %]"><i class="fa fa-trash-can"></i> Delete</a> >@@ -368,6 +394,22 @@ Patron attribute types › Administration › Koha > [% INCLUDE 'columns_settings.inc' %] > <script> > $(document).ready(function() { >+ >+ function toggle_search_default(){ >+ if( $("#staff_searchable").is(":checked") ){ >+ $("#searched_by_default").prop('disabled', false); >+ } else { >+ >+ $("#searched_by_default").prop('disabled', true).prop('checked',false); >+ } >+ } >+ $("#staff_searchable").on('change',function(){ >+ toggle_search_default(); >+ }); >+ >+ toggle_search_default(); >+ >+ > if ( $("#branches option:selected").length < 1 ) { > $("#branches option:first").attr("selected", "selected"); > } >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34517
:
154389
|
154390
|
154391
|
154392
|
154575
|
154576
|
154577
|
154578
|
154608
|
154610
|
154611
|
154612
|
154613
|
154614
|
154615
|
154616
|
154617
|
154618
|
154619
|
154620
|
154622
|
154623
|
154624
|
154625
|
158429
|
158430
|
158431
|
158432
|
158433
|
158876
|
158878