Bug 30063: Sort by "Name" firstname,surname

As it's how it's displayed

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Jonathan Druart 2022-03-30 10:28:34 +02:00 committed by Fridolin Somers
parent 8faf97ee36
commit 7d2d53793b
6 changed files with 20 additions and 6 deletions

View file

@ -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"
});
},
};

View file

@ -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'),

View file

@ -24,7 +24,7 @@
<p><label for="searchfieldstype">Search fields:</label>
<select name="searchfieldstype" id="searchfieldstype">
[% 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 %]

View file

@ -61,7 +61,7 @@
<label for="searchfieldstype_filter">Search field:</label>
<select name="searchfieldstype" id="searchfieldstype_filter">
[% 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" ? "%" : "" )}});

View file

@ -1,6 +1,6 @@
[%- BLOCK patron_fields -%]
[%- SWITCH name -%]
[%- CASE 'surname,firstname,othernames,cardnumber,userid' -%]<span>Standard</span>
[%- CASE 'firstname,surname,othernames,cardnumber,userid' -%]<span>Standard</span>
[%- CASE 'borrowernumber' -%]<span>Borrowernumber</span>
[%- CASE 'cardnumber' -%]<span>Card number</span>
[%- CASE 'surname' -%]<span>Surname</span>

View file

@ -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