@@ -, +, @@
holdings
---
.../prog/en/modules/catalogue/detail.tt | 13 +++++++++----
.../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 10 +++++++++-
opac/opac-detail.pl | 4 +++-
3 files changed, 21 insertions(+), 6 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
@@ -269,7 +269,7 @@
[% END %]
[% IF ( MARCNOTES || notes ) %]
Descriptions ([% ( MARCNOTES.size || 1 ) | html %])[% END %]
-[% IF ( ComponentParts ) %]Components ([% ( ComponentParts.size || 1 ) %])[% END %]
+[% IF ( ComponentParts ) %]Components ([% ( ComponentParts.size ) %])[% END %]
[% IF ( subscriptionsnumber ) %]Subscriptions[% END %]
[% IF Koha.Preference('AcquisitionDetails') %]Acquisition details[% END %]
[% IF suggestions.count %]Suggestion details[% END %]
@@ -1258,9 +1258,14 @@ Note that permanent location is a code, and location may be an authval.
$(document).ready(function() {
$('#bibliodetails').tabs();
- [% IF count == 0 and ( Koha.Preference('HTML5MediaEnabled') == 'staff' or Koha.Preference('HTML5MediaEnabled') == 'both' ) %]
- $('#bibliodetails').tabs("option", "active", $('#media_tab').index() );
- [% END %]
+ // Pick details tab to display by default
+ [% IF count == 0 %]
+ [% IF ( Koha.Preference('HTML5MediaEnabled') == 'staff' or Koha.Preference('HTML5MediaEnabled') == 'both' ) && HTML5MediaSets.size %]
+ $('#bibliodetails').tabs("option", "active", $('#media_tab').index() );
+ [% ELSIF ComponentParts %]
+ $('#bibliodetails').tabs("option", "active", $('#components_tab').index() );
+ [% END %]
+ [% END %]
$('#search-form').focus();
$('.thumbnails > li > .remove').click(function() {
var result = confirm(_("Are you sure you want to delete this cover image?"));
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
@@ -402,7 +402,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 %]
--- a/opac/opac-detail.pl
+++ a/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
--