# decide which template to use
my $template_name;
my @params = $cgi->param("limit");
-if ((@params>1) || ($cgi->param("q")) ) {
+if ((@params>=1) || ($cgi->param("q")) ) {
$template_name = 'catalogue/results.tmpl';
}
else {
# load the branches
my $branches = GetBranches();
my @branch_loop;
-push @branch_loop, {value => "", branchname => "All Branches", };
-for my $branch_hash (keys %$branches) {
+#push @branch_loop, {value => "", branchname => "All Branches", };
+for my $branch_hash (sort keys %$branches) {
push @branch_loop, {value => "branch: $branch_hash", branchname => $branches->{$branch_hash}->{'branchname'}, };
}
$template->param(branchloop => \@branch_loop,);
my $secondary_servers_loop;# = displaySecondaryServers();
$template->param(outer_sup_servers_loop => $secondary_servers_loop,);
- # load the limit types (icon-based limits in advanced search page)
- my $outer_limit_types_loop = displayLimitTypes();
- $template->param(outer_limit_types_loop => $outer_limit_types_loop,);
-
- # load the search indexes (what a user can choose to search by)
- my $indexes = displayIndexes();
-
# 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 = 1; # should be a syspref
for (my $i=0;$i<=$search_boxes_count;$i++) {
- my $this_index =[@$indexes]; # clone the data, not just the reference
- #@$this_index[$i]->{selected} = "selected";
if ($i==0) {
push @search_boxes_array,
- {indexes => $this_index,
+ {
search_boxes_label => 1,
scan_index => 1,
};
}
elsif ($i==$search_boxes_count) {
push @search_boxes_array,
- {indexes => $indexes,
+ {
add_field => "1",};
}
- else {
- push @search_boxes_array,
- {indexes => $indexes,};
- }
+
}
$template->param(uc(C4::Context->preference("marcflavour")) => 1,
search_boxes_loop => \@search_boxes_array);
my $languages_limit_loop = getAllLanguages();
$template->param(search_languages_loop => $languages_limit_loop,);
- # load the subtype limits
- my $outer_subtype_limits_loop = displaySubtypesLimit();
- $template->param(outer_subtype_limits_loop => $outer_subtype_limits_loop,);
-
my $expanded_options;
if (not defined $cgi->param('expanded_options')){
$expanded_options = C4::Context->preference("expandedSearchOption");
# load the sort_by options for the template
my $sort_by = $cgi->param('sort_by');
- my $sort_by_loop = displaySortby($sort_by);
- $template->param(sort_by_loop => $sort_by_loop);
output_html_with_http_headers $cgi, $cookie, $template->output;
exit;
# sort by is used to sort the query
my @sort_by;
@sort_by = split("\0",$params->{'sort_by'}) if $params->{'sort_by'};
-# load the sort_by options for the template
-# my $sort_by = $params->{'sort_by'};
-# my $sort_by_loop = displaySortby($sort_by);
-# $template->param(sort_by_loop => $sort_by_loop);
#
# Use the servers defined, or just search our local catalog(default)
my @servers;
my $query = $params->{'q'};
my $scan = $params->{'scan'};
my $results_per_page = $params->{'count'} || 20;
-my $offset = $params->{'offset'} || 0;
+my $page = $cgi->param('page') || 1;
+my $offset = ($page-1)*$results_per_page;
my $hits;
my $expanded_facet = $params->{'expand'};
my $op=$cgi->param("operation");
if ($op eq "bulkedit"){
my ($countchanged,$listunchanged)=
- EditBiblios($results_hashref->{'biblioserver'}->{"RECORDS"},
+ ModBiblios($results_hashref->{'biblioserver'}->{"RECORDS"},
$params->{"tagsubfield"},
$params->{"inputvalue"},
$params->{"targetvalue"},
if ($server =~/biblioserver/) { # this is the local bibliographic server
$hits = $results_hashref->{$server}->{"hits"};
my $page = $cgi->param('page') || 0;
- my @newresults = searchResults( $search_desc,$hits,$results_per_page,$page,@{$results_hashref->{$server}->{"RECORDS"}});
+ my @newresults = searchResults( $search_desc,$hits,$results_per_page,$offset,@{$results_hashref->{$server}->{"RECORDS"}});
$total = $total + $results_hashref->{$server}->{"hits"};
if ($hits) {
$template->param(total => $hits);
my $ipaddress;
if ( C4::Context->preference("kohaspsuggest") ) {
+ my ($suggest_host, $suggest_dbname, $suggest_user, $suggest_pwd) = split(':', C4::Context->preference("kohaspsuggest"));
eval {
my $koha_spsuggest_dbh;
# FIXME: this needs to be moved to Context.pm
eval {
- $koha_spsuggest_dbh=DBI->connect("DBI:mysql:suggest:66.213.78.76","auth","Free2cirC");
+ $koha_spsuggest_dbh=DBI->connect("DBI:mysql:$suggest_dbname:$suggest_host","$suggest_user","$suggest_pwd");
};
if ($@) {
warn "can't connect to spsuggest db";