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)/) {
$results_hashref->{biblioserver}->{RECORDS} = \@marclist;
# FIXME: tag search and standard search should work together, not exclusively
# FIXME: No facets for tags search.
-}
-elsif (C4::Context->preference('NoZebra')) {
- eval {
- ($error, $results_hashref, $facets) = NZgetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
- };
} elsif ($build_grouped_results) {
eval {
($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
$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];
exit;
}
if ($hits) {
- if (!C4::Context->preference('NoZebra') && !$build_grouped_results) {
+ if ( !$build_grouped_results ) {
# We build the encrypted list of first OPACnumSearchResults biblios to pass with the search criteria for paging on opac-detail
$pasarParams .= '&listBiblios=';
my $j = 0;
$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")),