Bug 11175: Display components in own tab
[koha.git] / catalogue / detail.pl
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
19 use Modern::Perl;
20
21 use CGI qw ( -utf8 );
22 use HTML::Entities;
23 use C4::Auth qw( get_template_and_user );
24 use C4::Context;
25 use C4::Koha qw(
26     GetAuthorisedValues
27     getitemtypeimagelocation
28     GetNormalizedEAN
29     GetNormalizedISBN
30     GetNormalizedOCLCNumber
31     GetNormalizedUPC
32 );
33 use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials );
34 use C4::Output qw( output_html_with_http_headers );
35 use C4::Biblio qw( GetBiblioData GetFrameworkCode GetMarcBiblio );
36 use C4::Items qw( GetAnalyticsCount GetHostItemsInfo GetItemsInfo );
37 use C4::Circulation qw( GetTransfers );
38 use C4::Reserves;
39 use C4::Serials qw( CountSubscriptionFromBiblionumber SearchSubscriptions GetLatestSerials );
40 use C4::XISBN qw( get_xisbns );
41 use C4::External::Amazon qw( get_amazon_tld );
42 use C4::Search qw( z3950_search_args enabled_staff_search_views );
43 use C4::Tags qw( get_tags );
44 use C4::XSLT qw( XSLTParse4Display );
45 use Koha::DateUtils qw( format_sqldatetime );
46 use C4::HTML5Media;
47 use C4::CourseReserves qw( GetItemCourseReservesInfo );
48 use Koha::AuthorisedValues;
49 use Koha::Biblios;
50 use Koha::CoverImages;
51 use Koha::Illrequests;
52 use Koha::Items;
53 use Koha::ItemTypes;
54 use Koha::Patrons;
55 use Koha::Virtualshelves;
56 use Koha::Plugins;
57 use Koha::SearchEngine::Search;
58 use Koha::SearchEngine::QueryBuilder;
59
60 my $query = CGI->new();
61
62 my $analyze = $query->param('analyze');
63
64 my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
65     {
66     template_name   =>  'catalogue/detail.tt',
67         query           => $query,
68         type            => "intranet",
69         flagsrequired   => { catalogue => 1 },
70     }
71 );
72
73 # Determine if we should be offering any enhancement plugin buttons
74 if ( C4::Context->config('enable_plugins') ) {
75     # Only pass plugins that can offer a toolbar button
76     my @plugins = Koha::Plugins->new()->GetPlugins({
77         method => 'intranet_catalog_biblio_enhancements_toolbar_button'
78     });
79     $template->param(
80         plugins => \@plugins,
81     );
82 }
83
84 my $biblionumber = $query->param('biblionumber');
85 $biblionumber = HTML::Entities::encode($biblionumber);
86 my $record       = GetMarcBiblio({ biblionumber => $biblionumber });
87 my $biblio = Koha::Biblios->find( $biblionumber );
88 $template->param( 'biblio', $biblio );
89
90 if ( not defined $record ) {
91     # biblionumber invalid -> report and exit
92     $template->param( unknownbiblionumber => 1,
93                       biblionumber => $biblionumber );
94     output_html_with_http_headers $query, $cookie, $template->output;
95     exit;
96 }
97
98 eval { $biblio->metadata->record };
99 $template->param( decoding_error => $@ );
100
101 if($query->cookie("holdfor")){
102     my $holdfor_patron = Koha::Patrons->find( $query->cookie("holdfor") );
103     if ( $holdfor_patron ) {
104         $template->param(
105             # FIXME Should pass the patron object
106             holdfor => $query->cookie("holdfor"),
107             holdfor_surname => $holdfor_patron->surname,
108             holdfor_firstname => $holdfor_patron->firstname,
109             holdfor_cardnumber => $holdfor_patron->cardnumber,
110         );
111     }
112 }
113
114 if($query->cookie("searchToOrder")){
115     my ( $basketno, $vendorid ) = split( /\//, $query->cookie("searchToOrder") );
116     $template->param(
117         searchtoorder_basketno => $basketno,
118         searchtoorder_vendorid => $vendorid
119     );
120 }
121
122 my $fw           = GetFrameworkCode($biblionumber);
123 my $showallitems = $query->param('showallitems');
124 my $marcflavour  = C4::Context->preference("marcflavour");
125
126 {
127     # XSLT processing of some stuff
128
129     $template->param(
130         XSLTDetailsDisplay => '1',
131         XSLTBloc => XSLTParse4Display(
132             {
133                 biblionumber   => $biblionumber,
134                 record         => $record,
135                 xsl_syspref    => "XSLTDetailsDisplay",
136                 fix_amps       => 1,
137             }
138         ),
139     );
140 }
141
142 $template->param( 'SpineLabelShowPrintOnBibDetails' => C4::Context->preference("SpineLabelShowPrintOnBibDetails") );
143
144 # Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid
145 # Do not propagate it as we already deal with it previously in this script
146 my $coins = eval { $biblio->get_coins };
147 $template->param( ocoins => $coins );
148
149 # some useful variables for enhanced content;
150 # in each case, we're grabbing the first value we find in
151 # the record and normalizing it
152 my $upc = GetNormalizedUPC($record,$marcflavour);
153 my $ean = GetNormalizedEAN($record,$marcflavour);
154 my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
155 my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
156
157 $template->param(
158     normalized_upc => $upc,
159     normalized_ean => $ean,
160     normalized_oclc => $oclc,
161     normalized_isbn => $isbn,
162 );
163
164 my $marcnotesarray   = $biblio->get_marc_notes({ marcflavour => $marcflavour });
165
166 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } };
167
168 my $dbh = C4::Context->dbh;
169
170 my @all_items = GetItemsInfo( $biblionumber );
171 my @items;
172 my $patron = Koha::Patrons->find( $borrowernumber );
173 for my $itm (@all_items) {
174     push @items, $itm unless ( $itm->{itemlost} && $patron->category->hidelostitems && !$showallitems);
175 }
176
177 # flag indicating existence of at least one item linked via a host record
178 my $hostrecords;
179 # adding items linked via host biblios
180 my @hostitems = GetHostItemsInfo($record);
181 if (@hostitems){
182     $hostrecords =1;
183     push (@items,@hostitems);
184 }
185
186 my $dat = &GetBiblioData($biblionumber);
187
188 #coping with subscriptions
189 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
190 my @subscriptions       = SearchSubscriptions({ biblionumber => $biblionumber, orderby => 'title' });
191 my @subs;
192
193 foreach my $subscription (@subscriptions) {
194     my %cell;
195     my $serials_to_display;
196     $cell{subscriptionid}    = $subscription->{subscriptionid};
197     $cell{subscriptionnotes} = $subscription->{internalnotes};
198     $cell{missinglist}       = $subscription->{missinglist};
199     $cell{librariannote}     = $subscription->{librariannote};
200     $cell{branchcode}        = $subscription->{branchcode};
201     $cell{hasalert}          = $subscription->{hasalert};
202     $cell{callnumber}        = $subscription->{callnumber};
203     $cell{location}          = $subscription->{location};
204     $cell{closed}            = $subscription->{closed};
205     #get the three latest serials.
206     $serials_to_display = $subscription->{staffdisplaycount};
207     $serials_to_display = C4::Context->preference('StaffSerialIssueDisplayCount') unless $serials_to_display;
208     $cell{staffdisplaycount} = $serials_to_display;
209     $cell{latestserials} =
210       GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display );
211     push @subs, \%cell;
212 }
213
214 # Get component parts details
215 my $showcomp = C4::Context->preference('ShowComponentRecords');
216 if ( $showcomp eq 'both' || $showcomp eq 'staff' ) {
217     if ( my $components = $biblio->get_marc_components(300) ) {
218         my $parts;
219         for my $part ( @{$components} ) {
220             $part = MARC::Record->new_from_xml( $part, 'UTF-8' );
221
222             push @{$parts},
223               XSLTParse4Display(
224                 {
225                     biblionumber => $biblionumber,
226                     record       => $part,
227                     xsl_syspref  => "XSLTResultsDisplay",
228                     fix_amps     => 1,
229                 }
230               );
231         }
232         $template->param( ComponentParts => $parts );
233     }
234 }
235
236 # Get acquisition details
237 if ( C4::Context->preference('AcquisitionDetails') ) {
238     my $orders = Koha::Acquisition::Orders->search(
239         { biblionumber => $biblionumber },
240         {
241             join => 'basketno',
242             order_by => 'basketno.booksellerid'
243         }
244     );    # GetHistory sorted by aqbooksellerid, but does it make sense?
245
246     $template->param(
247         orders => $orders,
248     );
249 }
250
251 if ( C4::Context->preference('suggestion') ) {
252     my $suggestions = Koha::Suggestions->search(
253         {
254             biblionumber => $biblionumber,
255             archived     => 0,
256         },
257         {
258             order_by => { -desc => 'suggesteddate' }
259         }
260     );
261     my $nb_archived_suggestions = Koha::Suggestions->search({ biblionumber => $biblionumber, archived => 1 })->count;
262     $template->param( suggestions => $suggestions, nb_archived_suggestions => $nb_archived_suggestions );
263 }
264
265 if ( defined $dat->{'itemtype'} ) {
266     $dat->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $dat->{itemtype} }{imageurl} );
267 }
268
269 $dat->{'count'} = scalar @all_items + @hostitems;
270 $dat->{'showncount'} = scalar @items + @hostitems;
271 $dat->{'hiddencount'} = scalar @all_items + @hostitems - scalar @items;
272
273 my $shelflocations =
274   { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.location' } ) };
275 my $collections =
276   { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.ccode' } ) };
277 my $copynumbers =
278   { map { $_->{authorised_value} => $_->{lib} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $fw, kohafield => 'items.copynumber' } ) };
279 my (@itemloop, @otheritemloop, %itemfields);
280
281 my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.itemlost', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
282 if ( $mss->count ) {
283     $template->param( itemlostloop => GetAuthorisedValues( $mss->next->authorised_value ) );
284 }
285 $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.damaged', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
286 if ( $mss->count ) {
287     $template->param( itemdamagedloop => GetAuthorisedValues( $mss->next->authorised_value ) );
288 }
289 $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.withdrawn', authorised_value => { not => undef } });
290 if ( $mss->count ) {
291     $template->param( itemwithdrawnloop => GetAuthorisedValues( $mss->next->authorised_value) );
292 }
293
294 $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fw, kohafield => 'items.materials', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
295 my %materials_map;
296 if ($mss->count) {
297     my $materials_authvals = GetAuthorisedValues($mss->next->authorised_value);
298     if ($materials_authvals) {
299         foreach my $value (@$materials_authvals) {
300             $materials_map{$value->{authorised_value}} = $value->{lib};
301         }
302     }
303 }
304
305 my $analytics_flag;
306 my $materials_flag; # set this if the items have anything in the materials field
307 my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
308 if ($currentbranch and C4::Context->preference('SeparateHoldings')) {
309     $template->param(SeparateHoldings => 1);
310 }
311 my $separatebranch = C4::Context->preference('SeparateHoldingsBranch') || 'homebranch';
312 my ( $itemloop_has_images, $otheritemloop_has_images );
313 foreach my $item (@items) {
314     my $itembranchcode = $item->{$separatebranch};
315
316     $item->{imageurl} = defined $item->{itype} ? getitemtypeimagelocation('intranet', $itemtypes->{ $item->{itype} }{imageurl})
317                                                : '';
318
319     $item->{datedue} = format_sqldatetime($item->{datedue});
320
321     #get shelf location and collection code description if they are authorised value.
322     # same thing for copy number
323     my $shelfcode = $item->{'location'};
324     $item->{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) );
325     my $ccode = $item->{'ccode'};
326     $item->{'ccode'} = $collections->{$ccode} if ( defined( $ccode ) && defined($collections) && exists( $collections->{$ccode} ) );
327     my $copynumber = $item->{'copynumber'};
328     $item->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumber) && defined($copynumbers) && exists( $copynumbers->{$copynumber} ) );
329     foreach (qw(ccode enumchron copynumber stocknumber itemnotes itemnotes_nonpublic uri publisheddate)) { # Warning when removing GetItemsInfo - publisheddate (at least) is not part of the items table
330         $itemfields{$_} = 1 if ( $item->{$_} );
331     }
332
333     # checking for holds
334     my $item_object = Koha::Items->find( $item->{itemnumber} );
335     my $holds = $item_object->current_holds;
336     if ( my $first_hold = $holds->next ) {
337         $item->{first_hold} = $first_hold;
338     }
339
340     if ( my $checkout = $item_object->checkout ) {
341         $item->{CheckedOutFor} = $checkout->patron;
342     }
343
344     # Check the transit status
345     my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($item->{itemnumber});
346     if ( defined( $transfertwhen ) && ( $transfertwhen ne '' ) ) {
347         $item->{transfertwhen} = $transfertwhen;
348         $item->{transfertfrom} = $transfertfrom;
349         $item->{transfertto}   = $transfertto;
350         $item->{nocancel} = 1;
351     }
352
353     foreach my $f (qw( itemnotes )) {
354         if ($item->{$f}) {
355             $item->{$f} =~ s|\n|<br />|g;
356             $itemfields{$f} = 1;
357         }
358     }
359
360     #item has a host number if its biblio number does not match the current bib
361
362     if ($item->{biblionumber} ne $biblionumber){
363         $item->{hostbiblionumber} = $item->{biblionumber};
364         $item->{hosttitle} = GetBiblioData($item->{biblionumber})->{title};
365     }
366         
367
368     if ( $analyze ) {
369         # count if item is used in analytical bibliorecords
370         # The 'countanalytics' flag is only used in the templates if analyze is set
371         my $countanalytics = C4::Context->preference('EasyAnalyticalRecords') ? GetAnalyticsCount($item->{itemnumber}) : 0;
372         if ($countanalytics > 0){
373             $analytics_flag=1;
374             $item->{countanalytics} = $countanalytics;
375         }
376     }
377
378     if (defined($item->{'materials'}) && $item->{'materials'} =~ /\S/){
379         $materials_flag = 1;
380         if (defined $materials_map{ $item->{materials} }) {
381             $item->{materials} = $materials_map{ $item->{materials} };
382         }
383     }
384
385     if ( C4::Context->preference('UseCourseReserves') ) {
386         $item->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $item->{'itemnumber'} );
387     }
388
389     if ( C4::Context->preference('IndependentBranches') ) {
390         my $userenv = C4::Context->userenv();
391         if ( not C4::Context->IsSuperLibrarian()
392             and $userenv->{branch} ne $item->{homebranch} ) {
393             $item->{cannot_be_edited} = 1;
394         }
395     }
396
397     if ( C4::Context->preference("LocalCoverImages") == 1 ) {
398         $item->{cover_images} = $item_object->cover_images;
399     }
400
401     if ($currentbranch and C4::Context->preference('SeparateHoldings')) {
402         if ($itembranchcode and $itembranchcode eq $currentbranch) {
403             push @itemloop, $item;
404             $itemloop_has_images++ if $item_object->cover_images->count;
405         } else {
406             push @otheritemloop, $item;
407             $otheritemloop_has_images++ if $item_object->cover_images->count;
408         }
409     } else {
410         push @itemloop, $item;
411         $itemloop_has_images++ if $item_object->cover_images->count;
412     }
413 }
414
415 $template->param(
416     itemloop_has_images      => $itemloop_has_images,
417     otheritemloop_has_images => $otheritemloop_has_images,
418 );
419
420 # Display only one tab if one items list is empty
421 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) {
422     $template->param(SeparateHoldings => 0);
423     if (scalar(@itemloop) == 0) {
424         @itemloop = @otheritemloop;
425     }
426 }
427
428 my $some_private_shelves = Koha::Virtualshelves->get_some_shelves(
429     {
430         borrowernumber => $borrowernumber,
431         add_allowed    => 1,
432         category       => 1,
433     }
434 );
435 my $some_public_shelves = Koha::Virtualshelves->get_some_shelves(
436     {
437         borrowernumber => $borrowernumber,
438         add_allowed    => 1,
439         category       => 2,
440     }
441 );
442
443
444 $template->param(
445     add_to_some_private_shelves => $some_private_shelves,
446     add_to_some_public_shelves  => $some_public_shelves,
447 );
448
449 $template->param(
450     MARCNOTES   => $marcnotesarray,
451     itemdata_ccode      => $itemfields{ccode},
452     itemdata_enumchron  => $itemfields{enumchron},
453     itemdata_uri        => $itemfields{uri},
454     itemdata_copynumber => $itemfields{copynumber},
455     itemdata_stocknumber => $itemfields{stocknumber},
456     itemdata_publisheddate => $itemfields{publisheddate},
457     volinfo                => $itemfields{enumchron},
458         itemdata_itemnotes  => $itemfields{itemnotes},
459         itemdata_nonpublicnotes => $itemfields{itemnotes_nonpublic},
460     z3950_search_params    => C4::Search::z3950_search_args($dat),
461         hostrecords         => $hostrecords,
462     analytics_flag    => $analytics_flag,
463     C4::Search::enabled_staff_search_views,
464         materials       => $materials_flag,
465 );
466
467 if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) {
468     my $fieldspec = C4::Context->preference("AlternateHoldingsField");
469     my $subfields = substr $fieldspec, 3;
470     my $holdingsep = C4::Context->preference("AlternateHoldingsSeparator") || ' ';
471     my @alternateholdingsinfo = ();
472     my @holdingsfields = $record->field(substr $fieldspec, 0, 3);
473
474     for my $field (@holdingsfields) {
475         my %holding = ( holding => '' );
476         my $havesubfield = 0;
477         for my $subfield ($field->subfields()) {
478             if ((index $subfields, $$subfield[0]) >= 0) {
479                 $holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0);
480                 $holding{'holding'} .= $$subfield[1];
481                 $havesubfield++;
482             }
483         }
484         if ($havesubfield) {
485             push(@alternateholdingsinfo, \%holding);
486         }
487     }
488
489     $template->param(
490         ALTERNATEHOLDINGS   => \@alternateholdingsinfo,
491         );
492 }
493
494 my @results = ( $dat, );
495 foreach ( keys %{$dat} ) {
496     $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
497 }
498
499 # does not work: my %views_enabled = map { $_ => 1 } $template->query(loop => 'EnableViews');
500 # method query not found?!?!
501 $template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("AmazonCoverImages"));
502 $template->param(
503     itemloop        => \@itemloop,
504     otheritemloop   => \@otheritemloop,
505     biblionumber        => $biblionumber,
506     ($analyze? 'analyze':'detailview') =>1,
507     subscriptions       => \@subs,
508     subscriptionsnumber => $subscriptionsnumber,
509     subscriptiontitle   => $dat->{title},
510     searchid            => scalar $query->param('searchid'),
511 );
512
513 # Lists
514
515 if (C4::Context->preference("virtualshelves") ) {
516     my $shelves = Koha::Virtualshelves->search(
517         {
518             biblionumber => $biblionumber,
519             category => 2,
520         },
521         {
522             join => 'virtualshelfcontents',
523         }
524     );
525     $template->param( 'shelves' => $shelves );
526 }
527
528 # XISBN Stuff
529 if (C4::Context->preference("FRBRizeEditions")==1) {
530     eval {
531         $template->param(
532             XISBNS => scalar get_xisbns($isbn, $biblionumber)
533         );
534     };
535     if ($@) { warn "XISBN Failed $@"; }
536 }
537
538 if ( C4::Context->preference("LocalCoverImages") == 1 ) {
539     my $images = $biblio->cover_images;
540     $template->param( localimages => $biblio->cover_images );
541 }
542
543 # HTML5 Media
544 if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->preference("HTML5MediaEnabled") eq 'staff') ) {
545     $template->param( C4::HTML5Media->gethtml5media($record));
546 }
547
548 # Displaying tags
549 my $tag_quantity;
550 if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) {
551     $template->param(
552         TagsEnabled => 1,
553         TagsShowOnDetail => $tag_quantity
554     );
555     $template->param(TagLoop => get_tags({biblionumber=>$biblionumber, approved=>1,
556                                 'sort'=>'-weight', limit=>$tag_quantity}));
557 }
558
559 #we only need to pass the number of holds to the template
560 my $holds = $biblio->holds;
561 $template->param( holdcount => $holds->count );
562
563 # Check if there are any ILL requests connected to the biblio
564 my $illrequests =
565     C4::Context->preference('ILLModule')
566   ? Koha::Illrequests->search( { biblio_id => $biblionumber } )
567   : [];
568 $template->param( illrequests => $illrequests );
569
570 my $StaffDetailItemSelection = C4::Context->preference('StaffDetailItemSelection');
571 if ($StaffDetailItemSelection) {
572     # Only enable item selection if user can execute at least one action
573     if (
574         $flags->{superlibrarian}
575         || (
576             ref $flags->{tools} eq 'HASH' && (
577                 $flags->{tools}->{items_batchmod}       # Modify selected items
578                 || $flags->{tools}->{items_batchdel}    # Delete selected items
579             )
580         )
581         || ( ref $flags->{tools} eq '' && $flags->{tools} )
582       )
583     {
584         $template->param(
585             StaffDetailItemSelection => $StaffDetailItemSelection );
586     }
587 }
588
589 # get biblionumbers stored in the cart
590 my @cart_list;
591
592 if($query->cookie("intranet_bib_list")){
593     my $cart_list = $query->cookie("intranet_bib_list");
594     @cart_list = split(/\//, $cart_list);
595     if ( grep {$_ eq $biblionumber} @cart_list) {
596         $template->param( incart => 1 );
597     }
598 }
599
600 if ( C4::Context->preference('UseCourseReserves') ) {
601     my $course_reserves = GetItemCourseReservesInfo( biblionumber => $biblionumber );
602     $template->param( course_reserves => $course_reserves );
603 }
604
605 $template->param(biblio => $biblio);
606
607 output_html_with_http_headers $query, $cookie, $template->output;