From ff990208912d34e64e921b37fa858ba96e8ddb59 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 30 Mar 2022 10:28:34 +0200 Subject: [PATCH] Bug 30063: Sort by "Name" firstname,surname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As it's how it's displayed Signed-off-by: Séverine Queune --- installer/data/mysql/atomicupdate/bug_30063.pl | 14 ++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../prog/en/includes/patron-search-header.inc | 2 +- .../prog/en/includes/patron-search.inc | 4 ++-- .../prog/en/includes/patronfields.inc | 2 +- .../prog/en/modules/admin/preferences/patrons.pref | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_30063.pl diff --git a/installer/data/mysql/atomicupdate/bug_30063.pl b/installer/data/mysql/atomicupdate/bug_30063.pl new file mode 100755 index 00000000000..385883648c3 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_30063.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "30063", + description => "Fix DefaultPatronSearchFields order", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + $dbh->do(q{ + UPDATE systempreferences SET value="firstname,surname,othernames,cardnumber,userid" + WHERE variable="DefaultPatronSearchFields" AND value="surname,firstname,othernames,cardnumber,userid" + }); + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 94e2463434c..9a4cdbf72f2 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -167,7 +167,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('DefaultLongOverdueChargeValue', '', NULL, "Charge a lost item to the borrower's account when the LOST value of the item changes to n.", 'integer'), ('DefaultLongOverdueDays', '', NULL, "Set the LOST value of an item when the item has been overdue for more than n days.", 'integer'), ('DefaultLongOverdueLostValue', '', NULL, "Set the LOST value of an item to n when the item has been overdue for more than defaultlongoverduedays days.", 'integer'), -('DefaultPatronSearchFields', 'surname,firstname,othernames,cardnumber,userid',NULL,'Comma separated list defining the default fields to be used during a patron search using the "standard" option. If empty Koha will default to "surname,firstname,othernames,cardnumber,userid". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page.','free'), +('DefaultPatronSearchFields', 'firstname,surname,othernames,cardnumber,userid',NULL,'Comma separated list defining the default fields to be used during a patron search using the "standard" option. If empty Koha will default to "firstname,surname,othernames,cardnumber,userid". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page.','free'), ('DefaultSaveRecordFileID','biblionumber','biblionumber|controlnumber','Defines whether the advanced cataloging editor will use the bibliographic record number or control number field to populate the name of the save file','Choice'), ('defaultSortField','relevance','relevance|popularity|call_number|pubdate|acqdate|title|author','Specify the default field used for sorting','Choice'), ('defaultSortOrder','dsc','asc|dsc|az|za','Specify the default sort order','Choice'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc index e7f794d0187..49f3852fa11 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc @@ -24,7 +24,7 @@

[% pref_fields = Koha.Preference('DefaultPatronSearchFields').split(',') %] - [% default_fields = [ 'surname,firstname,othernames,cardnumber,userid', 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %] + [% default_fields = [ 'firstname,surname,othernames,cardnumber,userid', 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %] [% search_options = default_fields.merge(pref_fields).unique %] [% FOREACH s_o IN search_options %] [% display_name = PROCESS patron_fields name=s_o %] @@ -298,7 +298,7 @@ let search_type = $("#searchtype_filter").val() || "contain"; let search_fields = $("#searchfieldstype_filter").val(); if ( !search_fields ) { - search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'surname,firstname,othernames,cardnumber,userid' | html %]"; + search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,surname,othernames,cardnumber,userid' | html %]"; } search_fields.split(',').forEach(function(e,i){ filters.push({["me."+e]:{"like":"%"+filter+(search_type == "contain" ? "%" : "" )}}); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc index 6380e78ecd7..5e1c58f38ee 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc @@ -1,6 +1,6 @@ [%- BLOCK patron_fields -%] [%- SWITCH name -%] - [%- CASE 'surname,firstname,othernames,cardnumber,userid' -%]Standard + [%- CASE 'firstname,surname,othernames,cardnumber,userid' -%]Standard [%- CASE 'borrowernumber' -%]Borrowernumber [%- CASE 'cardnumber' -%]Card number [%- CASE 'surname' -%]Surname diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref index 9ef410f24cd..9836307229a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -48,7 +48,7 @@ Patrons: - "Comma separated list defining the default fields to be used during a patron search using the \"standard\" option:" - pref: DefaultPatronSearchFields class: multi - - "If empty Koha will default to \"surname,firstname,othernames,cardnumber,userid\". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page." + - "If empty Koha will default to \"firstname,surname,othernames,cardnumber,userid\". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page." - - "Show the following fields from the items database table as columns on the statistics tab on the patron record: " - pref: StatisticsFields -- 2.25.1