$builder = Koha::SearchEngine::QueryBuilder->new({index => 'biblios'});
$searcher = Koha::SearchEngine::Search->new({index => 'biblios'});
-use C4::Output;
-use C4::Auth qw(:DEFAULT get_session);
-use C4::Languages qw(getLanguages);
-use C4::Search;
+use C4::Output qw( output_html_with_http_headers pagination_bar output_with_http_headers );
+use C4::Auth qw( get_template_and_user get_session );
+use C4::Languages qw( getlanguage getLanguages );
+use C4::Search qw( searchResults );
use C4::Search::History;
-use C4::Biblio; # Unused here?
-use C4::Koha;
-use C4::Tags qw(get_tags);
+use C4::Biblio qw( GetXmlBiblio CountItemsIssued );
+use C4::Koha qw( GetItemTypesCategorized getitemtypeimagelocation GetAuthorisedValues );
+use C4::Tags qw( get_tags get_tag );
use C4::SocialData;
use C4::External::OverDrive;
use C4::External::BakerTaylor qw( image_url link_url );
my $branch_group_limit = $cgi->param("branch_group_limit");
if ( $branch_group_limit ) {
if ( $branch_group_limit =~ /^multibranchlimit-/ ) {
+ # branch_group_limit is deprecated, it should no longer be used
# For search groups we are going to convert this branch_group_limit CGI
- # parameter into a multibranchlimit CGI parameter for the purposes of
+ # parameter into a multibranchlimit limit CGI parameter for the purposes of
# actually performing the query
$cgi->param(
- -name => 'multibranchlimit',
- -values => substr($branch_group_limit, 17)
+ -name => 'limit',
+ -values => 'multibranchlimit:' . substr($branch_group_limit, 17)
);
} else {
$cgi->append(
$template->param( sort_by => $default_sort_by );
}
- # determine what to display next to the search boxes (ie, boolean option
- # shouldn't appear on the first one, scan indexes should, adding a new
- # box should only appear on the last, etc.
- my @search_boxes_array;
- my $search_boxes_count = 3; # begin with 3 boxes
- $template->param( search_boxes_count => $search_boxes_count );
-
- if ($cgi->cookie("num_paragraph")){
- $search_boxes_count = $cgi->cookie("num_paragraph");
- }
-
- for (my $i=1;$i<=$search_boxes_count;$i++) {
- # if it's the first one, don't display boolean option, but show scan indexes
- if ($i==1) {
- push @search_boxes_array,
- {
- scan_index => 1,
- };
-
- }
- # if it's the last one, show the 'add field' box
- elsif ($i==$search_boxes_count) {
- push @search_boxes_array,
- {
- boolean => 1,
- add_field => 1,
- };
- }
- else {
- push @search_boxes_array,
- {
- boolean => 1,
- };
- }
-
- }
-
my @advsearch_limits = split /,/, C4::Context->preference('OpacAdvSearchOptions');
my @advsearch_more_limits = split /,/,
C4::Context->preference('OpacAdvSearchMoreOptions');
$template->param(
uc( C4::Context->preference("marcflavour") ) => 1, # we already did this for UNIMARC
advsearch => 1,
- search_boxes_loop => \@search_boxes_array,
OpacAdvSearchOptions => \@advsearch_limits,
OpacAdvSearchMoreOptions => \@advsearch_more_limits,
);
@limits = map { uri_unescape($_) } @limits;
-if ( $params->{'multibranchlimit'} || ( $branch_group_limit && $branch_group_limit =~ /^multibranchlimit-/ ) ) {
- my $branchfield = C4::Context->preference('SearchLimitLibrary');
- my $search_group = Koha::Library::Groups->find( $params->{multibranchlimit} );
-
- my @branchcodes = map { $_->branchcode } $search_group->all_libraries;
-
- if (@branchcodes) {
- if ( $branchfield eq "homebranch" ) {
- push @limits, sprintf "(%s)", join " or ", map { 'homebranch: ' . $_ } @branchcodes;
- }
- elsif ( $branchfield eq "holdingbranch" ) {
- push @limits, sprintf "(%s)", join " or ", map { 'holdingbranch: ' . $_ } @branchcodes;
- }
- else {
- push @limits, sprintf "(%s or %s)",
- join( " or ", map { 'homebranch: ' . $_ } @branchcodes ),
- join( " or ", map { 'holdingbranch: ' . $_ } @branchcodes );
- }
- }
-}
-
-for ( my $i=0; $i<@limits; $i++ ) {
- if ( $limits[$i] =~ /^branch:/ ) {
- my $branchfield = C4::Context->preference('SearchLimitLibrary');
- if ( $branchfield eq "homebranch" ) {
- $limits[$i] =~ s/branch/homebranch/;
- }
- elsif ( $branchfield eq "holdingbranch" ) {
- $limits[$i] =~ s/branch/holdingbranch/;
- }
- else {
- my $homebranchlimit = $limits[$i];
- my $holdingbranchlimit = $limits[$i];
- $homebranchlimit =~ s/branch/homebranch/;
- $holdingbranchlimit =~ s/branch/holdingbranch/;
- $limits[$i] = "($homebranchlimit or $holdingbranchlimit)";
- }
- }
-}
my $available;
foreach my $limit(@limits) {
# use Data::Dumper; print STDERR "-" x 25, "\n", Dumper($results_hashref);
if (not $tag and ( $@ || $error)) {
- $template->param(query_error => $error.$@);
+ my $query_error = q{};
+ $query_error .= $error if $error;
+ $query_error .= $@ if $@;
+ $template->param(query_error => $query_error);
output_html_with_http_headers $cgi, $cookie, $template->output;
exit;
}
}
$template->param(results_per_page => $results_per_page);
my $hide = ($hidingrules) ? 1 : 0;
- 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 $branchcode;
- if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
- $branchcode = $branch;
- }
- elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
- $branchcode = $ENV{'BRANCHCODE'};
- }
-
- foreach my $res ( @newresults ) {
- my @new_loop;
- my @top_loop;
- my @old_loop = @{$res->{'available_items_loop'}};
- foreach my $item ( @old_loop ) {
- if ( $item->{'branchcode'} eq $branchcode ) {
- $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")),
suppress_result_number => $hide,
);
if (C4::Context->preference("OPACLocalCoverImages")){
{
borrowernumber => $borrowernumber,
add_allowed => 1,
- category => 1,
+ public => 0,
}
);
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
{
borrowernumber => $borrowernumber,
add_allowed => 1,
- category => 2,
+ public => 1,
}
);