use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials );
use C4::XISBN qw( get_xisbns );
use C4::External::Amazon qw( get_amazon_tld );
-use C4::Search qw( z3950_search_args enabled_staff_search_views );
+use C4::Search qw( z3950_search_args enabled_staff_search_views new_record_from_zebra );
use C4::Tags qw( get_tags );
use C4::XSLT qw( XSLTParse4Display );
use Koha::DateUtils qw( format_sqldatetime );
use Koha::Virtualshelves;
use Koha::Plugins;
use Koha::SearchEngine::Search;
+use Koha::SearchEngine::QueryBuilder;
my $query = CGI->new();
my $showallitems = $query->param('showallitems');
my $marcflavour = C4::Context->preference("marcflavour");
-# XSLT processing of some stuff
-my $xslfile = C4::Context->preference('XSLTDetailsDisplay') || "default";
-my $lang = $xslfile ? C4::Languages::getlanguage() : undef;
-my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
-
-if ( $xslfile ) {
-
- my $searcher = Koha::SearchEngine::Search->new(
- { index => $Koha::SearchEngine::BIBLIOS_INDEX }
- );
- my $cleaned_title = $biblio->title;
- $cleaned_title =~ tr|/||;
- 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 ) = $searcher->simple_search_compat( $query, 0, 0 );
-
- warn "Warning from simple_search_compat: $err"
- if $err;
-
- my $variables = {
- show_analytics_link => $count > 0 ? 1 : 0
- };
-
- $template->param(
- XSLTDetailsDisplay => '1',
- XSLTBloc => XSLTParse4Display(
- $biblionumber, $record, "XSLTDetailsDisplay", 1,
- undef, $sysxml, $xslfile, $lang,
- $variables
- )
- );
-}
-
$template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
# Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid
push @subs, \%cell;
}
+# Get component parts details
+my $showcomp = C4::Context->preference('ShowComponentRecords');
+my $show_analytics;
+if ( $showcomp eq 'both' || $showcomp eq 'staff' ) {
+ if ( my $components = $biblio->get_marc_components(C4::Context->preference('MaxComponentRecords')) ) {
+ $show_analytics = 1 if @{$components}; # just show link when having results
+ $template->param( analytics_error => 1 ) if grep { $_->message eq 'component_search' } @{$biblio->messages};
+ my $parts;
+ 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 => "XSLTResultsDisplay",
+ 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
+ $template->param( analytics_error => 1 ) if grep { $_->message eq 'component_search' } @{$biblio->messages};
+}
+
+# XSLT processing of some stuff
+my $xslt_variables = { show_analytics_link => $show_analytics };
+$template->param(
+ XSLTDetailsDisplay => '1',
+ XSLTBloc => XSLTParse4Display({
+ biblionumber => $biblionumber,
+ record => $record,
+ xsl_syspref => "XSLTDetailsDisplay",
+ fix_amps => 1,
+ xslt_variables => $xslt_variables,
+ }),
+);
# Get acquisition details
if ( C4::Context->preference('AcquisitionDetails') ) {
{
borrowernumber => $borrowernumber,
add_allowed => 1,
- category => 1,
+ public => 0,
}
);
my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
{
borrowernumber => $borrowernumber,
add_allowed => 1,
- category => 2,
+ public => 1,
}
);
my $shelves = Koha::Virtualshelves->search(
{
biblionumber => $biblionumber,
- category => 2,
+ public => 1,
},
{
join => 'virtualshelfcontents',