From 1fd5b42408b31b391c3d13bc57ba7180af2db386 Mon Sep 17 00:00:00 2001 From: Mazen Khallaf Date: Thu, 21 Jan 2021 06:26:54 +0000 Subject: [PATCH] Bug 27491: Rename system preference opaclanguages to OPACLanguages Test Plan: 1. Go to Administration 2. Go to System Preferences 3. Find 'opaclanguages' (note the lack of capitalisation) 4. Apply patch 5. Repeat step 1 and 2 6. Find 'OPACLanguages' (note the use of capitalisation) Signed-off-by: Barbara Johnson --- C4/Installer.pm | 4 ++-- C4/Languages.pm | 4 ++-- ...91-replace_opaclanguages_with_OPAClanguages_syspref.perl | 13 +++++++++++++ .../1-Obligatoire/unimarc_standard_system_preferences.sql | 2 +- installer/data/mysql/localization/de-DE/custom.sql | 2 +- installer/data/mysql/localization/it-IT/custom.sql | 2 +- installer/data/mysql/localization/nb-NO/custom.sql | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- .../system_preferences_full_optimal_for_install_only.sql | 2 +- .../system_preferences_optimal_values_insert_only.sql | 2 +- .../prog/en/modules/admin/preferences/i18n_l10n.pref | 2 +- misc/cronjobs/build_browser_and_cloud.pl | 2 +- t/db_dependent/Auth.t | 2 +- t/db_dependent/Koha/ItemTypes.t | 2 +- t/db_dependent/Search.t | 2 +- 15 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_27491-replace_opaclanguages_with_OPAClanguages_syspref.perl diff --git a/C4/Installer.pm b/C4/Installer.pm index e87109574b..a004cb8150 100644 --- a/C4/Installer.pm +++ b/C4/Installer.pm @@ -474,7 +474,7 @@ sub set_version_syspref { $installer->set_languages_syspref(); -Add the installation language to 'language' and 'opaclanguages' system preferences +Add the installation language to 'language' and 'OPACLanguages' system preferences if different from 'en' =cut @@ -490,7 +490,7 @@ sub set_languages_syspref { my $pref = $self->{'dbh'}->prepare("UPDATE systempreferences SET value=? WHERE variable='language'"); $pref->execute("en,$language"); # opac - $pref = $self->{'dbh'}->prepare("UPDATE systempreferences SET value=? WHERE variable='opaclanguages'"); + $pref = $self->{'dbh'}->prepare("UPDATE systempreferences SET value=? WHERE variable='OPACLanguages'"); $pref->execute("en,$language"); C4::Context->clear_syspref_cache(); diff --git a/C4/Languages.pm b/C4/Languages.pm index 2dc838a353..8042bcdf3f 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -116,7 +116,7 @@ sub getTranslatedLanguages { my @enabled_languages = ( $interface && $interface eq 'intranet' ) ? split ",", C4::Context->preference('language') - : split ",", C4::Context->preference('opaclanguages'); + : split ",", C4::Context->preference('OPACLanguages'); my $cache = Koha::Caches->get_instance; my $cache_key = "languages_${interface}_${theme}"; @@ -609,7 +609,7 @@ sub getlanguage { my $language; my $preference_to_check = - $interface eq 'intranet' ? 'language' : 'opaclanguages'; + $interface eq 'intranet' ? 'language' : 'OPACLanguages'; # Get the available/valid languages list my @languages; my $preference_value = C4::Context->preference($preference_to_check); diff --git a/installer/data/mysql/atomicupdate/bug_27491-replace_opaclanguages_with_OPAClanguages_syspref.perl b/installer/data/mysql/atomicupdate/bug_27491-replace_opaclanguages_with_OPAClanguages_syspref.perl new file mode 100644 index 0000000000..1713cab985 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_27491-replace_opaclanguages_with_OPAClanguages_syspref.perl @@ -0,0 +1,13 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + # you can use $dbh here like: + $dbh->do(q{UPDATE systempreferences set variable="OPACLanguages" WHERE variable="opaclanguages"}); + + # or perform some test and warn + # if( !column_exists( 'biblio', 'biblionumber' ) ) { + # warn "There is something wrong"; + # } + + # Always end with this (adjust the bug info) + NewVersion( $DBversion, 27491, "Description"); +} diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_system_preferences.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_system_preferences.sql index 4d33189bcb..70a7d88dd1 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_system_preferences.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_system_preferences.sql @@ -21,7 +21,7 @@ UPDATE systempreferences SET value = 'M|Mme|Mlle' WHERE variable = 'BorrowersTit UPDATE systempreferences SET value = '676a' WHERE variable = 'itemcallnumber'; UPDATE systempreferences SET value = 'fr-FR' WHERE variable = 'language'; UPDATE systempreferences SET value = 'Ma bibliothèque' WHERE variable = 'LibraryName'; -UPDATE systempreferences SET value = 'fr-FR' WHERE variable = 'opaclanguages'; +UPDATE systempreferences SET value = 'fr-FR' WHERE variable = 'OPACLanguages'; UPDATE systempreferences SET value = 1 WHERE variable = 'opaclanguagesdisplay'; UPDATE systempreferences SET value = 'Bienvenue dans Koha...\r\n
' WHERE variable = 'OpacMainUserBlock'; UPDATE systempreferences SET value = 'bibtex,dc,marcxml,marc8,utf8,marcstd,ris' WHERE variable = 'OpacExportOptions'; diff --git a/installer/data/mysql/localization/de-DE/custom.sql b/installer/data/mysql/localization/de-DE/custom.sql index 812a86b6c2..e4f29543d2 100644 --- a/installer/data/mysql/localization/de-DE/custom.sql +++ b/installer/data/mysql/localization/de-DE/custom.sql @@ -37,5 +37,5 @@ UPDATE systempreferences SET value = '0.07|0.19|0.00' WHERE variable = 'gist'; UPDATE systempreferences SET value = 'Dieser Text wird über den Systemparameter RoutingListNote konfiguriert.' where variable = 'RoutingListNote'; UPDATE systempreferences SET value = 'barcode stocknumber' WHERE variable = 'uniqueitemfields'; UPDATE systempreferences SET value = 'de-DE,en' WHERE variable = 'language'; -UPDATE systempreferences SET value = 'de-DE,en' WHERE variable = 'opaclanguages'; +UPDATE systempreferences SET value = 'de-DE,en' WHERE variable = 'OPACLanguages'; UPDATE systempreferences SET value = '1' WHERE variable = 'opaclanguagesdisplay'; diff --git a/installer/data/mysql/localization/it-IT/custom.sql b/installer/data/mysql/localization/it-IT/custom.sql index 90d0b6d2aa..9dcdf398e7 100644 --- a/installer/data/mysql/localization/it-IT/custom.sql +++ b/installer/data/mysql/localization/it-IT/custom.sql @@ -47,7 +47,7 @@ UPDATE systempreferences SET value = '5' WHERE variable = 'maxreserves'; UPDATE systempreferences SET value = '0' WHERE variable = 'OpacAuthorities'; UPDATE systempreferences SET value = 'title' WHERE variable = 'OPACdefaultSortField'; UPDATE systempreferences SET value = 'asc' WHERE variable = 'OPACdefaultSortOrder'; -UPDATE systempreferences SET value = 'en,it-IT' WHERE variable = 'opaclanguages'; +UPDATE systempreferences SET value = 'en,it-IT' WHERE variable = 'OPACLanguages'; UPDATE systempreferences SET value = '1' WHERE variable = 'opaclanguagesdisplay'; UPDATE systempreferences SET value = '

Benvenuto !!

' WHERE variable = 'OpacMainUserBlock'; UPDATE systempreferences SET value = 'Links importanti qui.' WHERE variable = 'OpacNav'; diff --git a/installer/data/mysql/localization/nb-NO/custom.sql b/installer/data/mysql/localization/nb-NO/custom.sql index 031b37c7ca..fb9938fc56 100644 --- a/installer/data/mysql/localization/nb-NO/custom.sql +++ b/installer/data/mysql/localization/nb-NO/custom.sql @@ -22,7 +22,7 @@ UPDATE systempreferences SET value = 'Fru|Frøken|Herr' WHERE variable = 'Borrow UPDATE systempreferences SET value = 'FR' WHERE variable = 'CurrencyFormat'; UPDATE systempreferences SET value = 'metric' WHERE variable = 'dateformat'; UPDATE systempreferences SET value = 'nb-NO' WHERE variable = 'language'; -UPDATE systempreferences SET value = 'nb-NO' WHERE variable = 'opaclanguages'; +UPDATE systempreferences SET value = 'nb-NO' WHERE variable = 'OPACLanguages'; UPDATE systempreferences SET value = '

Velkommen til Koha...


' WHERE variable = 'OpacMainUserBlock'; UPDATE systempreferences SET value = '

Viktige lenker kan plasseres her

' WHERE variable = 'OpacNav'; UPDATE systempreferences SET value = 'Andre bibliotek (WorldCat)Andre databaser (Google Scholar)Nettbutikker (Bookfinder.com)' WHERE variable = 'OPACSearchForTitleIn'; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 7f0afaa594..7ddffbbfa3 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -412,7 +412,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACItemsResultsDisplay','0','','If OFF : show only the status of items in result list.If ON : show full location of items (branch+location+callnumber) as in staff interface','YesNo'), ('OpacKohaUrl','1',NULL,'Show \'Powered by Koha\' text on OPAC footer.',NULL), ('OpacLangSelectorMode','both','top|both|footer','Select the location to display the language selector in OPAC','Choice'), -('opaclanguages','en',NULL,'Set the default language in the OPAC.','Languages'), +('OPACLanguages','en',NULL,'Set the default language in the OPAC.','Languages'), ('opaclanguagesdisplay','0','','If ON, enables display of Change Language feature on OPAC','YesNo'), ('opaclayoutstylesheet','opac.css','','Enter the name of the layout CSS stylesheet to use in the OPAC','free'), ('OPACLocalCoverImages','0','1','Display local cover images on OPAC search and details pages.','YesNo'), diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql index 24af488cfa..a1c767a878 100644 --- a/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql +++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_full_optimal_for_install_only.sql @@ -25,7 +25,7 @@ UPDATE systempreferences SET value = '1' WHERE variable = 'ExtendedPatronAttribu UPDATE systempreferences SET value = '0.20' WHERE variable = 'gist'; UPDATE systempreferences SET value = '942hv' WHERE variable = 'itemcallnumber'; UPDATE systempreferences SET value = 'ru-RU,uk-UA,en,fr-FR,de-DE' WHERE variable = 'language'; -UPDATE systempreferences SET value = 'ru-RU,uk-UA,en,fr-FR,de-DE' WHERE variable = 'opaclanguages'; +UPDATE systempreferences SET value = 'ru-RU,uk-UA,en,fr-FR,de-DE' WHERE variable = 'OPACLanguages'; UPDATE systempreferences SET value = 'Добро пожаловать в АБИС Koha...\r\n
' WHERE variable = 'OpacMainUserBlock'; UPDATE systempreferences SET value = 'Здесь будут важные ссылки.' WHERE variable = 'OpacNav'; UPDATE systempreferences SET value = '1' WHERE variable = 'patronimages'; diff --git a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql index eb34a8d2b7..b2fcfb5028 100644 --- a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql +++ b/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql @@ -55,7 +55,7 @@ UPDATE systempreferences SET value='metric' WHERE variable='dateformat'; UPDATE systempreferences SET value='ru-RU,uk-UA,en,fr-FR,de-DE' WHERE variable='language'; -UPDATE systempreferences SET value='ru-RU,uk-UA,en,fr-FR,de-DE' WHERE variable='opaclanguages'; +UPDATE systempreferences SET value='ru-RU,uk-UA,en,fr-FR,de-DE' WHERE variable='OPACLanguages'; -- Logs - Протоколы 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 97dcc02082..08bf31333c 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 @@ -44,7 +44,7 @@ I18N/L10N: - patrons to change the language they see on the OPAC. - - "Enable the following languages on the OPAC:" - - pref: opaclanguages + - pref: OPACLanguages type: opac-languages - "This list can be sorted to modify the order of the languages on the interface." - diff --git a/misc/cronjobs/build_browser_and_cloud.pl b/misc/cronjobs/build_browser_and_cloud.pl index ccf3ddfa2f..d6df1be6b7 100755 --- a/misc/cronjobs/build_browser_and_cloud.pl +++ b/misc/cronjobs/build_browser_and_cloud.pl @@ -135,7 +135,7 @@ if ($browser_tag) { print "inserting datas in browser table\n" unless $batch; # read existing classification table is possible my $classification; - if (C4::Context->preference('opaclanguages') =~ m/^fr/i && $browser_tag eq '676' & $browser_subfield eq 'a') { + if (C4::Context->preference('OPACLanguages') =~ m/^fr/i && $browser_tag eq '676' & $browser_subfield eq 'a') { $classification = dewey_french(); } diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t index afe4ccaa81..2c15e577ef 100755 --- a/t/db_dependent/Auth.t +++ b/t/db_dependent/Auth.t @@ -207,7 +207,7 @@ subtest 'checkpw lockout tests' => sub { # Make sure 'EnableOpacSearchHistory' is set t::lib::Mocks::mock_preference('EnableOpacSearchHistory',1); # Enable es-ES for the OPAC and staff interfaces - t::lib::Mocks::mock_preference('opaclanguages','en,es-ES'); + t::lib::Mocks::mock_preference('OPACLanguages','en,es-ES'); t::lib::Mocks::mock_preference('language','en,es-ES'); # we need a session cookie diff --git a/t/db_dependent/Koha/ItemTypes.t b/t/db_dependent/Koha/ItemTypes.t index 22a8bd65a1..157477c4f3 100755 --- a/t/db_dependent/Koha/ItemTypes.t +++ b/t/db_dependent/Koha/ItemTypes.t @@ -102,7 +102,7 @@ ok( defined($type), 'second result' ); is_deeply( $type->unblessed, $child2->unblessed, "We got back the same object" ); t::lib::Mocks::mock_preference('language', 'en'); -t::lib::Mocks::mock_preference('opaclanguages', 'en'); +t::lib::Mocks::mock_preference('OPACLanguages', 'en'); my $itemtypes = Koha::ItemTypes->search_with_localization; is( $itemtypes->count, $initial_count + 4, 'We added 4 item types' ); my $first_itemtype = $itemtypes->next; diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index 93398ebfec..a9a1795bf3 100755 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -137,7 +137,7 @@ $contextmodule->mock('preference', sub { return ''; } elsif ($pref eq 'opacthemes') { return 'bootstrap'; - } elsif ($pref eq 'opaclanguages') { + } elsif ($pref eq 'OPACLanguages') { return 'en'; } elsif ($pref eq 'AlternateHoldingsField') { return '490av'; -- 2.11.0