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