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