50bece592c3c9f7a0d77b27e2c82e59a13bd435a
[koha_gimpoz] / opac / opac-detail.pl
1 #!/usr/bin/perl
2
3 # Copyright 2000-2002 Katipo Communications
4 # Copyright 2010 BibLibre
5 #
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
11 # version.
12 #
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along
18 # with Koha; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
22 use strict;
23 use warnings;
24
25 use CGI;
26 use C4::Auth;
27 use C4::Branch;
28 use C4::Koha;
29 use C4::Serials;    #uses getsubscriptionfrom biblionumber
30 use C4::Output;
31 use C4::Biblio;
32 use C4::Items;
33 use C4::Circulation;
34 use C4::Tags qw(get_tags);
35 use C4::Dates qw/format_date/;
36 use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn);
37 use C4::External::Amazon;
38 use C4::External::Syndetics qw(get_syndetics_index get_syndetics_summary get_syndetics_toc get_syndetics_excerpt get_syndetics_reviews get_syndetics_anotes );
39 use C4::Review;
40 use C4::Members;
41 use C4::VirtualShelves;
42 use C4::XSLT;
43 use C4::ShelfBrowser;
44 use C4::Charset;
45
46 BEGIN {
47         if (C4::Context->preference('BakerTaylorEnabled')) {
48                 require C4::External::BakerTaylor;
49                 import C4::External::BakerTaylor qw(&image_url &link_url);
50         }
51 }
52
53 my $query = new CGI;
54 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
55     {
56         template_name   => "opac-detail.tmpl",
57         query           => $query,
58         type            => "opac",
59         authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
60         flagsrequired   => { borrow => 1 },
61     }
62 );
63
64 my $biblionumber = $query->param('biblionumber') || $query->param('bib');
65
66 $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
67 $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
68
69 my $record       = GetMarcBiblio($biblionumber);
70 if ( ! $record ) {
71     print $query->redirect("/cgi-bin/koha/errors/404.pl");
72     exit;
73 }
74 $template->param( biblionumber => $biblionumber );
75
76 SetUTF8Flag($record);
77
78 # XSLT processing of some stuff
79 if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
80     $template->param( 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail', 'opac') );
81 }
82
83 $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") ); 
84 # change back when ive fixed request.pl
85 my @all_items = &GetItemsInfo( $biblionumber, 'opac' );
86 my @items;
87 @items = @all_items unless C4::Context->preference('hidelostitems');
88
89 if (C4::Context->preference('hidelostitems')) {
90     # Hide host items
91     for my $itm (@all_items) {
92         push @items, $itm unless $itm->{itemlost};
93     }
94 }
95 my $dat = &GetBiblioData($biblionumber);
96
97 my $itemtypes = GetItemTypes();
98 # imageurl:
99 my $itemtype = $dat->{'itemtype'};
100 if ( $itemtype ) {
101     $dat->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
102     $dat->{'description'} = $itemtypes->{$itemtype}->{'description'};
103 }
104 my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
105 my $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
106
107 #coping with subscriptions
108 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
109 my @subscriptions       = GetSubscriptions( undef, undef, $biblionumber );
110
111 my @subs;
112 $dat->{'serial'}=1 if $subscriptionsnumber;
113 foreach my $subscription (@subscriptions) {
114     my $serials_to_display;
115     my %cell;
116     $cell{subscriptionid}    = $subscription->{subscriptionid};
117     $cell{subscriptionnotes} = $subscription->{notes};
118     $cell{missinglist}       = $subscription->{missinglist};
119     $cell{opacnote}          = $subscription->{opacnote};
120     $cell{histstartdate}     = format_date($subscription->{histstartdate});
121     $cell{histenddate}       = format_date($subscription->{histenddate});
122     $cell{branchcode}        = $subscription->{branchcode};
123     $cell{branchname}        = GetBranchName($subscription->{branchcode});
124     $cell{hasalert}          = $subscription->{hasalert};
125     #get the three latest serials.
126     $serials_to_display = $subscription->{opacdisplaycount};
127     $serials_to_display = C4::Context->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
128         $cell{opacdisplaycount} = $serials_to_display;
129     $cell{latestserials} =
130       GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display );
131     push @subs, \%cell;
132 }
133
134 $dat->{'count'} = scalar(@items);
135
136 # If there is a lot of items, and the user has not decided
137 # to view them all yet, we first warn him
138 # TODO: The limit of 50 could be a syspref
139 my $viewallitems = $query->param('viewallitems');
140 if ($dat->{'count'} >= 50 && !$viewallitems) {
141     $template->param('lotsofitems' => 1);
142 }
143
144 my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) );
145
146 my $norequests = 1;
147 my $branches = GetBranches();
148 my %itemfields;
149 for my $itm (@items) {
150     $norequests = 0
151        if ( (not $itm->{'wthdrawn'} )
152          && (not $itm->{'itemlost'} )
153          && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} )
154                  && (not $itemtypes->{$itm->{'itype'}}->{notforloan} )
155          && ($itm->{'itemnumber'} ) );
156
157     if ( defined $itm->{'publictype'} ) {
158         # I can't actually find any case in which this is defined. --amoore 2008-12-09
159         $itm->{ $itm->{'publictype'} } = 1;
160     }
161     $itm->{datedue}      = format_date($itm->{datedue});
162     $itm->{datelastseen} = format_date($itm->{datelastseen});
163
164     # get collection code description, too
165     if ( my $ccode = $itm->{'ccode'} ) {
166         $itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) );
167     }
168     if ( defined $itm->{'location'} ) {
169         $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
170     }
171     if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
172         $itm->{'imageurl'}    = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
173         $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'};
174     }
175     foreach (qw(ccode enumchron copynumber itemnotes uri)) {
176         $itemfields{$_} = 1 if ($itm->{$_});
177     }
178
179      # walk through the item-level authorised values and populate some images
180      my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) );
181      # warn( Data::Dumper->Dump( [ $item_authorised_value_images ], [ 'item_authorised_value_images' ] ) );
182
183      if ( $itm->{'itemlost'} ) {
184          my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images;
185          $itm->{'lostimageurl'}   = $lostimageinfo->{ 'imageurl' };
186          $itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' };
187      }
188
189      if( $itm->{'count_reserves'}){
190           if( $itm->{'count_reserves'} eq "Waiting"){ $itm->{'waiting'} = 1; }
191           if( $itm->{'count_reserves'} eq "Reserved"){ $itm->{'onhold'} = 1; }
192      }
193     
194      my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
195      if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
196         $itm->{transfertwhen} = format_date($transfertwhen);
197         $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
198         $itm->{transfertto}   = $branches->{$transfertto}{branchname};
199      }
200 }
201
202 ## get notes and subjects from MARC record
203 my $dbh              = C4::Context->dbh;
204 my $marcflavour      = C4::Context->preference("marcflavour");
205 my $marcnotesarray   = GetMarcNotes   ($record,$marcflavour);
206 my $marcisbnsarray   = GetMarcISBN    ($record,$marcflavour);
207 my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
208 my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
209 my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
210 my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
211 my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
212
213     $template->param(
214                      MARCNOTES               => $marcnotesarray,
215                      MARCSUBJCTS             => $marcsubjctsarray,
216                      MARCAUTHORS             => $marcauthorsarray,
217                      MARCSERIES              => $marcseriesarray,
218                      MARCURLS                => $marcurlsarray,
219                      norequests              => $norequests,
220                      RequestOnOpac           => C4::Context->preference("RequestOnOpac"),
221                      itemdata_ccode          => $itemfields{ccode},
222                      itemdata_enumchron      => $itemfields{enumchron},
223                      itemdata_uri            => $itemfields{uri},
224                      itemdata_copynumber     => $itemfields{copynumber},
225                      itemdata_itemnotes          => $itemfields{itemnotes},
226                      authorised_value_images => $biblio_authorised_value_images,
227                      subtitle                => $subtitle,
228     );
229
230 foreach ( keys %{$dat} ) {
231     $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
232 }
233
234 # some useful variables for enhanced content;
235 # in each case, we're grabbing the first value we find in
236 # the record and normalizing it
237 my $upc = GetNormalizedUPC($record,$marcflavour);
238 my $ean = GetNormalizedEAN($record,$marcflavour);
239 my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
240 my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
241 my $content_identifier_exists = 1 if ($isbn or $ean or $oclc or $upc);
242 $template->param(
243         normalized_upc => $upc,
244         normalized_ean => $ean,
245         normalized_oclc => $oclc,
246         normalized_isbn => $isbn,
247         content_identifier_exists =>  $content_identifier_exists,
248 );
249
250 # COinS format FIXME: for books Only
251 $template->param(
252     ocoins => GetCOinSBiblio($biblionumber),
253 );
254
255 my $reviews = getreviews( $biblionumber, 1 );
256 my $loggedincommenter;
257 foreach ( @$reviews ) {
258     my $borrowerData   = GetMember('borrowernumber' => $_->{borrowernumber});
259     # setting some borrower info into this hash
260     $_->{title}     = $borrowerData->{'title'};
261     $_->{surname}   = $borrowerData->{'surname'};
262     $_->{firstname} = $borrowerData->{'firstname'};
263     $_->{userid}    = $borrowerData->{'userid'};
264     $_->{cardnumber}    = $borrowerData->{'cardnumber'};
265     $_->{datereviewed} = format_date($_->{datereviewed});
266     if ($borrowerData->{'borrowernumber'} eq $borrowernumber) {
267                 $_->{your_comment} = 1;
268                 $loggedincommenter = 1;
269         }
270 }
271
272
273 if(C4::Context->preference("ISBD")) {
274         $template->param(ISBD => 1);
275 }
276
277 $template->param(
278     ITEM_RESULTS        => \@items,
279     subscriptionsnumber => $subscriptionsnumber,
280     biblionumber        => $biblionumber,
281     subscriptions       => \@subs,
282     subscriptionsnumber => $subscriptionsnumber,
283     reviews             => $reviews,
284     loggedincommenter   => $loggedincommenter
285 );
286
287 # Lists
288
289 if (C4::Context->preference("virtualshelves") ) {
290    $template->param( 'GetShelves' => GetBibliosShelves( $biblionumber ) );
291 }
292
293
294 # XISBN Stuff
295 if (C4::Context->preference("OPACFRBRizeEditions")==1) {
296     eval {
297         $template->param(
298             XISBNS => get_xisbns($isbn)
299         );
300     };
301     if ($@) { warn "XISBN Failed $@"; }
302 }
303
304 # Serial Collection
305 my @sc_fields = $record->field(955);
306 my @serialcollections = ();
307
308 foreach my $sc_field (@sc_fields) {
309     my %row_data;
310
311     $row_data{text}    = $sc_field->subfield('r');
312     $row_data{branch}  = $sc_field->subfield('9');
313
314     if ($row_data{text} && $row_data{branch}) { 
315         push (@serialcollections, \%row_data);
316     }
317 }
318
319 if (scalar(@serialcollections) > 0) {
320     $template->param(
321         serialcollection  => 1,
322         serialcollections => \@serialcollections);
323 }
324
325 # Amazon.com Stuff
326 if ( C4::Context->preference("OPACAmazonEnabled") ) {
327     $template->param( AmazonTld => get_amazon_tld() );
328     my $amazon_reviews  = C4::Context->preference("OPACAmazonReviews");
329     my $amazon_similars = C4::Context->preference("OPACAmazonSimilarItems");
330     my @services;
331     if ( $amazon_reviews ) {
332         push( @services, 'EditorialReview', 'Reviews' );
333     }
334     if ( $amazon_similars ) {
335         push( @services, 'Similarities' );
336     }
337     my $amazon_details = &get_amazon_details( $isbn, $record, $marcflavour, \@services );
338     my $similar_products_exist;
339     if ( $amazon_reviews ) {
340         my $item = $amazon_details->{Items}->{Item}->[0];
341         my $customer_reviews = \@{ $item->{CustomerReviews}->{Review} };
342         for my $one_review ( @$customer_reviews ) {
343             $one_review->{Date} = format_date($one_review->{Date});
344         }
345         my $editorial_reviews = \@{ $item->{EditorialReviews}->{EditorialReview} };
346         my $average_rating = $item->{CustomerReviews}->{AverageRating} || 0;
347         $template->param( amazon_average_rating    => $average_rating * 20);
348         $template->param( AMAZON_CUSTOMER_REVIEWS  => $customer_reviews );
349         $template->param( AMAZON_EDITORIAL_REVIEWS => $editorial_reviews );
350     }
351     if ( $amazon_similars ) {
352         my $item = $amazon_details->{Items}->{Item}->[0];
353         my @similar_products;
354         for my $similar_product (@{ $item->{SimilarProducts}->{SimilarProduct} }) {
355             # do we have any of these isbns in our collection?
356             my $similar_biblionumbers = get_biblionumber_from_isbn($similar_product->{ASIN});
357             # verify that there is at least one similar item
358             if (scalar(@$similar_biblionumbers)){
359                 $similar_products_exist++ if ($similar_biblionumbers && $similar_biblionumbers->[0]);
360                 push @similar_products, +{ similar_biblionumbers => $similar_biblionumbers, title => $similar_product->{Title}, ASIN => $similar_product->{ASIN}  };
361             }
362         }
363         $template->param( OPACAmazonSimilarItems => $similar_products_exist );
364         $template->param( AMAZON_SIMILAR_PRODUCTS => \@similar_products );
365     }
366 }
367
368 my $syndetics_elements;
369
370 if ( C4::Context->preference("SyndeticsEnabled") ) {
371     $template->param("SyndeticsEnabled" => 1);
372     $template->param("SyndeticsClientCode" => C4::Context->preference("SyndeticsClientCode"));
373         eval {
374             $syndetics_elements = &get_syndetics_index($isbn,$upc,$oclc);
375             for my $element (values %$syndetics_elements) {
376                 $template->param("Syndetics$element"."Exists" => 1 );
377                 #warn "Exists: "."Syndetics$element"."Exists";
378         }
379     };
380     warn $@ if $@;
381 }
382
383 if ( C4::Context->preference("SyndeticsEnabled")
384         && C4::Context->preference("SyndeticsSummary")
385         && ( exists($syndetics_elements->{'SUMMARY'}) || exists($syndetics_elements->{'AVSUMMARY'}) ) ) {
386         eval {
387             my $syndetics_summary = &get_syndetics_summary($isbn,$upc,$oclc, $syndetics_elements);
388             $template->param( SYNDETICS_SUMMARY => $syndetics_summary );
389         };
390         warn $@ if $@;
391
392 }
393
394 if ( C4::Context->preference("SyndeticsEnabled")
395         && C4::Context->preference("SyndeticsTOC")
396         && exists($syndetics_elements->{'TOC'}) ) {
397         eval {
398     my $syndetics_toc = &get_syndetics_toc($isbn,$upc,$oclc);
399     $template->param( SYNDETICS_TOC => $syndetics_toc );
400         };
401         warn $@ if $@;
402 }
403
404 if ( C4::Context->preference("SyndeticsEnabled")
405     && C4::Context->preference("SyndeticsExcerpt")
406     && exists($syndetics_elements->{'DBCHAPTER'}) ) {
407     eval {
408     my $syndetics_excerpt = &get_syndetics_excerpt($isbn,$upc,$oclc);
409     $template->param( SYNDETICS_EXCERPT => $syndetics_excerpt );
410     };
411         warn $@ if $@;
412 }
413
414 if ( C4::Context->preference("SyndeticsEnabled")
415     && C4::Context->preference("SyndeticsReviews")) {
416     eval {
417     my $syndetics_reviews = &get_syndetics_reviews($isbn,$upc,$oclc,$syndetics_elements);
418     $template->param( SYNDETICS_REVIEWS => $syndetics_reviews );
419     };
420         warn $@ if $@;
421 }
422
423 if ( C4::Context->preference("SyndeticsEnabled")
424     && C4::Context->preference("SyndeticsAuthorNotes")
425         && exists($syndetics_elements->{'ANOTES'}) ) {
426     eval {
427     my $syndetics_anotes = &get_syndetics_anotes($isbn,$upc,$oclc);
428     $template->param( SYNDETICS_ANOTES => $syndetics_anotes );
429     };
430     warn $@ if $@;
431 }
432
433 # LibraryThingForLibraries ID Code and Tabbed View Option
434 if( C4::Context->preference('LibraryThingForLibrariesEnabled') ) 
435
436 $template->param(LibraryThingForLibrariesID =>
437 C4::Context->preference('LibraryThingForLibrariesID') ); 
438 $template->param(LibraryThingForLibrariesTabbedView =>
439 C4::Context->preference('LibraryThingForLibrariesTabbedView') );
440
441
442
443 # Babelthèque
444 if ( C4::Context->preference("Babeltheque") ) {
445     $template->param( 
446         Babeltheque => 1,
447     );
448 }
449
450 # Shelf Browser Stuff
451 if (C4::Context->preference("OPACShelfBrowser")) {
452     # pick the first itemnumber unless one was selected by the user
453     my $starting_itemnumber = $query->param('shelfbrowse_itemnumber'); # || $items[0]->{itemnumber};
454     if (defined($starting_itemnumber)) {
455         $template->param( OpenOPACShelfBrowser => 1) if $starting_itemnumber;
456         my $nearby = GetNearbyItems($starting_itemnumber,3);
457
458         $template->param(
459             starting_homebranch => $nearby->{starting_homebranch}->{description},
460             starting_location => $nearby->{starting_location}->{description},
461             starting_ccode => $nearby->{starting_ccode}->{description},
462             starting_itemnumber => $nearby->{starting_itemnumber},
463             shelfbrowser_prev_itemnumber => $nearby->{prev_itemnumber},
464             shelfbrowser_next_itemnumber => $nearby->{next_itemnumber},
465             shelfbrowser_prev_biblionumber => $nearby->{prev_biblionumber},
466             shelfbrowser_next_biblionumber => $nearby->{next_biblionumber},
467             PREVIOUS_SHELF_BROWSE => $nearby->{prev},
468             NEXT_SHELF_BROWSE => $nearby->{next},
469         );
470     }
471 }
472
473 if (C4::Context->preference("BakerTaylorEnabled")) {
474         $template->param(
475                 BakerTaylorEnabled  => 1,
476                 BakerTaylorImageURL => &image_url(),
477                 BakerTaylorLinkURL  => &link_url(),
478                 BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
479         );
480         my ($bt_user, $bt_pass);
481         if ($isbn and
482                 $bt_user = C4::Context->preference('BakerTaylorUsername') and
483                 $bt_pass = C4::Context->preference('BakerTaylorPassword')    )
484         {
485                 $template->param(
486                 BakerTaylorContentURL   =>
487                 sprintf("http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y",
488                                 $bt_user,$bt_pass,$isbn)
489                 );
490         }
491 }
492
493 my $tag_quantity;
494 if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) {
495         $template->param(
496                 TagsEnabled => 1,
497                 TagsShowOnDetail => $tag_quantity,
498                 TagsInputOnDetail => C4::Context->preference('TagsInputOnDetail')
499         );
500         $template->param(TagLoop => get_tags({biblionumber=>$biblionumber, approved=>1,
501                                                                 'sort'=>'-weight', limit=>$tag_quantity}));
502 }
503
504 if (C4::Context->preference("OPACURLOpenInNewWindow")) {
505     # These values are going to be read by Javascript, at least in the case
506     # of the google covers
507     $template->param(covernewwindow => 'true');
508 } else {
509     $template->param(covernewwindow => 'false');
510 }
511
512 #Search for title in links
513 my $marccontrolnumber   = GetMarcControlnumber   ($record, $marcflavour);
514
515 if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
516     $dat->{author} ? $search_for_title =~ s/{AUTHOR}/$dat->{author}/g : $search_for_title =~ s/{AUTHOR}//g;
517     $dat->{title} =~ s/\/+$//; # remove trailing slash
518     $dat->{title} =~ s/\s+$//; # remove trailing space
519     $dat->{title} ? $search_for_title =~ s/{TITLE}/$dat->{title}/g : $search_for_title =~ s/{TITLE}//g;
520     $isbn ? $search_for_title =~ s/{ISBN}/$isbn/g : $search_for_title =~ s/{ISBN}//g;
521     $marccontrolnumber ? $search_for_title =~ s/{CONTROLNUMBER}/$marccontrolnumber/g : $search_for_title =~ s/{CONTROLNUMBER}//g;
522  $template->param('OPACSearchForTitleIn' => $search_for_title);
523 }
524
525 # We try to select the best default tab to show, according to what
526 # the user wants, and what's available for display
527 my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab');
528 my $defaulttab = 
529     $opac_serial_default eq 'subscriptions' && $subscriptionsnumber
530         ? 'subscriptions' :
531     $opac_serial_default eq 'serialcollection' && @serialcollections > 0
532         ? 'serialcollection' :
533     $opac_serial_default eq 'holdings' && $dat->{'count'} > 0
534         ? 'holdings' :
535     $subscriptionsnumber
536         ? 'subscriptions' :
537     @serialcollections > 0 
538         ? 'serialcollection' : 'subscription';
539 $template->param('defaulttab' => $defaulttab);
540
541 output_html_with_http_headers $query, $cookie, $template->output;