my $limit = $input->param('recentacqui');
-my @branches;
-my @select_branch;
-my %select_branches;
-my $branches = GetBranches();
-my @branchloop;
-foreach my $thisbranch ( keys %$branches ) {
- my $selected = 1
- if ( C4::Context->userenv
- && ( $thisbranch eq C4::Context->userenv->{branch} ) );
- my %row = (
- value => $thisbranch,
- selected => $selected,
- branchname => $branches->{$thisbranch}->{'branchname'},
- );
- push @branchloop, \%row;
-}
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "opac-main.tmpl",
);
}
-my $borrower = GetMember( $borrowernumber,'borrowernumber' );
+# 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;
+ }
+ $template->param("mylibraryfirst"=>1,branchloop=>\@branchloop);
+ } else {
+ $template->param("mylibraryfirst"=>0)
+ }
+}
+
+ my $borrower = GetMember( $borrowernumber,'borrowernumber' );
my @languages;
my $counter = 0;
my $langavail = getTranslatedLanguages('opac');
}
$template->param(
- branchloop => \@branchloop,
textmessaging => $borrower->{textmessaging},
opaclanguagesdisplay => 0,
);
my $all_koha_news = &GetNewsToDisplay( $news_lang );
my $koha_news_count = scalar @$all_koha_news;
+
$template->param(
koha_news => $all_koha_news,
koha_news_count => $koha_news_count