GetNormalizedOCLCNumber
GetNormalizedUPC
);
+use C4::Search qw( new_record_from_zebra );
use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials );
use C4::Output qw( parametrized_url output_html_with_http_headers );
use C4::Biblio qw(
my $marcflavour = C4::Context->preference("marcflavour");
my $ean = GetNormalizedEAN( $record, $marcflavour );
-{
- my $searcher = Koha::SearchEngine::Search->new(
- { index => $Koha::SearchEngine::BIBLIOS_INDEX }
- );
- my $builder = Koha::SearchEngine::QueryBuilder->new(
- { index => $Koha::SearchEngine::BIBLIOS_INDEX }
- );
-
- my $cleaned_title = $biblio->title;
- $cleaned_title =~ tr|/||;
- $cleaned_title = $builder->clean_search_term($cleaned_title);
-
- my $query =
- ( C4::Context->preference('UseControlNumber') and $record->field('001') )
- ? 'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
- : "Host-item:($cleaned_title)";
- my ( $err, $result, $count );
- eval {
- ( $err, $result, $count ) =
- $searcher->simple_search_compat( $query, 0, 0 );
-
- };
- if ($err || $@){
- my $error = q{};
- $error .= $err if $err;
- $error .= $@ if $@;
- warn "Warning from simple_search_compat: $error";
- }
-
- my $variables = {
- anonymous_session => ($borrowernumber) ? 0 : 1,
- show_analytics_link => defined $count && $count > 0 ? 1 : 0
- };
-
- my $lang = C4::Languages::getlanguage();
- my @plugin_responses = Koha::Plugins->call(
- 'opac_detail_xslt_variables',
- {
- biblio_id => $biblionumber,
- lang => $lang,
- patron_id => $borrowernumber
-
- }
- );
- for my $plugin_variables ( @plugin_responses ) {
- $variables = { %$variables, %$plugin_variables };
- }
-
- $template->param(
- XSLTBloc => XSLTParse4Display(
- {
- biblionumber => $biblionumber,
- record => $record,
- xsl_syspref => 'OPACXSLTDetailsDisplay',
- fix_amps => 1,
- xslt_variables => $variables
- }
- ),
- );
-}
-
my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults");
# We look for the busc param to build the simple paging from the search
my $session = get_session($query->cookie("CGISESSID"));
my %paging = (previous => {}, next => {});
if ($session->param('busc')) {
- use C4::Search;
use URI::Escape qw( uri_escape_utf8 uri_unescape );
# Rebuild the string to store on session
my $viewallitems = $query->param('viewallitems');
my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50;
+# Get component parts details
+my $showcomp = C4::Context->preference('ShowComponentRecords');
+my ( $parts, $show_analytics );
+if ( $showcomp eq 'both' || $showcomp eq 'opac' ) {
+ if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
+ $show_analytics = 1 if @{$components}; # just show link when having results
+ for my $part ( @{$components} ) {
+ $part = C4::Search::new_record_from_zebra( 'biblioserver', $part );
+ my $id = Koha::SearchEngine::Search::extract_biblionumber( $part );
+
+ push @{$parts},
+ XSLTParse4Display(
+ {
+ biblionumber => $id,
+ record => $part,
+ xsl_syspref => 'OPACXSLTResultsDisplay',
+ fix_amps => 1,
+ }
+ );
+ }
+ $template->param( ComponentParts => $parts );
+ $template->param( ComponentPartsQuery => $biblio->get_components_query );
+ }
+} else { # check if we should show analytics anyway
+ $show_analytics = 1 if @{$biblio->get_marc_components(1)}; # count matters here, results does not
+}
+
+# XSLT processing of some stuff
+my $variables = {};
+my @plugin_responses = Koha::Plugins->call(
+ 'opac_detail_xslt_variables',
+ {
+ biblio_id => $biblionumber,
+ lang => C4::Languages::getlanguage(),
+ patron_id => $borrowernumber,
+ },
+);
+for my $plugin_variables ( @plugin_responses ) {
+ $variables = { %$variables, %$plugin_variables };
+}
+$variables->{anonymous_session} = $borrowernumber ? 0 : 1;
+$variables->{show_analytics_link} = $show_analytics;
+$template->param(
+ XSLTBloc => XSLTParse4Display({
+ biblionumber => $biblionumber,
+ record => $record,
+ xsl_syspref => 'OPACXSLTDetailsDisplay',
+ fix_amps => 1,
+ xslt_variables => $variables,
+ }),
+);
+
# Get items on order
my ( @itemnumbers_on_order );
if ( C4::Context->preference('OPACAcquisitionDetails' ) ) {
$template->param(
MARCNOTES => $marcnotesarray,
norequests => $norequests,
- RequestOnOpac => C4::Context->preference("RequestOnOpac"),
itemdata_ccode => $itemfields{ccode},
itemdata_materials => $itemfields{materials},
itemdata_enumchron => $itemfields{enumchron},
my $shelves = Koha::Virtualshelves->search(
{
biblionumber => $biblionumber,
- category => 2,
+ public => 1,
},
{
join => 'virtualshelfcontents',
? 'serialcollection' :
$opac_serial_default eq 'holdings' && scalar (@itemloop) > 0
? 'holdings' :
+ ( $showcomp eq 'both' || $showcomp eq 'opac' ) && scalar (@itemloop) == 0 && $parts
+ ? 'components' :
scalar (@itemloop) == 0
? 'media' :
$subscriptionsnumber