-# SearchMyLibraryFirst
-if ( C4::Context->preference("SearchMyLibraryFirst") ) {
- if ( C4::Context->userenv ) {
- my $branches = GetBranches();
- my @branchloop;
-
- foreach my $thisbranch ( keys %$branches ) {
- my $selected = 1
- if ( C4::Context->userenv
- && ( $thisbranch eq C4::Context->userenv->{branch} ) );
-
-# warn $thisbranch;
-# warn C4::Context->userenv;
-# warn C4::Context->userenv->{branch};
-# warn " => ".C4::Context->userenv && ($thisbranch eq C4::Context->userenv->{branch});
- my %row = (
- value => $thisbranch,
- selected => $selected,
- branchname => $branches->{$thisbranch}->{'branchname'},
- );
- push @branchloop, \%row;
+my $news_lang;
+if($input->cookie('KohaOpacLanguage')){
+ $news_lang = $input->cookie('KohaOpacLanguage');
+}else{
+ if ($ENV{HTTP_ACCEPT_LANGUAGE}) {
+ while( !$news_lang && ( $ENV{HTTP_ACCEPT_LANGUAGE} =~ m/([a-zA-Z]{2,}-?[a-zA-Z]*)(;|,)?/g ) ){
+ if( my @lang = grep { /^$1$/i } @languages ) {
+ $news_lang = $lang[0];
+ }