View | Details | Raw Unified | Return to bug 6374
Collapse All | Expand All

(-)a/catalogue/search.pl (-18 / +22 lines)
Lines 440-457 if ($params->{'limit-yr'}) { Link Here
440
# $ %z3950p will be a hash ref if the indexes are present (advacned search), otherwise undef
440
# $ %z3950p will be a hash ref if the indexes are present (advacned search), otherwise undef
441
my $z3950par;
441
my $z3950par;
442
my $indexes2z3950 = {
442
my $indexes2z3950 = {
443
	kw=>'title', au=>'author', 'au,phr'=>'author', nb=>'isbn', ns=>'issn',
443
    kw=>'title', au=>'author', 'au,phr'=>'author', nb=>'isbn', ns=>'issn',
444
	'lcn,phr'=>'dewey', su=>'subject', 'su,phr'=>'subject', 
444
    'lcn,phr'=>'dewey', su=>'subject', 'su,phr'=>'subject', 
445
	ti=>'title', 'ti,phr'=>'title', se=>'title'
445
    ti=>'title', 'ti,phr'=>'title', se=>'title'
446
};
446
};
447
for (my $ii = 0; $ii < @operands; ++$ii)
447
for (my $ii = 0; $ii < @operands; ++$ii)
448
{
448
{
449
	my $name = $indexes2z3950->{$indexes[$ii]};
449
    my $name = $indexes2z3950->{$indexes[$ii]};
450
	if (defined $name && defined $operands[$ii])
450
    if (defined $name && defined $operands[$ii])
451
	{
451
    {
452
		$z3950par ||= {};
452
        $z3950par ||= {};
453
		$z3950par->{$name} = $operands[$ii] if !exists $z3950par->{$name};
453
        $z3950par->{$name} = $operands[$ii] if !exists $z3950par->{$name};
454
	}
454
    }
455
}
455
}
456
456
457
457
Lines 484-492 for my $this_cgi ( split('&',$query_cgi) ) { Link Here
484
    my $input_name = $1;
484
    my $input_name = $1;
485
    my $input_value = $2;
485
    my $input_value = $2;
486
    push @query_inputs, { input_name => $input_name, input_value => $input_value };
486
    push @query_inputs, { input_name => $input_name, input_value => $input_value };
487
	if ($input_name eq 'idx') {
487
    if ($input_name eq 'idx') {
488
    	$scan_index_to_use = $input_value; # unless $scan_index_to_use;
488
        $scan_index_to_use = $input_value; # unless $scan_index_to_use;
489
	}
489
    }
490
}
490
}
491
$template->param ( QUERY_INPUTS => \@query_inputs,
491
$template->param ( QUERY_INPUTS => \@query_inputs,
492
                   scan_index_to_use => $scan_index_to_use );
492
                   scan_index_to_use => $scan_index_to_use );
