Merge remote branch 'kc/master' into new/bug_5105
authorChris Cormack <chrisc@catalyst.net.nz>
Wed, 10 Nov 2010 22:33:10 +0000 (11:33 +1300)
committerChris Cormack <chrisc@catalyst.net.nz>
Wed, 10 Nov 2010 22:33:10 +0000 (11:33 +1300)
Conflict fixed

Conflicts:
opac/opac-detail.pl

1  2 
opac/opac-detail.pl

diff --combined opac/opac-detail.pl
@@@ -40,6 -40,7 +40,6 @@@ use C4::Serials
  use C4::Members;
  use C4::VirtualShelves;
  use C4::XSLT;
 -use Switch;
  
  BEGIN {
        if (C4::Context->preference('BakerTaylorEnabled')) {
@@@ -595,41 -596,18 +595,18 @@@ if (my $search_for_title = C4::Context-
  
  # We try to select the best default tab to show, according to what
  # the user wants, and what's available for display
- my $defaulttab = '';
- my $deftab = C4::Context->preference('opacSerialDefaultTab');
- # If the user wants subscriptions by default
- if ($deftab eq 'subscriptions') { 
-     # And there are subscriptions, we display them
-     if ($subscriptionsnumber) {
-         $defaulttab = 'subscriptions';
-     } else {
-         # Else, we try next option
-         $deftab = 'serialcollection'; 
-     }
- }
- if ($deftab eq 'serialcollection') {
-     if (scalar(@serialcollections) > 0) {
-         $defaulttab = 'serialcollection' ;
-     } else {
-         $deftab = 'holdings';
-     }
- }
- if ($deftab eq 'holdings') {
-     if ($dat->{'count'} > 0) {
-         $defaulttab = 'holdings'; 
-     } 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' ;
-         }
-     }
- }
+ my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab');
+ my $defaulttab = 
+     $opac_serial_default eq 'subscriptions' && $subscriptionsnumber
+         ? 'subscriptions' :
+     $opac_serial_default eq 'serialcollection' && @serialcollections > 0
+         ? 'serialcollection' :
+     $opac_serial_default eq 'holdings' && $dat->{'count'} > 0
+         ? 'holdings' :
+     $subscriptionsnumber
+         ? 'subscriptions' :
+     @serialcollections > 0 
+         ? 'serialcollection' : 'subscription';
  $template->param('defaulttab' => $defaulttab);
  
  output_html_with_http_headers $query, $cookie, $template->output;