X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=opac%2Fopac-detail.pl;h=2eb819b949cc93e5fc478726b9d8c23ca5fc74fa;hb=92e204713b60a8211b110275104097787326485e;hp=bd4dc0a4e1f4c5832659c8539df59d76094b63ab;hpb=96fc46e2e1621effac5f51ff8d6a9ac79fb0551b;p=koha_gimpoz diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index bd4dc0a4e1..2eb819b949 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -40,6 +40,7 @@ use C4::Serials; use C4::Members; use C4::VirtualShelves; use C4::XSLT; +use Switch; BEGIN { if (C4::Context->preference('BakerTaylorEnabled')) { @@ -283,6 +284,28 @@ if (C4::Context->preference("OPACFRBRizeEditions")==1) { }; if ($@) { warn "XISBN Failed $@"; } } + +# Serial Collection +my @sc_fields = $record->field(955); +my @serialcollections = (); + +foreach my $sc_field (@sc_fields) { + my %row_data; + + $row_data{text} = $sc_field->subfield('r'); + $row_data{branch} = $sc_field->subfield('9'); + + if ($row_data{text} && $row_data{branch}) { + push (@serialcollections, \%row_data); + } +} + +if (scalar(@serialcollections) > 0) { + $template->param( + serialcollection => 1, + serialcollections => \@serialcollections); +} + # Amazon.com Stuff if ( C4::Context->preference("OPACAmazonEnabled") ) { $template->param( AmazonTld => get_amazon_tld() ); @@ -558,5 +581,47 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $template->param('OPACSearchForTitleIn' => $search_for_title); } +# We try to select the best default tab to show, according to what +# the user wants, and what's available for display +my $defaulttab; +switch (C4::Context->preference('opacSerialDefaultTab')) { + + # If the user wants subscriptions by default + case "subscriptions" { + # And there are subscriptions, we display them + if ($subscriptionsnumber) { + $defaulttab = 'subscriptions'; + } else { + # Else, we try next option + next; + } + } + + case "serialcollection" { + if (scalar(@serialcollections) > 0) { + $defaulttab = 'serialcollection' ; + } else { + next; + } + } + + case "holdings" { + if ($dat->{'count'} > 0) { + $dat->{'defaultholdings'} = 1; + } else { + # As this is the last option, we try other options if there are no items + if ($subscriptionsnumber) { + $defaulttab = 'subscriptions'; + } elsif (scalar(@serialcollections) > 0) { + $defaulttab = 'serialcollection' ; + } + } + + } + +} +$template->param('defaulttab' => $defaulttab); + + output_html_with_http_headers $query, $cookie, $template->output;