use C4::Koha;
use C4::Members qw(GetMember);
use C4::VirtualShelves;
+use URI::Escape;
use POSIX qw(ceil floor);
+use String::Random;
use C4::Branch; # GetBranches
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
# create a new CGI object
# FIXME: no_undef_params needs to be tested
-use CGI qw( -no_undef_params -utf8 );
+use CGI qw('-no_undef_params');
my $cgi = new CGI;
my ($template,$borrowernumber,$cookie);
my $branches = GetBranches();
# Populate branch_loop with all branches sorted by their name. If
-# independantbranches is activated, set the default branch to the borrower
+# IndependentBranches is activated, set the default branch to the borrower
# branch, except for superlibrarian who need to search all libraries.
my $user = C4::Context->userenv;
my @branch_loop = map {
$branches->{$a}->{branchname} cmp $branches->{$b}->{branchname}
} keys %$branches;
-my $categories = GetBranchCategories(undef,'searchdomain');
+my $categories = GetBranchCategories('searchdomain');
$template->param(branchloop => \@branch_loop, searchdomainloop => $categories);
}
# operators include boolean and proximity operators and are used
# to evaluate multiple operands
-my @operators = $cgi->param('op');
+my @operators = map uri_unescape($_), $cgi->param('op');
# indexes are query qualifiers, like 'title', 'author', etc. They
# can be single or multiple parameters separated by comma: kw,right-Truncation
-my @indexes = $cgi->param('idx');
+my @indexes = map uri_unescape($_), $cgi->param('idx');
# if a simple index (only one) display the index used in the top search box
if ($indexes[0] && (!$indexes[1] || $params->{'scan'})) {
$template->param($idx => 1);
}
-
# an operand can be a single term, a phrase, or a complete ccl query
-my @operands = $cgi->param('q');
+my @operands = map uri_unescape($_), $cgi->param('q');
# limits are use to limit to results to a pre-defined category such as branch or language
-my @limits = $cgi->param('limit');
+my @limits = map uri_unescape($_), $cgi->param('limit');
if($params->{'multibranchlimit'}) {
- push @limits, '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
+ my $multibranch = '('.join( " or ", map { "branch: $_ " } @{ GetBranchesInCategory( $params->{'multibranchlimit'} ) } ).')';
+ push @limits, $multibranch if ($multibranch ne '()');
}
my $available;
} #/end of the for loop
#$template->param(FEDERATED_RESULTS => \@results_array);
+$template->{'VARS'}->{'searchid'} = $cgi->param('searchid')
+ || String::Random::random_string('ssssssss');
+my $gotonumber = $cgi->param('gotoNumber');
+if ($gotonumber eq 'last' || $gotonumber eq 'first') {
+ $template->{'VARS'}->{'gotoNumber'} = $gotonumber;
+}
+$template->{'VARS'}->{'gotoPage'} = 'detail.pl';
+my $gotopage = $cgi->param('gotoPage');
+$template->{'VARS'}->{'gotoPage'} = $gotopage
+ if $gotopage =~ m/^(ISBD|labeledMARC|MARC|more)?detail.pl$/;
$template->param(
#classlist => $classlist,