Lines 552-559 for (my $i=0;$i<@servers;$i++) { Link Here
552
        ## If there's just one result, redirect to the detail page
552
        ## If there's just one result, redirect to the detail page
553
        if ($total == 1) {         
553
        if ($total == 1) {         
554
            my $biblionumber = $newresults[0]->{biblionumber};
554
            my $biblionumber = $newresults[0]->{biblionumber};
555
			my $defaultview = C4::Context->preference('IntranetBiblioDefaultView');
555
            my $defaultview = C4::Context->preference('IntranetBiblioDefaultView');
556
			my $views = { C4::Search::enabled_staff_search_views }; 
556
            my $views = { C4::Search::enabled_staff_search_views }; 
557
            if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) {
557
            if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) {
558
                print $cgi->redirect("/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=$biblionumber");
558
                print $cgi->redirect("/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=$biblionumber");
559
            } elsif  ($defaultview eq 'marc' && $views->{can_view_MARC}) {
559
            } elsif  ($defaultview eq 'marc' && $views->{can_view_MARC}) {
Lines 578-591 for (my $i=0;$i<@servers;$i++) { Link Here
578
            $template->param(limit_desc => $limit_desc);
578
            $template->param(limit_desc => $limit_desc);
579
            $template->param(offset     => $offset);
579
            $template->param(offset     => $offset);
580
            $template->param(DisplayMultiPlaceHold => $DisplayMultiPlaceHold);
580
            $template->param(DisplayMultiPlaceHold => $DisplayMultiPlaceHold);
581
			$template->param (z3950_search_params => C4::Search::z3950_search_args($query_desc));
581
            $template->param (z3950_search_params => C4::Search::z3950_search_args($query_desc));
582
            if ($query_desc || $limit_desc) {
582
            if ($query_desc || $limit_desc) {
583
                $template->param(searchdesc => 1);
583
                $template->param(searchdesc => 1);
584
            }
584
            }
585
            $template->param(stopwords_removed => "@$stopwords_removed") if $stopwords_removed;
585
            $template->param(stopwords_removed => "@$stopwords_removed") if $stopwords_removed;
586
            $template->param(results_per_page =>  $results_per_page);
586
            $template->param(results_per_page =>  $results_per_page);
587
            # must define a value for size if not present in DB
588
            # in order to avoid problems generated by the default size value in TT
589
            foreach my $line (@newresults) {
590
                if ( not exists $line->{'size'} ) { $line->{'size'} = "" }
591
            }
587
            $template->param(SEARCH_RESULTS => \@newresults);
592
            $template->param(SEARCH_RESULTS => \@newresults);
588
589
            ## FIXME: add a global function for this, it's better than the current global one
593
            ## FIXME: add a global function for this, it's better than the current global one
590
            ## Build the page numbers on the bottom of the page
594
            ## Build the page numbers on the bottom of the page
591
            my @page_numbers;
595
            my @page_numbers;
Lines 649-655 for (my $i=0;$i<@servers;$i++) { Link Here
649
        # no hits
653
        # no hits
650
        else {
654
        else {
651
            $template->param(searchdesc => 1,query_desc => $query_desc,limit_desc => $limit_desc);
655
            $template->param(searchdesc => 1,query_desc => $query_desc,limit_desc => $limit_desc);
652
			$template->param (z3950_search_params => C4::Search::z3950_search_args($z3950par || $query_desc));
656
            $template->param (z3950_search_params => C4::Search::z3950_search_args($z3950par || $query_desc));
653
        }
657
        }
654
658
655
    } # end of the if local
659
    } # end of the if local
Lines 679-685 $template->param( Link Here
679
            total => $total,
683
            total => $total,
680
            opacfacets => 1,
684
            opacfacets => 1,
681
            facets_loop => $facets,
685
            facets_loop => $facets,
682
	    displayFacetCount=> C4::Context->preference('displayFacetCount')||0,
686
            displayFacetCount=> C4::Context->preference('displayFacetCount')||0,
683
            scan => $scan,
687
            scan => $scan,
684
            search_error => $error,
688
            search_error => $error,
685
);
689
);
(-)a/cataloguing/addbooks.pl (+3 lines)
Lines 87-92 if ($query) { Link Here
87
    # SimpleSearch() give the results per page we want, so 0 offet here
87
    # SimpleSearch() give the results per page we want, so 0 offet here
88
    my $total = @{$marcresults};
88
    my $total = @{$marcresults};
89
    my @newresults = searchResults( 'intranet', $query, $total, $results_per_page, 0, 0, @{$marcresults} );
89
    my @newresults = searchResults( 'intranet', $query, $total, $results_per_page, 0, 0, @{$marcresults} );
90
    foreach my $line (@newresults) {
91
        if ( not exists $line->{'size'} ) { $line->{'size'} = "" }
92
    }
90
    $template->param(
93
    $template->param(
91
        total          => $total_hits,
94
        total          => $total_hits,
92
        query          => $query,
95
        query          => $query,
(-)a/opac/opac-search.pl (-130 / +133 lines)
Lines 48-57 use CGI qw('-no_undef_params'); Link Here
48
my $cgi = new CGI;
48
my $cgi = new CGI;
49
49
50
BEGIN {
50
BEGIN {
51
	if (C4::Context->preference('BakerTaylorEnabled')) {
51
    if (C4::Context->preference('BakerTaylorEnabled')) {
52
		require C4::External::BakerTaylor;
52
        require C4::External::BakerTaylor;
53
		import C4::External::BakerTaylor qw(&image_url &link_url);
53
        import C4::External::BakerTaylor qw(&image_url &link_url);
54
	}
54
    }
55
}
55
}
56
56
57
my ($template,$borrowernumber,$cookie);
57
my ($template,$borrowernumber,$cookie);
Lines 64-76 my @params = $cgi->param("limit"); Link Here
64
my $format = $cgi->param("format") || '';
64
my $format = $cgi->param("format") || '';
65
my $build_grouped_results = C4::Context->preference('OPACGroupResults');
65
my $build_grouped_results = C4::Context->preference('OPACGroupResults');
66
if ($format =~ /(rss|atom|opensearchdescription)/) {
66
if ($format =~ /(rss|atom|opensearchdescription)/) {
67
	$template_name = 'opac-opensearch.tmpl';
67
    $template_name = 'opac-opensearch.tmpl';
68
}
68
}
69
elsif (@params && $build_grouped_results) {
69
elsif (@params && $build_grouped_results) {
70
    $template_name = 'opac-results-grouped.tmpl';
70
    $template_name = 'opac-results-grouped.tmpl';
71
}
71
}
72
elsif ((@params>=1) || ($cgi->param("q")) || ($cgi->param('multibranchlimit')) || ($cgi->param('limit-yr')) ) {
72
elsif ((@params>=1) || ($cgi->param("q")) || ($cgi->param('multibranchlimit')) || ($cgi->param('limit-yr')) ) {
73
	$template_name = 'opac-results.tmpl';
73
    $template_name = 'opac-results.tmpl';
74
}
74
}
75
else {
75
else {
76
    $template_name = 'opac-advsearch.tmpl';
76
    $template_name = 'opac-advsearch.tmpl';
Lines 89-95 if ($template_name eq 'opac-results.tmpl') { Link Here
89
}
89
}
90
90
91
if ($format eq 'rss2' or $format eq 'opensearchdescription' or $format eq 'atom') {
91
if ($format eq 'rss2' or $format eq 'opensearchdescription' or $format eq 'atom') {
92
	$template->param($format => 1);
92
    $template->param($format => 1);
93
    $template->param(timestamp => strftime("%Y-%m-%dT%H:%M:%S-00:00", gmtime)) if ($format eq 'atom'); 
93
    $template->param(timestamp => strftime("%Y-%m-%dT%H:%M:%S-00:00", gmtime)) if ($format eq 'atom'); 
94
    # FIXME - the timestamp is a hack - the biblio update timestamp should be used for each
94
    # FIXME - the timestamp is a hack - the biblio update timestamp should be used for each
95
    # entry, but not sure if that's worth an extra database query for each bib
95
    # entry, but not sure if that's worth an extra database query for each bib
Lines 104-121 $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHo Link Here
104
$template->param( 'OPACNoResultsFound' => C4::Context->preference('OPACNoResultsFound') );
104
$template->param( 'OPACNoResultsFound' => C4::Context->preference('OPACNoResultsFound') );
105
105
106
if (C4::Context->preference('BakerTaylorEnabled')) {
106
if (C4::Context->preference('BakerTaylorEnabled')) {
107
	$template->param(
107
    $template->param(
108
		BakerTaylorEnabled  => 1,
108
        BakerTaylorEnabled  => 1,
109
		BakerTaylorImageURL => &image_url(),
109
        BakerTaylorImageURL => &image_url(),
110
		BakerTaylorLinkURL  => &link_url(),
110
        BakerTaylorLinkURL  => &link_url(),
111
		BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
111
        BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
112
	);
112
    );
113
}
113
}
114
if (C4::Context->preference('TagsEnabled')) {
114
if (C4::Context->preference('TagsEnabled')) {
115
	$template->param(TagsEnabled => 1);
115
    $template->param(TagsEnabled => 1);
116
	foreach (qw(TagsShowOnList TagsInputOnList)) {
116
    foreach (qw(TagsShowOnList TagsInputOnList)) {
117
		C4::Context->preference($_) and $template->param($_ => 1);
117
        C4::Context->preference($_) and $template->param($_ => 1);
118
	}
118
    }
119
}
119
}
120
120
121
## URI Re-Writing
121
## URI Re-Writing
Lines 163-194 my $cnt; Link Here
163
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
163
my $advanced_search_types = C4::Context->preference("AdvancedSearchTypes");
164
164
165
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
165
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
166
	foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
166
    foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
167
	    my %row =(  number=>$cnt++,
167
        my %row =(  number=>$cnt++,
168
		ccl => "$itype_or_itemtype,phr",
168
        ccl => "$itype_or_itemtype,phr",
169
                code => $thisitemtype,
169
                code => $thisitemtype,
170
                selected => $selected,
170
                selected => $selected,
171
                description => $itemtypes->{$thisitemtype}->{'description'},
171
                description => $itemtypes->{$thisitemtype}->{'description'},
172
                count5 => $cnt % 4,
172
                count5 => $cnt % 4,
173
                imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ),
173
                imageurl=> getitemtypeimagelocation( 'opac', $itemtypes->{$thisitemtype}->{'imageurl'} ),
174
            );
174
            );
175
    	$selected = 0; # set to zero after first pass through
175
        $selected = 0; # set to zero after first pass through
176
    	push @itemtypesloop, \%row;
176
        push @itemtypesloop, \%row;
177
	}
177
    }
178
} else {
178
} else {
179
    my $advsearchtypes = GetAuthorisedValues($advanced_search_types, '', 'opac');
179
    my $advsearchtypes = GetAuthorisedValues($advanced_search_types, '', 'opac');
180
	for my $thisitemtype (@$advsearchtypes) {
180
    for my $thisitemtype (@$advsearchtypes) {
181
		my %row =(
181
        my %row =(
182
				number=>$cnt++,
182
                number=>$cnt++,
183
				ccl => $advanced_search_types,
183
                ccl => $advanced_search_types,
184
                code => $thisitemtype->{authorised_value},
184
                code => $thisitemtype->{authorised_value},
185
                selected => $selected,
185
                selected => $selected,
186
                description => $thisitemtype->{'lib'},
186
                description => $thisitemtype->{'lib'},
187
                count5 => $cnt % 4,
187
                count5 => $cnt % 4,
188
                imageurl=> getitemtypeimagelocation( 'opac', $thisitemtype->{'imageurl'} ),
188
                imageurl=> getitemtypeimagelocation( 'opac', $thisitemtype->{'imageurl'} ),
189
            );
189
            );
190
		push @itemtypesloop, \%row;
190
        push @itemtypesloop, \%row;
191
	}
191
    }
192
}
192
}
193
$template->param(itemtypeloop => \@itemtypesloop);
193
$template->param(itemtypeloop => \@itemtypesloop);
194
194
Lines 244-263 if ( $template_type && $template_type eq 'advsearch' ) { Link Here
244
        }
244
        }
245
245
246
    }
246
    }
