my $expanded_facet = $arrParamsBusc->{'expand'};
my $branches = GetBranches();
+ my $itemtypes = GetItemTypes;
my @servers;
@servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
@servers = ("biblioserver") unless (@servers);
$sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
my ($error, $results_hashref, $facets);
eval {
- ($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'});
+ ($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'});
};
my $hits;
my @newresults;
my $newbusc = rebuildBuscParam(\%arrParamsBusc);
$session->param("busc" => $newbusc);
}
- my ($previous, $next, $dataBiblioPaging);
+ my ($numberBiblioPaging, $dataBiblioPaging);
# Previous biblio
- if ($paging{'previous'}->{biblionumber}) {
- $previous = 'opac-detail.pl?biblionumber=' . $paging{'previous'}->{biblionumber} . '&query_desc=' . $query->param('query_desc');
- $dataBiblioPaging = GetBiblioData($paging{'previous'}->{biblionumber});
+ $numberBiblioPaging = $paging{'previous'}->{biblionumber};
+ if ($numberBiblioPaging) {
+ $template->param( 'previousBiblionumber' => $numberBiblioPaging );
+ $dataBiblioPaging = GetBiblioData($numberBiblioPaging);
$template->param('previousTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging);
}
# Next biblio
- if ($paging{'next'}->{biblionumber}) {
- $next = 'opac-detail.pl?biblionumber=' . $paging{'next'}->{biblionumber} . '&query_desc=' . $query->param('query_desc');
- $dataBiblioPaging = GetBiblioData($paging{'next'}->{biblionumber});
+ $numberBiblioPaging = $paging{'next'}->{biblionumber};
+ if ($numberBiblioPaging) {
+ $template->param( 'nextBiblionumber' => $numberBiblioPaging );
+ $dataBiblioPaging = GetBiblioData($numberBiblioPaging);
$template->param('nextTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging);
}
- $template->param('previous' => $previous, 'next' => $next);
# Partial list of biblio results
my @listResults;
for (my $j = 0; $j < @arrBiblios; $j++) {
}
my $has_hold;
if ( $show_holds_count || $show_priority) {
- my ($reserve_count,$reserves) = GetReservesFromBiblionumber($biblionumber);
- $template->param( holds_count => $reserve_count ) if $show_holds_count;
+ my $reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dates => 1 });
+ $template->param( holds_count => scalar( @$reserves ) ) if $show_holds_count;
foreach (@$reserves) {
$item_reserves{ $_->{itemnumber} }++ if $_->{itemnumber};
if ($show_priority && $_->{borrowernumber} == $borrowernumber) {
$template->param(SeparateHoldings => 1);
}
my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch');
-for my $itm (@items) {
+my $viewallitems = $query->param('viewallitems');
+my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50;
+if ( not $viewallitems and @items > $max_items_to_display ) {
+ $template->param(
+ too_many_items => 1,
+ items_count => scalar( @items ),
+ );
+} else {
+ for my $itm (@items) {
$itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
$itm->{priority} = $priority{ $itm->{itemnumber} };
$norequests = 0
# get collection code description, too
my $ccode = $itm->{'ccode'};
- $itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) );
+ $itm->{'ccode'} = $collections->{$ccode} if defined($ccode) && $collections && exists( $collections->{$ccode} );
my $copynumber = $itm->{'copynumber'};
$itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
if ( defined $itm->{'location'} ) {
} else {
push @itemloop, $itm;
}
+ }
}
# Display only one tab if one items list is empty
}
}
-# If there is a lot of items, and the user has not decided
-# to view them all yet, we first warn him
-# TODO: The limit of 50 could be a syspref
-my $viewallitems = $query->param('viewallitems');
-if (scalar(@itemloop) >= 50 && !$viewallitems) {
- $template->param('lotsofitems' => 1);
-}
-
## get notes and subjects from MARC record
my $dbh = C4::Context->dbh;
my $marcnotesarray = GetMarcNotes ($record,$marcflavour);