From 808f48e2aea76032e92d85acf62df38f6b8e1e75 Mon Sep 17 00:00:00 2001 From: Doris Tam Date: Thu, 25 Jul 2024 23:48:30 +0000 Subject: [PATCH] Bug 27490: Update systempreference 'language' to 'StaffInterfaceLanguages' Test plan 1. Go to the staff client 2. Go to administration 3. Search systempreferences for 'StaffInterfaceLanguages' 4. Ensure there is a systempreference variable matching 'StaffInterfaceLanguages' Signed-off-by: David Nind Signed-off-by: Nicolas Hunstein --- C4/Languages.pm | 2 +- Koha/SharedContent.pm | 2 +- .../mysql/atomicupdate/bug_27490-change-syspref.pl | 14 ++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../en/modules/admin/preferences/i18n_l10n.pref | 2 +- 5 files changed, 18 insertions(+), 4 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_27490-change-syspref.pl diff --git a/C4/Languages.pm b/C4/Languages.pm index 079737da8cf..ac176313205 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -115,7 +115,7 @@ sub getTranslatedLanguages { my @languages; my @enabled_languages = ( $interface && $interface eq 'intranet' ) - ? split ",", C4::Context->preference('language') + ? split ",", C4::Context->preference('StaffInterfaceLanguages') : split ",", C4::Context->preference('OPACLanguages'); my $cache = Koha::Caches->get_instance; diff --git a/Koha/SharedContent.pm b/Koha/SharedContent.pm index 0c5e406caf6..08193fbafc7 100644 --- a/Koha/SharedContent.pm +++ b/Koha/SharedContent.pm @@ -133,7 +133,7 @@ Prepare Koha entity data to be sent to Mana KB. sub prepare_entity_data { my ($lang, $loggedinuser, $ressourceid, $ressourcetype) = @_; - $lang ||= C4::Context->preference('language'); + $lang ||= C4::Context->preference('StaffInterfaceLanguages'); my $mana_email; if ( $loggedinuser ne 0 ) { diff --git a/installer/data/mysql/atomicupdate/bug_27490-change-syspref.pl b/installer/data/mysql/atomicupdate/bug_27490-change-syspref.pl new file mode 100755 index 00000000000..58cae586c24 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_27490-change-syspref.pl @@ -0,0 +1,14 @@ +use Modern::Perl; + +return { + bug_number => "27490", + description => "Changing language syspref to StaffInterfaceLanguages", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + $dbh->do(q{UPDATE systempreferences SET variable='StaffInterfaceLanguages' WHERE variable='language'}); + + say $out "Updated system preference 'Change language to StaffInterfaceLanguages'"; + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index a865f86cb2a..4e140968af1 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -362,7 +362,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('KohaManualBaseURL','https://koha-community.org/manual/','','Where is the Koha manual/documentation located?','Free'), ('KohaManualLanguage','en','en|ar|cs|de|es|fr|it|pt_BR|tr|zh_TW','What is the language of the online manual you want to use?','Choice'), ('LabelMARCView','standard','standard|economical','Define how a MARC record will display','Choice'), -('language','en',NULL,'Set the default language in the staff interface.','Languages'), +('StaffInterfaceLanguages','en',NULL,'Set the default language in the staff interface.','Languages'), ('LibraryName','','','Define the library name as displayed on the OPAC',''), ('LibraryThingForLibrariesEnabled','0','','Enable or Disable Library Thing for Libraries Features','YesNo'), ('LibraryThingForLibrariesID','','','See:http://librarything.com/forlibraries/','free'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref index b7f2baa8818..a32c178ebc0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/i18n_l10n.pref @@ -33,7 +33,7 @@ I18N/L10N: - as the first day of week in the calendar. - - "Enable the following languages on the staff interface:" - - pref: language + - pref: StaffInterfaceLanguages type: staff-languages - "This list can be sorted to modify the order of the languages on the interface." - -- 2.39.2