247
    $template->param(uc(C4::Context->preference("marcflavour")) => 1,   # we already did this for UNIMARC
247
    $template->param(uc(    C4::Context->preference("marcflavour")) => 1,   # we already did this for UNIMARC
248
					  advsearch => 1,
248
                            advsearch => 1,
249
                      search_boxes_loop => \@search_boxes_array);
249
                            search_boxes_loop => \@search_boxes_array);
250
250
251
# use the global setting by default
251
    # use the global setting by default
252
	if ( C4::Context->preference("expandedSearchOption") == 1 ) {
252
    if ( C4::Context->preference("expandedSearchOption") == 1 ) {
253
		$template->param( expanded_options => C4::Context->preference("expandedSearchOption") );
253
        $template->param( expanded_options => C4::Context->preference("expandedSearchOption") );
254
	}
254
    }
255
	# but let the user override it
255
    # but let the user override it
256
	if (defined $cgi->param('expanded_options')) {
256
    if (defined $cgi->param('expanded_options')) {
257
   	    if ( ($cgi->param('expanded_options') == 0) || ($cgi->param('expanded_options') == 1 ) ) {
257
        if ( ($cgi->param('expanded_options') == 0) || ($cgi->param('expanded_options') == 1 ) ) {
258
    	    $template->param( expanded_options => $cgi->param('expanded_options'));
258
            $template->param( expanded_options => $cgi->param('expanded_options'));
259
	    }
260
        }
259
        }
260
    }
