use CGI qw('-no_undef_params');
my $cgi = new CGI;
+my $branch_group_limit = $cgi->param("branch_group_limit");
+if ( $branch_group_limit ) {
+ if ( $branch_group_limit =~ /^multibranchlimit/ ) {
+ $cgi->param(
+ -name => 'multibranchlimit',
+ -values => [ ( split( 'multibranchlimit-', $branch_group_limit ) )[1] ]
+ );
+ } else {
+ $cgi->append(
+ -name => 'limit',
+ -values => [ $branch_group_limit ]
+ );
+ }
+}
+
BEGIN {
if (C4::Context->preference('BakerTaylorEnabled')) {
require C4::External::BakerTaylor;
my $template_type = 'basic';
my @params = $cgi->param("limit");
+
my $format = $cgi->param("format") || '';
my $build_grouped_results = C4::Context->preference('OPACGroupResults');
if ($format =~ /(rss|atom|opensearchdescription)/) {
$newsearchcookie = $cgi->cookie(
-name => 'KohaOpacRecentSearches',
# We uri_escape the whole freezed structure so we're sure we won't have any encoding problems
- -value => uri_escape(freeze(\@recentSearches)),
+ -value =>freeze(\@recentSearches),
-expires => ''
);
$cookie = [$cookie, $newsearchcookie];
$template->param(results_per_page => $results_per_page);
my $hide = C4::Context->preference('OpacHiddenItems');
$hide = ($hide =~ m/\S/) if $hide; # Just in case it has some spaces/new lines
+ my $branch = '';
+ if (C4::Context->userenv){
+ $branch = C4::Context->userenv->{branch};
+ }
+ if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
+ if (
+ ( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )
+ ||
+ C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
+ ) {
+ my $branchname;
+ if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
+ $branchname = $branches->{$branch}->{'branchname'};
+ }
+ elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
+ $branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'};
+ }
+
+ foreach my $res ( @newresults ) {
+ my @new_loop;
+ my @top_loop;
+ my @old_loop = @{$res->{'available_items_loop'}};
+ foreach my $item ( @old_loop ) {
+ if ( $item->{'branchname'} eq $branchname ) {
+ $item->{'this_branch'} = 1;
+ push( @top_loop, $item );
+ } else {
+ push( @new_loop, $item );
+ }
+ }
+ my @complete_loop = ( @top_loop, @new_loop );
+ $res->{'available_items_loop'} = \@complete_loop;
+ }
+ }
+ }
+
$template->param(
SEARCH_RESULTS => \@newresults,
OPACItemsResultsDisplay => (C4::Context->preference("OPACItemsResultsDisplay")),