From 4fa05f4fc748208ddf00491bdc57e23f656fc305 Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Wed, 15 Apr 2020 18:55:33 -0300 Subject: [PATCH] Bug 24973: Install localized sysprefs This patch changes installation files to process and install locale_sysprefs.yml This file must be present on each install dir. It complements sysprefs.sql, and is processed just before it. To test for EN 1) Apply the patch 2) Do a normal install only change to note is a new section when installer reports installed files named 'En data added', 'En' for english and shows locale-syspref.yml 3) Verify no changes on sysprefs values --- C4/Installer.pm | 6 ++++-- installer/install.pl | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/C4/Installer.pm b/C4/Installer.pm index db247e5243..2bbe9e8b57 100644 --- a/C4/Installer.pm +++ b/C4/Installer.pm @@ -312,6 +312,7 @@ moved to a different method. sub load_sql_in_order { my $self = shift; + my $langchoice = shift; my $all_languages = shift; my @sql_list = @_; @@ -330,6 +331,7 @@ sub load_sql_in_order { my $global_mandatory_dir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/mandatory"; # Make sure some stuffs are loaded first + unshift(@fnames, C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/$langchoice/locale_sysprefs.yml"); unshift(@fnames, C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/sysprefs.sql"); unshift(@fnames, "$global_mandatory_dir/subtag_registry.sql", @@ -465,10 +467,10 @@ sub set_languages_syspref { warn "UPDATE Languages"; # intranet my $pref = $self->{'dbh'}->prepare("UPDATE systempreferences SET value=? WHERE variable='language'"); - $pref->execute("en,$language"); + $pref->execute("$language,en"); # opac $pref = $self->{'dbh'}->prepare("UPDATE systempreferences SET value=? WHERE variable='opaclanguages'"); - $pref->execute("en,$language"); + $pref->execute("$language,en"); C4::Context->clear_syspref_cache(); } diff --git a/installer/install.pl b/installer/install.pl index 5bd3806872..c66158da20 100755 --- a/installer/install.pl +++ b/installer/install.pl @@ -245,9 +245,12 @@ elsif ( $step && $step == 3 ) { elsif ( $op && $op eq 'addframeworks' ) { # 1ST install, 3rd sub-step : insert the SQL files the user has selected + my $langchoice = $query->param('fwklanguage'); + $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice); + $langchoice =~ s/[^a-zA-Z_-]*//g; my ( $fwk_language, $list ) = - $installer->load_sql_in_order( $all_languages, + $installer->load_sql_in_order( $langchoice, $all_languages, $query->multi_param('framework') ); $template->param( "fwklanguage" => $fwk_language, -- 2.17.1