261
    output_html_with_http_headers $cgi, $cookie, $template->output;
261
    output_html_with_http_headers $cgi, $cookie, $template->output;
262
    exit;
262
    exit;
263
}
263
}
Lines 284-291 for (keys %$params) { Link Here
284
        $j++;
284
        $j++;
285
    }
285
    }
286
}
286
}
287
#
288
289
287
290
# Params that can have more than one value
288
# Params that can have more than one value
291
# sort by is used to sort the query
289
# sort by is used to sort the query
Lines 430-444 my $results_hashref; Link Here
430
my @coins;
428
my @coins;
431
429
432
if ($tag) {
430
if ($tag) {
433
	$query_cgi = "tag=" .$tag . "&" . $query_cgi;
431
    $query_cgi = "tag=" .$tag . "&" . $query_cgi;
434
	my $taglist = get_tags({term=>$tag, approved=>1});
432
    my $taglist = get_tags({term=>$tag, approved=>1});
435
	$results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
433
    $results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
436
	my @biblist  = (map {GetBiblioData($_->{biblionumber})} @$taglist);
434
    my @biblist  = (map {GetBiblioData($_->{biblionumber})} @$taglist);
437
	my @marclist = (map {$_->{marc}} @biblist );
435
    my @marclist = (map {$_->{marc}} @biblist );
438
	$DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
436
    $DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
439
	$results_hashref->{biblioserver}->{RECORDS} = \@marclist;
437
    $results_hashref->{biblioserver}->{RECORDS} = \@marclist;
440
	# FIXME: tag search and standard search should work together, not exclusively
438
    # FIXME: tag search and standard search should work together, not exclusively
441
	# FIXME: No facets for tags search.
439
    # FIXME: No facets for tags search.
442
}
440
}
443
elsif (C4::Context->preference('NoZebra')) {
441
elsif (C4::Context->preference('NoZebra')) {
444
    eval {
442
    eval {
Lines 494-569 for (my $i=0;$i<@servers;$i++) { Link Here
494
            @newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan,
492
            @newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan,
495
                                        @{$results_hashref->{$server}->{"RECORDS"}},, C4::Context->preference('hidelostitems'));
493
                                        @{$results_hashref->{$server}->{"RECORDS"}},, C4::Context->preference('hidelostitems'));
496
        }
494
        }
497
		my $tag_quantity;
495
        
498
		if (C4::Context->preference('TagsEnabled') and
496
        # must define a value for size if not present in DB
499
			$tag_quantity = C4::Context->preference('TagsShowOnList')) {
497
        # in order to avoid problems generated by the default size value in TT
500
			foreach (@newresults) {
498
        foreach my $line (@newresults) {
501
				my $bibnum = $_->{biblionumber} or next;
499
            if ( not exists $line->{'size'} ) { $line->{'size'} = "" }
502
				$_->{itemsissued} = CountItemsIssued( $bibnum );
500
        }
503
				$_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight',
501
        
504
										limit=>$tag_quantity });
502
        my $tag_quantity;
505
			}
