Bug 16035: MARC default bibliographic framework Export fix
[koha.git] / opac / opac-detail.pl
blobde1b72fec31973623e2e45813204e8a5c23cd242
1 #!/usr/bin/perl
3 # Copyright 2000-2002 Katipo Communications
4 # Copyright 2010 BibLibre
5 # Copyright 2011 KohaAloha, NZ
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 3 of the License, or
12 # (at your option) any later version.
14 # Koha is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 use Modern::Perl;
25 use CGI qw ( -utf8 );
26 use C4::Acquisition qw( SearchOrders );
27 use C4::Auth qw(:DEFAULT get_session);
28 use C4::Branch;
29 use C4::Koha;
30 use C4::Serials; #uses getsubscriptionfrom biblionumber
31 use C4::Output;
32 use C4::Biblio;
33 use C4::Items;
34 use C4::Circulation;
35 use C4::Tags qw(get_tags);
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::Ratings;
41 use C4::Members;
42 use C4::XSLT;
43 use C4::ShelfBrowser;
44 use C4::Reserves;
45 use C4::Charset;
46 use MARC::Record;
47 use MARC::Field;
48 use List::MoreUtils qw/any none/;
49 use C4::Images;
50 use Koha::DateUtils;
51 use C4::HTML5Media;
52 use C4::CourseReserves qw(GetItemCourseReservesInfo);
53 use Koha::RecordProcessor;
54 use Koha::Virtualshelves;
56 BEGIN {
57 if (C4::Context->preference('BakerTaylorEnabled')) {
58 require C4::External::BakerTaylor;
59 import C4::External::BakerTaylor qw(&image_url &link_url);
63 my $query = new CGI;
64 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
66 template_name => "opac-detail.tt",
67 query => $query,
68 type => "opac",
69 authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
73 my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
74 $biblionumber = int($biblionumber);
76 my @all_items = GetItemsInfo($biblionumber);
77 my @hiddenitems;
78 if (scalar @all_items >= 1) {
79 push @hiddenitems, GetHiddenItemnumbers(@all_items);
81 if (scalar @hiddenitems == scalar @all_items ) {
82 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
83 exit;
87 my $record = GetMarcBiblio($biblionumber);
88 if ( ! $record ) {
89 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
90 exit;
92 my $framework = &GetFrameworkCode( $biblionumber );
93 my $record_processor = Koha::RecordProcessor->new({
94 filters => 'ViewPolicy',
95 options => {
96 interface => 'opac',
97 frameworkcode => $framework
99 });
100 $record_processor->process($record);
102 # redirect if opacsuppression is enabled and biblio is suppressed
103 if (C4::Context->preference('OpacSuppression')) {
104 # FIXME hardcoded; the suppression flag ought to be materialized
105 # as a column on biblio or the like
106 my $opacsuppressionfield = '942';
107 my $opacsuppressionfieldvalue = $record->field($opacsuppressionfield);
108 # redirect to opac-blocked info page or 404?
109 my $opacsuppressionredirect;
110 if ( C4::Context->preference("OpacSuppressionRedirect") ) {
111 $opacsuppressionredirect = "/cgi-bin/koha/opac-blocked.pl";
112 } else {
113 $opacsuppressionredirect = "/cgi-bin/koha/errors/404.pl";
115 if ( $opacsuppressionfieldvalue &&
116 $opacsuppressionfieldvalue->subfield("n") &&
117 $opacsuppressionfieldvalue->subfield("n") == 1) {
118 # if OPAC suppression by IP address
119 if (C4::Context->preference('OpacSuppressionByIPRange')) {
120 my $IPAddress = $ENV{'REMOTE_ADDR'};
121 my $IPRange = C4::Context->preference('OpacSuppressionByIPRange');
122 if ($IPAddress !~ /^$IPRange/) {
123 print $query->redirect($opacsuppressionredirect);
124 exit;
126 } else {
127 print $query->redirect($opacsuppressionredirect);
128 exit;
133 $template->param( biblionumber => $biblionumber );
135 # get biblionumbers stored in the cart
136 my @cart_list;
138 if($query->cookie("bib_list")){
139 my $cart_list = $query->cookie("bib_list");
140 @cart_list = split(/\//, $cart_list);
141 if ( grep {$_ eq $biblionumber} @cart_list) {
142 $template->param( incart => 1 );
147 SetUTF8Flag($record);
148 my $marcflavour = C4::Context->preference("marcflavour");
149 my $ean = GetNormalizedEAN( $record, $marcflavour );
151 # XSLT processing of some stuff
152 my $xslfile = C4::Context->preference('OPACXSLTDetailsDisplay');
153 my $lang = $xslfile ? C4::Languages::getlanguage() : undef;
154 my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
156 if ( $xslfile ) {
157 $template->param(
158 XSLTBloc => XSLTParse4Display(
159 $biblionumber, $record, "OPACXSLTDetailsDisplay",
160 1, undef, $sysxml, $xslfile, $lang
165 my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults");
166 $template->{VARS}->{'OpacBrowseResults'} = $OpacBrowseResults;
168 # We look for the busc param to build the simple paging from the search
169 if ($OpacBrowseResults) {
170 my $session = get_session($query->cookie("CGISESSID"));
171 my %paging = (previous => {}, next => {});
172 if ($session->param('busc')) {
173 use C4::Search;
174 use URI::Escape;
176 # Rebuild the string to store on session
177 # param value is URI encoded and params separator is HTML encode (&amp;)
178 sub rebuildBuscParam
180 my $arrParamsBusc = shift;
182 my $pasarParams = '';
183 my $j = 0;
184 for (keys %$arrParamsBusc) {
185 if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) {
186 if (defined($arrParamsBusc->{$_})) {
187 $pasarParams .= '&amp;' if ($j);
188 $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8( $arrParamsBusc->{$_} ));
189 $j++;
191 } else {
192 for my $value (@{$arrParamsBusc->{$_}}) {
193 $pasarParams .= '&amp;' if ($j);
194 $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8($value));
195 $j++;
199 return $pasarParams;
200 }#rebuildBuscParam
202 # Search given the current values from the busc param
203 sub searchAgain
205 my ($arrParamsBusc, $offset, $results_per_page) = @_;
207 my $expanded_facet = $arrParamsBusc->{'expand'};
208 my $branches = GetBranches();
209 my $itemtypes = GetItemTypes;
210 my @servers;
211 @servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
212 @servers = ("biblioserver") unless (@servers);
214 my ($default_sort_by, @sort_by);
215 $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
216 @sort_by = @{$arrParamsBusc->{'sort_by'}} if $arrParamsBusc->{'sort_by'};
217 $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
218 my ($error, $results_hashref, $facets);
219 eval {
220 ($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'});
222 my $hits;
223 my @newresults;
224 for (my $i=0;$i<@servers;$i++) {
225 my $server = $servers[$i];
226 $hits = $results_hashref->{$server}->{"hits"};
227 @newresults = searchResults('opac', '', $hits, $results_per_page, $offset, $arrParamsBusc->{'scan'}, $results_hashref->{$server}->{"RECORDS"});
229 return \@newresults;
230 }#searchAgain
232 # Build the current list of biblionumbers in this search
233 sub buildListBiblios
235 my ($newresultsRef, $results_per_page) = @_;
237 my $listBiblios = '';
238 my $j = 0;
239 foreach (@$newresultsRef) {
240 my $bibnum = ($_->{biblionumber})?$_->{biblionumber}:0;
241 $listBiblios .= $bibnum . ',';
242 $j++;
243 last if ($j == $results_per_page);
245 chop $listBiblios if ($listBiblios =~ /,$/);
246 return $listBiblios;
247 }#buildListBiblios
249 my $busc = $session->param("busc");
250 my @arrBusc = split(/\&(?:amp;)?/, $busc);
251 my ($key, $value);
252 my %arrParamsBusc = ();
253 for (@arrBusc) {
254 ($key, $value) = split(/=/, $_, 2);
255 if ($key =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/) {
256 $arrParamsBusc{$key} = uri_unescape($value);
257 } else {
258 unless (exists($arrParamsBusc{$key})) {
259 $arrParamsBusc{$key} = [];
261 push @{$arrParamsBusc{$key}}, uri_unescape($value);
264 my $searchAgain = 0;
265 my $count = C4::Context->preference('OPACnumSearchResults') || 20;
266 my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
267 $arrParamsBusc{'count'} = $results_per_page;
268 my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
269 # The value OPACnumSearchResults has changed and the search has to be rebuild
270 if ($count != $results_per_page) {
271 if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
272 my $indexBiblio = 0;
273 my @arrBibliosAux = split(',', $arrParamsBusc{'listBiblios'});
274 for (@arrBibliosAux) {
275 last if ($_ == $biblionumber);
276 $indexBiblio++;
278 $indexBiblio += $offset;
279 $offset = int($indexBiblio / $count) * $count;
280 $arrParamsBusc{'offset'} = $offset;
282 $arrParamsBusc{'count'} = $count;
283 $results_per_page = $count;
284 my $newresultsRef = searchAgain(\%arrParamsBusc, $offset, $results_per_page);
285 $arrParamsBusc{'listBiblios'} = buildListBiblios($newresultsRef, $results_per_page);
286 delete $arrParamsBusc{'previous'} if (exists($arrParamsBusc{'previous'}));
287 delete $arrParamsBusc{'next'} if (exists($arrParamsBusc{'next'}));
288 delete $arrParamsBusc{'offsetSearch'} if (exists($arrParamsBusc{'offsetSearch'}));
289 delete $arrParamsBusc{'newlistBiblios'} if (exists($arrParamsBusc{'newlistBiblios'}));
290 my $newbusc = rebuildBuscParam(\%arrParamsBusc);
291 $session->param("busc" => $newbusc);
292 @arrBusc = split(/\&(?:amp;)?/, $newbusc);
293 } else {
294 my $modifyListBiblios = 0;
295 # We come from a previous click
296 if (exists($arrParamsBusc{'previous'})) {
297 $modifyListBiblios = 1 if ($biblionumber == $arrParamsBusc{'previous'});
298 delete $arrParamsBusc{'previous'};
299 } elsif (exists($arrParamsBusc{'next'})) { # We come from a next click
300 $modifyListBiblios = 2 if ($biblionumber == $arrParamsBusc{'next'});
301 delete $arrParamsBusc{'next'};
303 if ($modifyListBiblios) {
304 if (exists($arrParamsBusc{'newlistBiblios'})) {
305 my $listBibliosAux = $arrParamsBusc{'listBiblios'};
306 $arrParamsBusc{'listBiblios'} = $arrParamsBusc{'newlistBiblios'};
307 my @arrAux = split(',', $listBibliosAux);
308 $arrParamsBusc{'newlistBiblios'} = $listBibliosAux;
309 if ($modifyListBiblios == 1) {
310 $arrParamsBusc{'next'} = $arrAux[0];
311 $paging{'next'}->{biblionumber} = $arrAux[0];
312 }else {
313 $arrParamsBusc{'previous'} = $arrAux[$#arrAux];
314 $paging{'previous'}->{biblionumber} = $arrAux[$#arrAux];
316 } else {
317 delete $arrParamsBusc{'listBiblios'};
319 my $offsetAux = $arrParamsBusc{'offset'};
320 $arrParamsBusc{'offset'} = $arrParamsBusc{'offsetSearch'};
321 $arrParamsBusc{'offsetSearch'} = $offsetAux;
322 $offset = $arrParamsBusc{'offset'};
323 my $newbusc = rebuildBuscParam(\%arrParamsBusc);
324 $session->param("busc" => $newbusc);
325 @arrBusc = split(/\&(?:amp;)?/, $newbusc);
328 my $buscParam = '';
329 my $j = 0;
330 # Rebuild the query for the button "back to results"
331 for (@arrBusc) {
332 unless ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|count|offsetSearch)/) {
333 $buscParam .= '&amp;' unless ($j == 0);
334 $buscParam .= $_; # string already URI encoded
335 $j++;
338 $template->param('busc' => $buscParam);
339 my $offsetSearch;
340 my @arrBiblios;
341 # We are inside the list of biblios and we don't have to search
342 if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
343 @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
344 if (@arrBiblios) {
345 # We are at the first item of the list
346 if ($arrBiblios[0] == $biblionumber) {
347 if (@arrBiblios > 1) {
348 for (my $j = 1; $j < @arrBiblios; $j++) {
349 next unless ($arrBiblios[$j]);
350 $paging{'next'}->{biblionumber} = $arrBiblios[$j];
351 last;
354 # search again if we are not at the first searching list
355 if ($offset && !$arrParamsBusc{'previous'}) {
356 $searchAgain = 1;
357 $offsetSearch = $offset - $results_per_page;
359 # we are at the last item of the list
360 } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
361 for (my $j = $#arrBiblios - 1; $j >= 0; $j--) {
362 next unless ($arrBiblios[$j]);
363 $paging{'previous'}->{biblionumber} = $arrBiblios[$j];
364 last;
366 if (!$offset) {
367 # search again if we are at the first list and there is more results
368 $searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} != @arrBiblios);
369 } else {
370 # search again if we aren't at the first list and there is more results
371 $searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} > ($offset + @arrBiblios));
373 $offsetSearch = $offset + $results_per_page if ($searchAgain);
374 } else {
375 for (my $j = 1; $j < $#arrBiblios; $j++) {
376 if ($arrBiblios[$j] == $biblionumber) {
377 for (my $z = $j - 1; $z >= 0; $z--) {
378 next unless ($arrBiblios[$z]);
379 $paging{'previous'}->{biblionumber} = $arrBiblios[$z];
380 last;
382 for (my $z = $j + 1; $z < @arrBiblios; $z++) {
383 next unless ($arrBiblios[$z]);
384 $paging{'next'}->{biblionumber} = $arrBiblios[$z];
385 last;
387 last;
392 $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
394 if ($searchAgain) {
395 my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
396 my @newresults = @$newresultsRef;
397 # build the new listBiblios
398 my $listBiblios = buildListBiblios(\@newresults, $results_per_page);
399 unless (exists($arrParamsBusc{'listBiblios'})) {
400 $arrParamsBusc{'listBiblios'} = $listBiblios;
401 @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
402 } else {
403 $arrParamsBusc{'newlistBiblios'} = $listBiblios;
405 # From the new list we build again the next and previous result
406 if (@arrBiblios) {
407 if ($arrBiblios[0] == $biblionumber) {
408 for (my $j = $#newresults; $j >= 0; $j--) {
409 next unless ($newresults[$j]);
410 $paging{'previous'}->{biblionumber} = $newresults[$j]->{biblionumber};
411 $arrParamsBusc{'previous'} = $paging{'previous'}->{biblionumber};
412 $arrParamsBusc{'offsetSearch'} = $offsetSearch;
413 last;
415 } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
416 for (my $j = 0; $j < @newresults; $j++) {
417 next unless ($newresults[$j]);
418 $paging{'next'}->{biblionumber} = $newresults[$j]->{biblionumber};
419 $arrParamsBusc{'next'} = $paging{'next'}->{biblionumber};
420 $arrParamsBusc{'offsetSearch'} = $offsetSearch;
421 last;
425 # build new busc param
426 my $newbusc = rebuildBuscParam(\%arrParamsBusc);
427 $session->param("busc" => $newbusc);
429 my ($numberBiblioPaging, $dataBiblioPaging);
430 # Previous biblio
431 $numberBiblioPaging = $paging{'previous'}->{biblionumber};
432 if ($numberBiblioPaging) {
433 $template->param( 'previousBiblionumber' => $numberBiblioPaging );
434 $dataBiblioPaging = GetBiblioData($numberBiblioPaging);
435 $template->param('previousTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging);
437 # Next biblio
438 $numberBiblioPaging = $paging{'next'}->{biblionumber};
439 if ($numberBiblioPaging) {
440 $template->param( 'nextBiblionumber' => $numberBiblioPaging );
441 $dataBiblioPaging = GetBiblioData($numberBiblioPaging);
442 $template->param('nextTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging);
444 # Partial list of biblio results
445 my @listResults;
446 for (my $j = 0; $j < @arrBiblios; $j++) {
447 next unless ($arrBiblios[$j]);
448 $dataBiblioPaging = GetBiblioData($arrBiblios[$j]) if ($arrBiblios[$j] != $biblionumber);
449 push @listResults, {index => $j + 1 + $offset, biblionumber => $arrBiblios[$j], title => ($arrBiblios[$j] == $biblionumber)?'':$dataBiblioPaging->{title}, author => ($arrBiblios[$j] != $biblionumber && $dataBiblioPaging->{author})?$dataBiblioPaging->{author}:'', url => ($arrBiblios[$j] == $biblionumber)?'':'opac-detail.pl?biblionumber=' . $arrBiblios[$j]};
451 $template->param('listResults' => \@listResults) if (@listResults);
452 $template->param('indexPag' => 1 + $offset, 'totalPag' => $arrParamsBusc{'total'}, 'indexPagEnd' => scalar(@arrBiblios) + $offset);
457 $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
458 $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") );
459 $template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") );
461 # adding items linked via host biblios
463 my $analyticfield = '773';
464 if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){
465 $analyticfield = '773';
466 } elsif ($marcflavour eq 'UNIMARC') {
467 $analyticfield = '461';
469 foreach my $hostfield ( $record->field($analyticfield)) {
470 my $hostbiblionumber = $hostfield->subfield("0");
471 my $linkeditemnumber = $hostfield->subfield("9");
472 my @hostitemInfos = GetItemsInfo($hostbiblionumber);
473 foreach my $hostitemInfo (@hostitemInfos){
474 if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){
475 push(@all_items, $hostitemInfo);
480 my @items;
482 # Are there items to hide?
483 my $hideitems;
484 $hideitems = 1 if C4::Context->preference('hidelostitems') or scalar(@hiddenitems) > 0;
486 # Hide items
487 if ($hideitems) {
488 for my $itm (@all_items) {
489 if ( C4::Context->preference('hidelostitems') ) {
490 push @items, $itm unless $itm->{itemlost} or any { $itm->{'itemnumber'} eq $_ } @hiddenitems;
491 } else {
492 push @items, $itm unless any { $itm->{'itemnumber'} eq $_ } @hiddenitems;
495 } else {
496 # Or not
497 @items = @all_items;
500 my $branches = GetBranches();
501 my $branch = '';
502 if (C4::Context->userenv){
503 $branch = C4::Context->userenv->{branch};
505 if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
506 if (
507 ( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )
509 C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
511 my $branchname;
512 if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
513 $branchname = $branches->{$branch}->{'branchname'};
515 elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
516 $branchname = $branches->{ $ENV{'BRANCHCODE'} }->{'branchname'};
519 my @our_items;
520 my @other_items;
522 foreach my $item ( @items ) {
523 if ( $item->{'branchname'} eq $branchname ) {
524 $item->{'this_branch'} = 1;
525 push( @our_items, $item );
526 } else {
527 push( @other_items, $item );
531 @items = ( @our_items, @other_items );
535 my $dat = &GetBiblioData($biblionumber);
536 my $HideMARC = $record_processor->filters->[0]->should_hide_marc(
538 frameworkcode => $dat->{'frameworkcode'},
539 interface => 'opac',
540 } );
542 my $itemtypes = GetItemTypes();
543 # imageurl:
544 my $itemtype = $dat->{'itemtype'};
545 if ( $itemtype ) {
546 $dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
547 $dat->{'description'} = $itemtypes->{$itemtype}->{translated_description};
549 my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac');
550 my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac');
551 my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac');
553 #coping with subscriptions
554 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
555 my @subscriptions = SearchSubscriptions({ biblionumber => $biblionumber, orderby => 'title' });
557 my @subs;
558 $dat->{'serial'}=1 if $subscriptionsnumber;
559 foreach my $subscription (@subscriptions) {
560 my $serials_to_display;
561 my %cell;
562 $cell{subscriptionid} = $subscription->{subscriptionid};
563 $cell{subscriptionnotes} = $subscription->{notes};
564 $cell{missinglist} = $subscription->{missinglist};
565 $cell{opacnote} = $subscription->{opacnote};
566 $cell{histstartdate} = $subscription->{histstartdate};
567 $cell{histenddate} = $subscription->{histenddate};
568 $cell{branchcode} = $subscription->{branchcode};
569 $cell{branchname} = GetBranchName($subscription->{branchcode});
570 $cell{hasalert} = $subscription->{hasalert};
571 $cell{callnumber} = $subscription->{callnumber};
572 $cell{closed} = $subscription->{closed};
573 #get the three latest serials.
574 $serials_to_display = $subscription->{opacdisplaycount};
575 $serials_to_display = C4::Context->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
576 $cell{opacdisplaycount} = $serials_to_display;
577 $cell{latestserials} =
578 GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display );
579 push @subs, \%cell;
582 $dat->{'count'} = scalar(@items);
585 my (%item_reserves, %priority);
586 my ($show_holds_count, $show_priority);
587 for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
588 m/holds/o and $show_holds_count = 1;
589 m/priority/ and $show_priority = 1;
591 my $has_hold;
592 if ( $show_holds_count || $show_priority) {
593 my $reserves = GetReservesFromBiblionumber({ biblionumber => $biblionumber, all_dates => 1 });
594 $template->param( holds_count => scalar( @$reserves ) ) if $show_holds_count;
595 foreach (@$reserves) {
596 $item_reserves{ $_->{itemnumber} }++ if $_->{itemnumber};
597 if ($show_priority && $_->{borrowernumber} == $borrowernumber) {
598 $has_hold = 1;
599 $_->{itemnumber}
600 ? ($priority{ $_->{itemnumber} } = $_->{priority})
601 : ($template->param( priority => $_->{priority} ));
605 $template->param( show_priority => $has_hold ) ;
607 my $norequests = 1;
608 my %itemfields;
609 my (@itemloop, @otheritemloop);
610 my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
611 if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
612 $template->param(SeparateHoldings => 1);
614 my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch');
615 my $viewallitems = $query->param('viewallitems');
616 my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50;
618 # Get items on order
619 my ( @itemnumbers_on_order );
620 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) {
621 my $orders = C4::Acquisition::SearchOrders({
622 biblionumber => $biblionumber,
623 ordered => 1,
625 my $total_quantity = 0;
626 for my $order ( @$orders ) {
627 if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
628 for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
629 push @itemnumbers_on_order, $itemnumber;
632 $total_quantity += $order->{quantity};
634 $template->{VARS}->{acquisition_details} = {
635 total_quantity => $total_quantity,
639 if ( not $viewallitems and @items > $max_items_to_display ) {
640 $template->param(
641 too_many_items => 1,
642 items_count => scalar( @items ),
644 } else {
645 my $allow_onshelf_holds;
646 my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
647 for my $itm (@items) {
648 $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
649 $itm->{priority} = $priority{ $itm->{itemnumber} };
650 $norequests = 0
651 if $norequests
652 && !$itm->{'withdrawn'}
653 && !$itm->{'itemlost'}
654 && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'})
655 && !$itemtypes->{$itm->{'itype'}}->{notforloan}
656 && $itm->{'itemnumber'};
658 $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, $borrower )
659 unless $allow_onshelf_holds;
661 # get collection code description, too
662 my $ccode = $itm->{'ccode'};
663 $itm->{'ccode'} = $collections->{$ccode} if defined($ccode) && $collections && exists( $collections->{$ccode} );
664 my $copynumber = $itm->{'copynumber'};
665 $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
666 if ( defined $itm->{'location'} ) {
667 $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
669 if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
670 $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
671 $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{translated_description};
673 foreach (qw(ccode enumchron copynumber itemnotes uri)) {
674 $itemfields{$_} = 1 if ($itm->{$_});
677 my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber});
678 if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
679 if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
681 my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
682 if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
683 $itm->{transfertwhen} = $transfertwhen;
684 $itm->{transfertfrom} = $branches->{$transfertfrom}{branchname};
685 $itm->{transfertto} = $branches->{$transfertto}{branchname};
688 if ( C4::Context->preference('OPACAcquisitionDetails')
689 and C4::Context->preference('AcqCreateItem') eq 'ordering' )
691 $itm->{on_order} = 1
692 if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
695 my $itembranch = $itm->{$separatebranch};
696 if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
697 if ($itembranch and $itembranch eq $currentbranch) {
698 push @itemloop, $itm;
699 } else {
700 push @otheritemloop, $itm;
702 } else {
703 push @itemloop, $itm;
706 $template->param( 'AllowOnShelfHolds' => $allow_onshelf_holds );
709 # Display only one tab if one items list is empty
710 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) {
711 $template->param(SeparateHoldings => 0);
712 if (scalar(@itemloop) == 0) {
713 @itemloop = @otheritemloop;
717 ## get notes and subjects from MARC record
718 if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) {
719 my $marcisbnsarray = GetMarcISBN ($record,$marcflavour);
720 my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
721 my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
722 my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
723 my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
724 my $marchostsarray = GetMarcHosts($record,$marcflavour);
726 $template->param(
727 MARCSUBJCTS => $marcsubjctsarray,
728 MARCAUTHORS => $marcauthorsarray,
729 MARCSERIES => $marcseriesarray,
730 MARCURLS => $marcurlsarray,
731 MARCISBNS => $marcisbnsarray,
732 MARCHOSTS => $marchostsarray,
736 my $marcnotesarray = GetMarcNotes ($record,$marcflavour);
737 my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
739 $template->param(
740 MARCNOTES => $marcnotesarray,
741 norequests => $norequests,
742 RequestOnOpac => C4::Context->preference("RequestOnOpac"),
743 itemdata_ccode => $itemfields{ccode},
744 itemdata_enumchron => $itemfields{enumchron},
745 itemdata_uri => $itemfields{uri},
746 itemdata_copynumber => $itemfields{copynumber},
747 itemdata_itemnotes => $itemfields{itemnotes},
748 subtitle => $subtitle,
749 OpacStarRatings => C4::Context->preference("OpacStarRatings"),
752 if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) {
753 my $fieldspec = C4::Context->preference("AlternateHoldingsField");
754 my $subfields = substr $fieldspec, 3;
755 my $holdingsep = C4::Context->preference("AlternateHoldingsSeparator") || ' ';
756 my @alternateholdingsinfo = ();
757 my @holdingsfields = $record->field(substr $fieldspec, 0, 3);
759 for my $field (@holdingsfields) {
760 my %holding = ( holding => '' );
761 my $havesubfield = 0;
762 for my $subfield ($field->subfields()) {
763 if ((index $subfields, $$subfield[0]) >= 0) {
764 $holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0);
765 $holding{'holding'} .= $$subfield[1];
766 $havesubfield++;
769 if ($havesubfield) {
770 push(@alternateholdingsinfo, \%holding);
774 $template->param(
775 ALTERNATEHOLDINGS => \@alternateholdingsinfo,
779 # FIXME: The template uses this hash directly. Need to filter.
780 foreach ( keys %{$dat} ) {
781 next if ( $HideMARC->{$_} );
782 $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
785 # some useful variables for enhanced content;
786 # in each case, we're grabbing the first value we find in
787 # the record and normalizing it
788 my $upc = GetNormalizedUPC($record,$marcflavour);
789 my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
790 my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
791 my $content_identifier_exists;
792 if ( $isbn or $ean or $oclc or $upc ) {
793 $content_identifier_exists = 1;
795 $template->param(
796 normalized_upc => $upc,
797 normalized_ean => $ean,
798 normalized_oclc => $oclc,
799 normalized_isbn => $isbn,
800 content_identifier_exists => $content_identifier_exists,
803 # COinS format FIXME: for books Only
804 $template->param(
805 ocoins => GetCOinSBiblio($record),
808 my $libravatar_enabled = 0;
809 if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
810 eval {
811 require Libravatar::URL;
812 Libravatar::URL->import();
814 if (!$@ ) {
815 $libravatar_enabled = 1;
819 my $reviews = getreviews( $biblionumber, 1 );
820 my $loggedincommenter;
825 foreach ( @$reviews ) {
826 my $borrowerData = GetMember('borrowernumber' => $_->{borrowernumber});
827 # setting some borrower info into this hash
828 $_->{title} = $borrowerData->{'title'};
829 $_->{surname} = $borrowerData->{'surname'};
830 $_->{firstname} = $borrowerData->{'firstname'};
831 if ($libravatar_enabled and $borrowerData->{'email'}) {
832 $_->{avatarurl} = libravatar_url(email => $borrowerData->{'email'}, https => $ENV{HTTPS});
834 $_->{userid} = $borrowerData->{'userid'};
835 $_->{cardnumber} = $borrowerData->{'cardnumber'};
837 if ($borrowerData->{'borrowernumber'} eq $borrowernumber) {
838 $_->{your_comment} = 1;
839 $loggedincommenter = 1;
843 if ( C4::Context->preference("OPACISBD") ) {
844 $template->param( ISBD => 1 );
847 $template->param(
848 itemloop => \@itemloop,
849 otheritemloop => \@otheritemloop,
850 subscriptionsnumber => $subscriptionsnumber,
851 biblionumber => $biblionumber,
852 subscriptions => \@subs,
853 subscriptionsnumber => $subscriptionsnumber,
854 reviews => $reviews,
855 loggedincommenter => $loggedincommenter
858 # Lists
859 if (C4::Context->preference("virtualshelves") ) {
860 my $shelves = Koha::Virtualshelves->search(
862 biblionumber => $biblionumber,
863 category => 2,
866 join => 'virtualshelfcontents',
869 $template->param( shelves => $shelves );
872 # XISBN Stuff
873 if (C4::Context->preference("OPACFRBRizeEditions")==1) {
874 eval {
875 $template->param(
876 XISBNS => get_xisbns($isbn)
879 if ($@) { warn "XISBN Failed $@"; }
882 # Serial Collection
883 my @sc_fields = $record->field(955);
884 my @lc_fields = $marcflavour eq 'UNIMARC'
885 ? $record->field(930)
886 : $record->field(852);
887 my @serialcollections = ();
889 foreach my $sc_field (@sc_fields) {
890 my %row_data;
892 $row_data{text} = $sc_field->subfield('r');
893 $row_data{branch} = $sc_field->subfield('9');
894 foreach my $lc_field (@lc_fields) {
895 $row_data{itemcallnumber} = $marcflavour eq 'UNIMARC'
896 ? $lc_field->subfield('a') # 930$a
897 : $lc_field->subfield('h') # 852$h
898 if ($sc_field->subfield('5') eq $lc_field->subfield('5'));
901 if ($row_data{text} && $row_data{branch}) {
902 push (@serialcollections, \%row_data);
906 if (scalar(@serialcollections) > 0) {
907 $template->param(
908 serialcollection => 1,
909 serialcollections => \@serialcollections);
912 # Local cover Images stuff
913 if (C4::Context->preference("OPACLocalCoverImages")){
914 $template->param(OPACLocalCoverImages => 1);
917 # HTML5 Media
918 if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->preference("HTML5MediaEnabled") eq 'opac') ) {
919 $template->param( C4::HTML5Media->gethtml5media($record));
922 my $syndetics_elements;
924 if ( C4::Context->preference("SyndeticsEnabled") ) {
925 $template->param("SyndeticsEnabled" => 1);
926 $template->param("SyndeticsClientCode" => C4::Context->preference("SyndeticsClientCode"));
927 eval {
928 $syndetics_elements = &get_syndetics_index($isbn,$upc,$oclc);
929 for my $element (values %$syndetics_elements) {
930 $template->param("Syndetics$element"."Exists" => 1 );
931 #warn "Exists: "."Syndetics$element"."Exists";
934 warn $@ if $@;
937 if ( C4::Context->preference("SyndeticsEnabled")
938 && C4::Context->preference("SyndeticsSummary")
939 && ( exists($syndetics_elements->{'SUMMARY'}) || exists($syndetics_elements->{'AVSUMMARY'}) ) ) {
940 eval {
941 my $syndetics_summary = &get_syndetics_summary($isbn,$upc,$oclc, $syndetics_elements);
942 $template->param( SYNDETICS_SUMMARY => $syndetics_summary );
944 warn $@ if $@;
948 if ( C4::Context->preference("SyndeticsEnabled")
949 && C4::Context->preference("SyndeticsTOC")
950 && exists($syndetics_elements->{'TOC'}) ) {
951 eval {
952 my $syndetics_toc = &get_syndetics_toc($isbn,$upc,$oclc);
953 $template->param( SYNDETICS_TOC => $syndetics_toc );
955 warn $@ if $@;
958 if ( C4::Context->preference("SyndeticsEnabled")
959 && C4::Context->preference("SyndeticsExcerpt")
960 && exists($syndetics_elements->{'DBCHAPTER'}) ) {
961 eval {
962 my $syndetics_excerpt = &get_syndetics_excerpt($isbn,$upc,$oclc);
963 $template->param( SYNDETICS_EXCERPT => $syndetics_excerpt );
965 warn $@ if $@;
968 if ( C4::Context->preference("SyndeticsEnabled")
969 && C4::Context->preference("SyndeticsReviews")) {
970 eval {
971 my $syndetics_reviews = &get_syndetics_reviews($isbn,$upc,$oclc,$syndetics_elements);
972 $template->param( SYNDETICS_REVIEWS => $syndetics_reviews );
974 warn $@ if $@;
977 if ( C4::Context->preference("SyndeticsEnabled")
978 && C4::Context->preference("SyndeticsAuthorNotes")
979 && exists($syndetics_elements->{'ANOTES'}) ) {
980 eval {
981 my $syndetics_anotes = &get_syndetics_anotes($isbn,$upc,$oclc);
982 $template->param( SYNDETICS_ANOTES => $syndetics_anotes );
984 warn $@ if $@;
987 # LibraryThingForLibraries ID Code and Tabbed View Option
988 if( C4::Context->preference('LibraryThingForLibrariesEnabled') )
990 $template->param(LibraryThingForLibrariesID =>
991 C4::Context->preference('LibraryThingForLibrariesID') );
992 $template->param(LibraryThingForLibrariesTabbedView =>
993 C4::Context->preference('LibraryThingForLibrariesTabbedView') );
996 # Novelist Select
997 if( C4::Context->preference('NovelistSelectEnabled') )
999 $template->param(NovelistSelectProfile => C4::Context->preference('NovelistSelectProfile') );
1000 $template->param(NovelistSelectPassword => C4::Context->preference('NovelistSelectPassword') );
1001 $template->param(NovelistSelectView => C4::Context->preference('NovelistSelectView') );
1005 # Babelthèque
1006 if ( C4::Context->preference("Babeltheque") ) {
1007 $template->param(
1008 Babeltheque => 1,
1009 Babeltheque_url_js => C4::Context->preference("Babeltheque_url_js"),
1013 # Social Networks
1014 if ( C4::Context->preference( "SocialNetworks" ) ) {
1015 $template->param( current_url => C4::Context->preference('OPACBaseURL') . "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber" );
1016 $template->param( SocialNetworks => 1 );
1019 # Shelf Browser Stuff
1020 if (C4::Context->preference("OPACShelfBrowser")) {
1021 my $starting_itemnumber = $query->param('shelfbrowse_itemnumber');
1022 if (defined($starting_itemnumber)) {
1023 $template->param( OpenOPACShelfBrowser => 1) if $starting_itemnumber;
1024 my $nearby = GetNearbyItems($starting_itemnumber);
1026 $template->param(
1027 starting_itemnumber => $starting_itemnumber,
1028 starting_homebranch => $nearby->{starting_homebranch}->{description},
1029 starting_location => $nearby->{starting_location}->{description},
1030 starting_ccode => $nearby->{starting_ccode}->{description},
1031 shelfbrowser_prev_item => $nearby->{prev_item},
1032 shelfbrowser_next_item => $nearby->{next_item},
1033 shelfbrowser_items => $nearby->{items},
1036 # in which tab shelf browser should open ?
1037 if (grep { $starting_itemnumber == $_->{itemnumber} } @itemloop) {
1038 $template->param(shelfbrowser_tab => 'holdings');
1039 } else {
1040 $template->param(shelfbrowser_tab => 'otherholdings');
1045 $template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("OPACAmazonCoverImages"));
1047 if (C4::Context->preference("BakerTaylorEnabled")) {
1048 $template->param(
1049 BakerTaylorEnabled => 1,
1050 BakerTaylorImageURL => &image_url(),
1051 BakerTaylorLinkURL => &link_url(),
1052 BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
1054 my ($bt_user, $bt_pass);
1055 if ($isbn and
1056 $bt_user = C4::Context->preference('BakerTaylorUsername') and
1057 $bt_pass = C4::Context->preference('BakerTaylorPassword') )
1059 $template->param(
1060 BakerTaylorContentURL =>
1061 sprintf("http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y",
1062 $bt_user,$bt_pass,$isbn)
1067 my $tag_quantity;
1068 if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) {
1069 $template->param(
1070 TagsEnabled => 1,
1071 TagsShowOnDetail => $tag_quantity,
1072 TagsInputOnDetail => C4::Context->preference('TagsInputOnDetail')
1074 $template->param(TagLoop => get_tags({biblionumber=>$biblionumber, approved=>1,
1075 'sort'=>'-weight', limit=>$tag_quantity}));
1078 if (C4::Context->preference("OPACURLOpenInNewWindow")) {
1079 # These values are going to be read by Javascript, at least in the case
1080 # of the google covers
1081 $template->param(covernewwindow => 'true');
1082 } else {
1083 $template->param(covernewwindow => 'false');
1086 if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) {
1087 my $rating = GetRating( $biblionumber, $borrowernumber );
1088 $template->param(
1089 rating_value => $rating->{'rating_value'},
1090 rating_total => $rating->{'rating_total'},
1091 rating_avg => $rating->{'rating_avg'},
1092 rating_avg_int => $rating->{'rating_avg_int'},
1093 borrowernumber => $borrowernumber
1097 #Search for title in links
1098 my $marccontrolnumber = GetMarcControlnumber ($record, $marcflavour);
1099 my $marcissns = GetMarcISSN ( $record, $marcflavour );
1100 my $issn = $marcissns->[0] || '';
1102 if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
1103 $dat->{title} =~ s/\/+$//; # remove trailing slash
1104 $dat->{title} =~ s/\s+$//; # remove trailing space
1105 $search_for_title = parametrized_url(
1106 $search_for_title,
1108 TITLE => $dat->{title},
1109 AUTHOR => $dat->{author},
1110 ISBN => $isbn,
1111 ISSN => $issn,
1112 CONTROLNUMBER => $marccontrolnumber,
1113 BIBLIONUMBER => $biblionumber,
1116 $template->param('OPACSearchForTitleIn' => $search_for_title);
1119 #IDREF
1120 if ( C4::Context->preference("IDREF") ) {
1121 # If the record comes from the SUDOC
1122 if ( $record->field('009') ) {
1123 my $unimarc3 = $record->field("009")->data;
1124 if ( $unimarc3 =~ /^\d+$/ ) {
1125 $template->param(
1126 IDREF => 1,
1132 # We try to select the best default tab to show, according to what
1133 # the user wants, and what's available for display
1134 my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab');
1135 my $defaulttab =
1136 $opac_serial_default eq 'subscriptions' && $subscriptionsnumber
1137 ? 'subscriptions' :
1138 $opac_serial_default eq 'serialcollection' && @serialcollections > 0
1139 ? 'serialcollection' :
1140 $opac_serial_default eq 'holdings' && scalar (@itemloop) > 0
1141 ? 'holdings' :
1142 $subscriptionsnumber
1143 ? 'subscriptions' :
1144 @serialcollections > 0
1145 ? 'serialcollection' : 'subscriptions';
1146 $template->param('defaulttab' => $defaulttab);
1148 if (C4::Context->preference('OPACLocalCoverImages') == 1) {
1149 my @images = ListImagesForBiblio($biblionumber);
1150 $template->{VARS}->{localimages} = \@images;
1153 $template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews');
1154 $template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer');
1155 $template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults');
1156 $template->{VARS}->{OPACPopupAuthorsSearch} = C4::Context->preference('OPACPopupAuthorsSearch');
1158 if (C4::Context->preference('OpacHighlightedWords')) {
1159 $template->{VARS}->{query_desc} = $query->param('query_desc');
1161 $template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks');
1163 if ( C4::Context->preference('UseCourseReserves') ) {
1164 foreach my $i ( @items ) {
1165 $i->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $i->{'itemnumber'} );
1169 $template->param(
1170 'OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay') ,
1171 'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1174 output_html_with_http_headers $query, $cookie, $template->output;