- $template->param(
- BakerTaylorEnabled => 1,
- BakerTaylorImageURL => &image_url(),
- BakerTaylorLinkURL => &link_url(),
- BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
- );
+ $template->param(
+ BakerTaylorEnabled => 1,
+ BakerTaylorImageURL => &image_url(),
+ BakerTaylorLinkURL => &link_url(),
+ BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
+ );
- $template->param(uc(C4::Context->preference("marcflavour")) => 1, # we already did this for UNIMARC
- advsearch => 1,
- search_boxes_loop => \@search_boxes_array);
-
-# use the global setting by default
- if ( C4::Context->preference("expandedSearchOption") == 1 ) {
- $template->param( expanded_options => C4::Context->preference("expandedSearchOption") );
- }
- # but let the user override it
- if (defined $cgi->param('expanded_options')) {
- if ( ($cgi->param('expanded_options') == 0) || ($cgi->param('expanded_options') == 1 ) ) {
- $template->param( expanded_options => $cgi->param('expanded_options'));
- }
+ $template->param(uc( C4::Context->preference("marcflavour")) => 1, # we already did this for UNIMARC
+ advsearch => 1,
+ search_boxes_loop => \@search_boxes_array);
+
+ # use the global setting by default
+ if ( C4::Context->preference("expandedSearchOption") == 1 ) {
+ $template->param( expanded_options => C4::Context->preference("expandedSearchOption") );
+ }
+ # but let the user override it
+ if (defined $cgi->param('expanded_options')) {
+ if ( ($cgi->param('expanded_options') == 0) || ($cgi->param('expanded_options') == 1 ) ) {
+ $template->param( expanded_options => $cgi->param('expanded_options'));
- $query_cgi = "tag=" .$tag . "&" . $query_cgi;
- my $taglist = get_tags({term=>$tag, approved=>1});
- $results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
- my @biblist = (map {GetBiblioData($_->{biblionumber})} @$taglist);
- my @marclist = (map {$_->{marc}} @biblist );
- $DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
- $results_hashref->{biblioserver}->{RECORDS} = \@marclist;
- # FIXME: tag search and standard search should work together, not exclusively
- # FIXME: No facets for tags search.
+ $query_cgi = "tag=" .$tag . "&" . $query_cgi;
+ my $taglist = get_tags({term=>$tag, approved=>1});
+ $results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
+ my @biblist = (map {GetBiblioData($_->{biblionumber})} @$taglist);
+ my @marclist = (map {$_->{marc}} @biblist );
+ $DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
+ $results_hashref->{biblioserver}->{RECORDS} = \@marclist;
+ # FIXME: tag search and standard search should work together, not exclusively
+ # FIXME: No facets for tags search.
@newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan,
@{$results_hashref->{$server}->{"RECORDS"}},, C4::Context->preference('hidelostitems'));
}
@newresults = searchResults('opac', $query_desc, $hits, $results_per_page, $offset, $scan,
@{$results_hashref->{$server}->{"RECORDS"}},, C4::Context->preference('hidelostitems'));
}
- my $tag_quantity;
- if (C4::Context->preference('TagsEnabled') and
- $tag_quantity = C4::Context->preference('TagsShowOnList')) {
- foreach (@newresults) {
- my $bibnum = $_->{biblionumber} or next;
- $_->{itemsissued} = CountItemsIssued( $bibnum );
- $_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight',
- limit=>$tag_quantity });
- }
- }
- if (C4::Context->preference('COinSinOPACResults')) {
- foreach (@newresults) {
- my $record = GetMarcBiblio($_->{'biblionumber'});
- $_->{coins} = GetCOinSBiblio($record);
- }
- }
+
+ # must define a value for size if not present in DB
+ # in order to avoid problems generated by the default size value in TT
+ foreach my $line (@newresults) {
+ if ( not exists $line->{'size'} ) { $line->{'size'} = "" }
+ }
+
+ my $tag_quantity;
+ if (C4::Context->preference('TagsEnabled') and
+ $tag_quantity = C4::Context->preference('TagsShowOnList')) {
+ foreach (@newresults) {
+ my $bibnum = $_->{biblionumber} or next;
+ $_->{itemsissued} = CountItemsIssued( $bibnum );
+ $_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight',
+ limit=>$tag_quantity });
+ }
+ }
+ if (C4::Context->preference('COinSinOPACResults')) {
+ foreach (@newresults) {
+ my $record = GetMarcBiblio($_->{'biblionumber'});
+ $_->{coins} = GetCOinSBiblio($record);
+ }
+ }
- if ($results_hashref->{$server}->{"hits"}){
- $total = $total + $results_hashref->{$server}->{"hits"};
- }
- # Opac search history
- my $newsearchcookie;
- if (C4::Context->preference('EnableOpacSearchHistory')) {
- my @recentSearches;
-
- # Getting the (maybe) already sent cookie
- my $searchcookie = $cgi->cookie('KohaOpacRecentSearches');
- if ($searchcookie){
- $searchcookie = uri_unescape($searchcookie);
- if (thaw($searchcookie)) {
- @recentSearches = @{thaw($searchcookie)};
- }
- }
-
- # Adding the new search if needed
- if (!$borrowernumber || $borrowernumber eq '') {
- # To a cookie (the user is not logged in)
-
- if (($params->{'offset'}||'') eq '') {
-
- push @recentSearches, {
- "query_desc" => $query_desc || "unknown",
- "query_cgi" => $query_cgi || "unknown",
- "time" => time(),
- "total" => $total
- };
- $template->param(ShowOpacRecentSearchLink => 1);
- }
-
- shift @recentSearches if (@recentSearches > 15);
- # Pushing the cookie back
- $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)),
- -expires => ''
- );
- $cookie = [$cookie, $newsearchcookie];
- }
- else {
- # To the session (the user is logged in)
- if (($params->{'offset'}||'') eq '') {
- AddSearchHistory($borrowernumber, $cgi->cookie("CGISESSID"), $query_desc, $query_cgi, $total);
- $template->param(ShowOpacRecentSearchLink => 1);
- }
- }
- }
- ## If there's just one result, redirect to the detail page
+ if ($results_hashref->{$server}->{"hits"}){
+ $total = $total + $results_hashref->{$server}->{"hits"};
+ }
+
+ # Opac search history
+ my $newsearchcookie;
+ if (C4::Context->preference('EnableOpacSearchHistory')) {
+ my @recentSearches;
+
+ # Getting the (maybe) already sent cookie
+ my $searchcookie = $cgi->cookie('KohaOpacRecentSearches');
+ if ($searchcookie){
+ $searchcookie = uri_unescape($searchcookie);
+ if (thaw($searchcookie)) {
+ @recentSearches = @{thaw($searchcookie)};
+ }
+ }
+
+ # Adding the new search if needed
+ if (!$borrowernumber || $borrowernumber eq '') {
+ # To a cookie (the user is not logged in)
+ if (($params->{'offset'}||'') eq '') {
+ push @recentSearches, {
+ "query_desc" => $query_desc || "unknown",
+ "query_cgi" => $query_cgi || "unknown",
+ "time" => time(),
+ "total" => $total
+ };
+ $template->param(ShowOpacRecentSearchLink => 1);
+ }
+
+ shift @recentSearches if (@recentSearches > 15);
+ # Pushing the cookie back
+ $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)),
+ -expires => ''
+ );
+ $cookie = [$cookie, $newsearchcookie];
+ }
+ else {
+ # To the session (the user is logged in)
+ if (($params->{'offset'}||'') eq '') {
+ AddSearchHistory($borrowernumber, $cgi->cookie("CGISESSID"), $query_desc, $query_cgi, $total);
+ $template->param(ShowOpacRecentSearchLink => 1);
+ }
+ }
+ }
+ ## If there's just one result, redirect to the detail page