503
        if (C4::Context->preference('TagsEnabled') and
506
		}
504
            $tag_quantity = C4::Context->preference('TagsShowOnList')) {
507
                if (C4::Context->preference('COinSinOPACResults')) {
505
            foreach (@newresults) {
508
		    foreach (@newresults) {
506
                my $bibnum = $_->{biblionumber} or next;
509
                      my $record = GetMarcBiblio($_->{'biblionumber'});
507
                $_->{itemsissued} = CountItemsIssued( $bibnum );
510
		      $_->{coins} = GetCOinSBiblio($record);
508
                $_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight',
511
		    }
509
                                        limit=>$tag_quantity });
512
                }
510
            }
511
        }
512
        if (C4::Context->preference('COinSinOPACResults')) {
513
            foreach (@newresults) {
514
                my $record = GetMarcBiblio($_->{'biblionumber'});
515
                $_->{coins} = GetCOinSBiblio($record);
516
            }
517
        }
513
      
518
      
514
	if ($results_hashref->{$server}->{"hits"}){
519
        if ($results_hashref->{$server}->{"hits"}){
515
	    $total = $total + $results_hashref->{$server}->{"hits"};
520
            $total = $total + $results_hashref->{$server}->{"hits"};
516
	}
521
        }
517
 	# Opac search history
