From 5df5f6a3f162bc66b72d2f92109ee1f3a8aa215a Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 25 Oct 2021 12:44:50 +0000 Subject: [PATCH] Bug 29246: Rename pref template between single quotes Content-Type: text/plain; charset=utf-8 Result of git grep -l "'template'" ':!*.po' | \ xargs sed -i -e "s/'template'/'intranet_theme'/g" Excluding: git checkout -- C4/Biblio.pm git checkout -- Koha/Club/Enrollment.pm git checkout -- Koha/Club/Enrollment/Field.pm git checkout -- Koha/Club/Template.pm git checkout -- Koha/Plugins/Base.pm git checkout -- Koha/Template/Plugin/Cache.pm git checkout -- catalogue/ISBDdetail.pl git checkout -- koha-tmpl/intranet-tmpl/prog/en/modules/labels/label-manage.tt git checkout -- koha-tmpl/intranet-tmpl/prog/en/modules/patroncards/manage.tt git checkout -- labels/label-manage.pl git checkout -- opac/opac-ISBDdetail.pl git checkout -- opac/opac-downloadcart.pl git checkout -- opac/opac-downloadshelf.pl git checkout -- opac/opac-export.pl git checkout -- patroncards/manage.pl git checkout -- t/db_dependent/Illrequests.t --- C4/Koha.pm | 4 ++-- C4/Languages.pm | 2 +- C4/Templates.pm | 4 ++-- Koha/pdfformat/layout2pages.pm | 2 +- Koha/pdfformat/layout2pagesde.pm | 2 +- Koha/pdfformat/layout3pages.pm | 2 +- Koha/pdfformat/layout3pagesfr.pm | 2 +- admin/itemtypes.pl | 2 +- admin/localization.pl | 2 +- admin/preferences.pl | 2 +- admin/systempreferences.pl | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- members/memberentry.pl | 2 +- opac/opac-messaging.pl | 2 +- t/db_dependent/Search.t | 2 +- t/db_dependent/Templates.t | 2 +- tools/letter.pl | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 681d6ff38f..971e7d8ef5 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -126,7 +126,7 @@ returns the full path to the appropriate directory containing images. sub getitemtypeimagedir { my $src = shift || 'opac'; if ($src eq 'intranet') { - return C4::Context->config('intrahtdocs') . '/' .C4::Context->preference('template') . '/img/itemtypeimg'; + return C4::Context->config('intrahtdocs') . '/' .C4::Context->preference('intranet_theme') . '/img/itemtypeimg'; } else { return C4::Context->config('opachtdocs') . '/' . C4::Context->preference('opacthemes') . '/itemtypeimg'; } @@ -135,7 +135,7 @@ sub getitemtypeimagedir { sub getitemtypeimagesrc { my $src = shift || 'opac'; if ($src eq 'intranet') { - return '/intranet-tmpl' . '/' . C4::Context->preference('template') . '/img/itemtypeimg'; + return '/intranet-tmpl' . '/' . C4::Context->preference('intranet_theme') . '/img/itemtypeimg'; } else { return '/opac-tmpl' . '/' . C4::Context->preference('opacthemes') . '/itemtypeimg'; } diff --git a/C4/Languages.pm b/C4/Languages.pm index c05c31bf9e..cded0f6855 100644 --- a/C4/Languages.pm +++ b/C4/Languages.pm @@ -604,7 +604,7 @@ sub getlanguage { $cgi //= CGI->new; my $interface = C4::Context->interface; - my $theme = C4::Context->preference( ( $interface eq 'opac' ) ? 'opacthemes' : 'template' ); + my $theme = C4::Context->preference( ( $interface eq 'opac' ) ? 'opacthemes' : 'intranet_theme' ); my $language; my $preference_to_check = diff --git a/C4/Templates.pm b/C4/Templates.pm index d41c9b534e..859c113c84 100644 --- a/C4/Templates.pm +++ b/C4/Templates.pm @@ -280,8 +280,8 @@ sub availablethemes { # Get theme my @themes; - my $theme_syspref = ($interface eq 'intranet') ? 'template' : 'opacthemes'; - my $fallback_syspref = ($interface eq 'intranet') ? 'template' : 'OPACFallback'; + my $theme_syspref = ($interface eq 'intranet') ? 'intranet_theme' : 'opacthemes'; + my $fallback_syspref = ($interface eq 'intranet') ? 'intranet_theme' : 'OPACFallback'; # Yeah, hardcoded, last resort if the DB is not populated my $hardcoded_theme = ($interface eq 'intranet') ? 'prog' : 'bootstrap'; diff --git a/Koha/pdfformat/layout2pages.pm b/Koha/pdfformat/layout2pages.pm index 365273d8cb..82bda2084c 100644 --- a/Koha/pdfformat/layout2pages.pm +++ b/Koha/pdfformat/layout2pages.pm @@ -246,7 +246,7 @@ sub printfooters { sub printpdf { my ($basketgroup, $bookseller, $baskets, $orders, $GST) = @_; # open the default PDF that will be used for base (1st page already filled) - my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('template') . '/pdf/layout2pages.pdf'; + my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('intranet_theme') . '/pdf/layout2pages.pdf'; my $pdf = PDF::API2->open($pdf_template); $pdf->pageLabel( 0, { -style => 'roman', diff --git a/Koha/pdfformat/layout2pagesde.pm b/Koha/pdfformat/layout2pagesde.pm index bdd4c2760e..f6aa12ea4b 100644 --- a/Koha/pdfformat/layout2pagesde.pm +++ b/Koha/pdfformat/layout2pagesde.pm @@ -245,7 +245,7 @@ sub printfooters { sub printpdf { my ($basketgroup, $bookseller, $baskets, $orders, $GST) = @_; # open the default PDF that will be used for base (1st page already filled) - my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('template') . '/pdf/layout2pagesde.pdf'; + my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('intranet_theme') . '/pdf/layout2pagesde.pdf'; my $pdf = PDF::API2->open($pdf_template); $pdf->pageLabel( 0, { -style => 'roman', diff --git a/Koha/pdfformat/layout3pages.pm b/Koha/pdfformat/layout3pages.pm index 0213c17673..dde46d0038 100644 --- a/Koha/pdfformat/layout3pages.pm +++ b/Koha/pdfformat/layout3pages.pm @@ -413,7 +413,7 @@ sub printfooters { sub printpdf { my ($basketgroup, $bookseller, $baskets, $orders, $GST) = @_; # open the default PDF that will be used for base (1st page already filled) - my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('template') . '/pdf/layout3pages.pdf'; + my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('intranet_theme') . '/pdf/layout3pages.pdf'; my $pdf = PDF::API2->open($pdf_template); $pdf->pageLabel( 0, { -style => 'roman', diff --git a/Koha/pdfformat/layout3pagesfr.pm b/Koha/pdfformat/layout3pagesfr.pm index 21f3f0270d..35969ef12b 100644 --- a/Koha/pdfformat/layout3pagesfr.pm +++ b/Koha/pdfformat/layout3pagesfr.pm @@ -415,7 +415,7 @@ sub printfooters { sub printpdf { my ($basketgroup, $bookseller, $baskets, $orders, $GST) = @_; # open the default PDF that will be used for base (1st page already filled) - my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('template') . '/pdf/layout3pagesfr.pdf'; + my $pdf_template = C4::Context->config('intrahtdocs') . '/' . C4::Context->preference('intranet_theme') . '/pdf/layout3pagesfr.pdf'; my $pdf = PDF::API2->open($pdf_template); $pdf->pageLabel( 0, { -style => 'roman', diff --git a/admin/itemtypes.pl b/admin/itemtypes.pl index 8652c3de9f..a072e1306f 100755 --- a/admin/itemtypes.pl +++ b/admin/itemtypes.pl @@ -60,7 +60,7 @@ if ( $op eq 'add_form' ) { my $parent_types = Koha::ItemTypes->search({parent_type=>undef,itemtype => {'!='=>$itemtype_code}}); my $imagesets = C4::Koha::getImageSets( checked => ( $itemtype ? $itemtype->imageurl : undef ) ); my $searchcategory = GetAuthorisedValues("ITEMTYPECAT"); - my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('template') ); + my $translated_languages = C4::Languages::getTranslatedLanguages( undef , C4::Context->preference('intranet_theme') ); $template->param( itemtype => $itemtype, parent_type => $parent_type, diff --git a/admin/localization.pl b/admin/localization.pl index 58205d8df7..93f9625b3b 100755 --- a/admin/localization.pl +++ b/admin/localization.pl @@ -50,7 +50,7 @@ while ( my $s = $rs->next ) { }; } -my $translated_languages = C4::Languages::getTranslatedLanguages( 'intranet', C4::Context->preference('template') ); +my $translated_languages = C4::Languages::getTranslatedLanguages( 'intranet', C4::Context->preference('intranet_theme') ); $template->param( translations => \@translations, diff --git a/admin/preferences.pl b/admin/preferences.pl index 9e697a6a03..7628d0e7f1 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -83,7 +83,7 @@ sub _get_chunk { } else { # this is the staff interface $interface = 'intranet'; - $theme = C4::Context->preference('template'); + $theme = C4::Context->preference('intranet_theme'); } $chunk->{'languages'} = getTranslatedLanguages( $interface, $theme, undef, $current_languages ); $chunk->{'type'} = 'languages'; diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index 1eb54552b1..7cce4b3ad8 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -184,7 +184,7 @@ sub GetPrefParams { # this is the staff interface $interface = 'intranet'; - $theme = C4::Context->preference('template'); + $theme = C4::Context->preference('intranet_theme'); } my $languages_loop = getTranslatedLanguages( $interface, $theme, $lang, $currently_selected_languages ); diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index dd2f184931..9f561a545a 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -672,7 +672,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('TagsShowOnDetail','10','','Number of tags to display on detail page. 0 is off.','Integer'), ('TagsShowOnList','6','','Number of tags to display on search results list. 0 is off.','Integer'), ('TalkingTechItivaPhoneNotification','0',NULL,'If ON, enables Talking Tech I-tiva phone notifications','YesNo'), -('template','prog','','Define the preferred staff interface template','Themes'), +('intranet_theme','prog','','Define the preferred staff interface template','Themes'), ('ThingISBN','0','','Use with FRBRizeEditions. If ON, Koha will use the ThingISBN web service in the Editions tab on the detail pages.','YesNo'), ('TimeFormat','24hr','12hr|24hr','Defines the global time format for visual output.','Choice'), ('timeout','1d',NULL,'Inactivity timeout for cookies authentication','Free'), diff --git a/members/memberentry.pl b/members/memberentry.pl index 50c86a4c13..d537d683c3 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -866,7 +866,7 @@ if ( defined $min ) { } if ( C4::Context->preference('TranslateNotices') ) { - my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', C4::Context->preference('template') ); + my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', C4::Context->preference('intranet_theme') ); $template->param( languages => $translated_languages ); } diff --git a/opac/opac-messaging.pl b/opac/opac-messaging.pl index 40643830c6..718e249122 100755 --- a/opac/opac-messaging.pl +++ b/opac/opac-messaging.pl @@ -91,7 +91,7 @@ $template->param( ); if ( C4::Context->preference('TranslateNotices') ) { - my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', C4::Context->preference('template') ); + my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', C4::Context->preference('intranet_theme') ); $template->param( languages => $translated_languages, patron_lang => $patron->lang, diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index 8efe5dff86..b6cfdda37c 100755 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -146,7 +146,7 @@ $contextmodule->mock('preference', sub { return '--'; } elsif ($pref eq 'casAuthentication' or $pref eq 'casLogout' or $pref eq 'casServerUrl' ) { return ''; - } elsif ($pref eq 'template') { + } elsif ($pref eq 'intranet_theme') { return 'prog'; } elsif ($pref eq 'OPACXSLTResultsDisplay') { return C4::XSLT::_get_best_default_xslt_filename($htdocs, 'bootstrap','en',$marcflavour . 'slim2OPACResults.xsl'); diff --git a/t/db_dependent/Templates.t b/t/db_dependent/Templates.t index b6c3e7e4ec..25292e01df 100755 --- a/t/db_dependent/Templates.t +++ b/t/db_dependent/Templates.t @@ -67,7 +67,7 @@ subtest 'Testing themelanguage' => sub { my $cgi = CGI->new(); my $htdocs = C4::Context->config('intrahtdocs'); my $section = 'intranet'; - t::lib::Mocks::mock_preference( 'template', 'prog' ); + t::lib::Mocks::mock_preference( 'intranet_theme', 'prog' ); # trigger first case. $testing_language = 'en'; diff --git a/tools/letter.pl b/tools/letter.pl index 68b9eed449..58dca0e3ac 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -161,7 +161,7 @@ sub add_form { if ( C4::Context->preference('TranslateNotices') ) { my $translated_languages = C4::Languages::getTranslatedLanguages( 'opac', - C4::Context->preference('template') ); + C4::Context->preference('intranet_theme') ); for my $language (@$translated_languages) { for my $sublanguage( @{ $language->{sublanguages_loop} } ) { if ( $language->{plural} ) { -- 2.20.1