From 624386954783ce2b31c4a393530a04c9e35829b5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 12 Oct 2021 10:47:24 +0100 Subject: [PATCH] Bug 11175: (QA follow-up) OPAC - Display components tab if no holdings As for the staff client, this selects the default tab to be 'Components' for the case where no holdings are found. --- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 10 +++++++++- opac/opac-detail.pl | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 9630e21f4a..39a9889033 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -378,7 +378,15 @@ [% IF SYNDETICS_SUMMARY %][% SET title_notes_count = title_notes_count + 1 %][% END %]
  • Title notes ( [% title_notes_count | html %] )
  • [% END %] - [% IF ( ComponentParts ) %]
  • Components ([% ( ComponentParts.size || 1 ) %])
  • [% END %] + [% IF ( ComponentParts ) %] + [% IF defaulttab == 'components' %] +
  • + [% ELSE %] +
  • + [% END %] + Components ([% ( ComponentParts.size || 1 ) %]) +
  • + [% END %] [% IF ( SYNDETICS_TOC ) %]
  • TOC
  • [% END %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 43d675222d..c8903411cf 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -659,9 +659,9 @@ my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 5 # Get component parts details my $showcomp = C4::Context->preference('ShowComponentRecords'); +my $parts; if ( $showcomp eq 'both' || $showcomp eq 'opac' ) { if ( my $components = $biblio->get_marc_components(300) ) { - my $parts; for my $part ( @{$components} ) { $part = C4::Search::new_record_from_zebra( 'biblioserver', $part ); @@ -1207,6 +1207,8 @@ my $defaulttab = ? '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 -- 2.20.1