522
        
518
 	my $newsearchcookie;
523
        # Opac search history
519
 	if (C4::Context->preference('EnableOpacSearchHistory')) {
524
        my $newsearchcookie;
520
 	    my @recentSearches; 
525
        if (C4::Context->preference('EnableOpacSearchHistory')) {
521
 
526
            my @recentSearches; 
522
 	    # Getting the (maybe) already sent cookie
527
523
 	    my $searchcookie = $cgi->cookie('KohaOpacRecentSearches');
528
            # Getting the (maybe) already sent cookie
524
 	    if ($searchcookie){
529
            my $searchcookie = $cgi->cookie('KohaOpacRecentSearches');
525
 		$searchcookie = uri_unescape($searchcookie);
530
            if ($searchcookie){
526
 		if (thaw($searchcookie)) {
531
                $searchcookie = uri_unescape($searchcookie);
527
 		    @recentSearches = @{thaw($searchcookie)};
532
                if (thaw($searchcookie)) {
528
 		}
533
                    @recentSearches = @{thaw($searchcookie)};
529
 	    }
534
                }
530
 
535
            }
531
 	    # Adding the new search if needed
536
532
           if (!$borrowernumber || $borrowernumber eq '') {
537
            # Adding the new search if needed
533
 	    # To a cookie (the user is not logged in)
538
            if (!$borrowernumber || $borrowernumber eq '') {
534
 
539
                # To a cookie (the user is not logged in)
535
               if (($params->{'offset'}||'') eq '') {
540
                if (($params->{'offset'}||'') eq '') {
536
 
541
                    push @recentSearches, {
537
     		    push @recentSearches, {
542
                                "query_desc" => $query_desc || "unknown", 
538
     					    "query_desc" => $query_desc || "unknown", 
543
                                "query_cgi"  => $query_cgi  || "unknown", 
539
     					    "query_cgi"  => $query_cgi  || "unknown", 
544
                                "time"       => time(),
540
     					    "time"       => time(),
545
                                "total"      => $total
541
     					    "total"      => $total
546
                              };
542
     					  };
547
                    $template->param(ShowOpacRecentSearchLink => 1);
543
     		    $template->param(ShowOpacRecentSearchLink => 1);
548
                }
544
     		}
549
545
 
550
                shift @recentSearches if (@recentSearches > 15);
546
            shift @recentSearches if (@recentSearches > 15);
551
                # Pushing the cookie back 
547
     		# Pushing the cookie back 
552
                $newsearchcookie = $cgi->cookie(
548
     		$newsearchcookie = $cgi->cookie(
553
                            -name => 'KohaOpacRecentSearches',
549
 					    -name => 'KohaOpacRecentSearches',
554
                            # We uri_escape the whole freezed structure so we're sure we won't have any encoding problems
550
 					    # We uri_escape the whole freezed structure so we're sure we won't have any encoding problems
555
                            -value => uri_escape(freeze(\@recentSearches)),
551
 					    -value => uri_escape(freeze(\@recentSearches)),
556
                            -expires => ''
552
 					    -expires => ''
557
                );
553
 			);
558
                $cookie = [$cookie, $newsearchcookie];
554
 			$cookie = [$cookie, $newsearchcookie];
559
            }
555
 	    } 
560
            else {
556
		else {
561
                # To the session (the user is logged in)
557
 	    # To the session (the user is logged in)
562
                if (($params->{'offset'}||'') eq '') {
558
                       if (($params->{'offset'}||'') eq '') {
563
                    AddSearchHistory($borrowernumber, $cgi->cookie("CGISESSID"), $query_desc, $query_cgi, $total);
559
				AddSearchHistory($borrowernumber, $cgi->cookie("CGISESSID"), $query_desc, $query_cgi, $total);
564
                    $template->param(ShowOpacRecentSearchLink => 1);
560
     		    $template->param(ShowOpacRecentSearchLink => 1);
565
                }
561
     		}
566
            }
562
 	    }
567
        }
563
 	}
