From 1e3ec982e42846c3de118f9a9b5a42ddeb0e4f85 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 19 May 2022 07:28:50 +0200 Subject: [PATCH] Bug 21978: Add middle_name to sysprefs.sql And add middle_name at the exact same places for installations with the default value. Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/bug_21978.pl | 9 +++++++-- installer/data/mysql/mandatory/sysprefs.sql | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_21978.pl b/installer/data/mysql/atomicupdate/bug_21978.pl index 42d109ef8a..fdc432fd0f 100755 --- a/installer/data/mysql/atomicupdate/bug_21978.pl +++ b/installer/data/mysql/atomicupdate/bug_21978.pl @@ -37,9 +37,14 @@ return { my ($default_patron_search_fields) = $dbh->selectrow_array( q{ SELECT value FROM systempreferences WHERE variable='DefaultPatronSearchFields'; }); - my @default_patron_search_fields = split(',',$default_patron_search_fields); + my @default_patron_search_fields = split(',', $default_patron_search_fields); unless( grep /middle_name/, @default_patron_search_fields ){ - if( grep /firstname/, @default_patron_search_fields ){ + if ( $default_patron_search_fields eq 'firstname,surname,othernames,cardnumber,userid' ) { + $dbh->do(q{ + UPDATE systempreferences SET value=? WHERE variable='DefaultPatronSearchFields' + }, undef, 'firstname,middle_name,surname,othernames,cardnumber,userid'); + say $out "Added middle name to DefaultPatronSearchFields"; + } elsif( grep /firstname/, @default_patron_search_fields ){ push @default_patron_search_fields,'middle_name'; my $new_patron_search_fields = join(',',@default_patron_search_fields); $dbh->do(q{ diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index a15eb6c112..d2c7ee3bec 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -170,7 +170,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', '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'), +('DefaultPatronSearchFields', 'firstname,middle_name,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'), -- 2.39.5