5660 Webinstaller should check if KohaOpacLanguage exists in staff
Rebased on April 27 for master (3.05.00.001). Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> Signing off on the whitespace changes made by Paul Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
parent
68a3b6cd90
commit
240edb6c0d
1 changed files with 18 additions and 6 deletions
|
@ -110,18 +110,15 @@ InstallAuth - Authenticates Koha users for Install process
|
|||
sub get_template_and_user {
|
||||
my $in = shift;
|
||||
my $query = $in->{'query'};
|
||||
my $language = $query->cookie('KohaOpacLanguage');
|
||||
my $path =
|
||||
C4::Context->config('intrahtdocs') . "/prog/"
|
||||
. ( $language ? $language : "en" );
|
||||
|
||||
my $language =_get_template_language($query->cookie('KohaOpacLanguage'));
|
||||
my $path = C4::Context->config('intrahtdocs'). "/prog/". $language;
|
||||
|
||||
my $tmplbase = $in->{template_name};
|
||||
$tmplbase=~ s/\.tmpl$/.tt/;
|
||||
my $filename = "$path/modules/" . $tmplbase;
|
||||
my $interface = 'intranet';
|
||||
my $template = C4::Templates->new( $interface, $filename, $tmplbase);
|
||||
|
||||
|
||||
my ( $user, $cookie, $sessionID, $flags ) = checkauth(
|
||||
$in->{'query'},
|
||||
$in->{'authnotrequired'},
|
||||
|
@ -160,6 +157,21 @@ sub get_template_and_user {
|
|||
return ( $template, $borrowernumber, $cookie );
|
||||
}
|
||||
|
||||
sub _get_template_language {
|
||||
#verify if opac language exists in staff (bug 5660)
|
||||
#conditions are 1) dir exists and 2) enabled in prefs
|
||||
my ($opaclang)= @_;
|
||||
return 'en' unless $opaclang;
|
||||
my $path= C4::Context->config('intrahtdocs')."/prog/$opaclang";
|
||||
my $pref= ','.C4::Context->preference('language').',';
|
||||
if(-d $path) {
|
||||
if($pref =~ /,$opaclang,/ ) {
|
||||
return $opaclang;
|
||||
}
|
||||
}
|
||||
return 'en';
|
||||
}
|
||||
|
||||
=item checkauth
|
||||
|
||||
($userid, $cookie, $sessionID) = &checkauth($query, $noauth, $flagsrequired, $type);
|
||||
|
|
Loading…
Reference in a new issue