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