568
        ## If there's just one result, redirect to the detail page
564
    ## If there's just one result, redirect to the detail page
565
        if ($total == 1 && $format ne 'rss2'
569
        if ($total == 1 && $format ne 'rss2'
566
	    && $format ne 'opensearchdescription' && $format ne 'atom') {   
570
        && $format ne 'opensearchdescription' && $format ne 'atom') {
567
            my $biblionumber=$newresults[0]->{biblionumber};
571
            my $biblionumber=$newresults[0]->{biblionumber};
568
            if (C4::Context->preference('BiblioDefaultView') eq 'isbd') {
572
            if (C4::Context->preference('BiblioDefaultView') eq 'isbd') {
569
                print $cgi->redirect("/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=$biblionumber");
573
                print $cgi->redirect("/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=$biblionumber");
Lines 668-674 for (my $i=0;$i<@servers;$i++) { Link Here
668
            $template->param(   PAGE_NUMBERS => \@page_numbers,
672
            $template->param(   PAGE_NUMBERS => \@page_numbers,
669
                                previous_page_offset => $previous_page_offset) unless $pages < 2;
673
                                previous_page_offset => $previous_page_offset) unless $pages < 2;
670
            $template->param(next_page_offset => $next_page_offset) unless $pages eq $current_page_number;
674
            $template->param(next_page_offset => $next_page_offset) unless $pages eq $current_page_number;
671
         }
675
        }
672
        # no hits
676
        # no hits
673
        else {
677
        else {
674
            $template->param(searchdesc => 1,query_desc => $query_desc,limit_desc => $limit_desc);
678
            $template->param(searchdesc => 1,query_desc => $query_desc,limit_desc => $limit_desc);
Lines 699-705 $template->param( Link Here
699
            total => $total,
703
            total => $total,
700
            opacfacets => 1,
704
            opacfacets => 1,
701
            facets_loop => $facets,
705
            facets_loop => $facets,
702
	    displayFacetCount=> C4::Context->preference('displayFacetCount')||0,
706
            displayFacetCount=> C4::Context->preference('displayFacetCount')||0,
703
            scan => $scan,
707
            scan => $scan,
704
            search_error => $error,
708
            search_error => $error,
705
);
709
);
Lines 715-732 my @addpubshelves; Link Here
715
my $pubshelves = $session->param('pubshelves');
719
my $pubshelves = $session->param('pubshelves');
716
my $barshelves = $session->param('barshelves');
720
my $barshelves = $session->param('barshelves');
717
foreach my $shelf (@$pubshelves) {
721
foreach my $shelf (@$pubshelves) {
718
	next if ( ($shelf->{'owner'} != ($borrowernumber ? $borrowernumber : -1)) && ($shelf->{'category'} < 3) );
722
    next if ( ($shelf->{'owner'} != ($borrowernumber ? $borrowernumber : -1)) && ($shelf->{'category'} < 3) );
719
	push (@addpubshelves, $shelf);
723
    push (@addpubshelves, $shelf);
720
}
724
}
721
725
722
if (@addpubshelves) {
726
if (@addpubshelves) {
723
	$template->param( addpubshelves     => scalar (@addpubshelves));
727
    $template->param( addpubshelves     => scalar (@addpubshelves));
724
	$template->param( addpubshelvesloop => \@addpubshelves);
728
    $template->param( addpubshelvesloop => \@addpubshelves);
725
}
729
}
726
730
727
if (defined $barshelves) {
731
if (defined $barshelves) {
728
	$template->param( addbarshelves     => scalar (@$barshelves));
732
    $template->param( addbarshelves     => scalar (@$barshelves));
729
	$template->param( addbarshelvesloop => $barshelves);
733
    $template->param( addbarshelvesloop => $barshelves);
730
}
734
}
731
735
732
my $content_type = ($format eq 'rss' or $format eq 'atom') ? $format : 'html';
736
my $content_type = ($format eq 'rss' or $format eq 'atom') ? $format : 'html';
733
- 

Return to bug 6374