Bug 19401: Add confirm message when deleting invoice
[koha.git] / opac / opac-detail.pl
blobe876cabb58971fcc8e1d9837c3d6a4799276e5b8
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::Koha;
29 use C4::Serials; #uses getsubscriptionfrom biblionumber
30 use C4::Output;
31 use C4::Biblio;
32 use C4::Items;
33 use C4::Circulation;
34 use C4::Tags qw(get_tags);
35 use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn);
36 use C4::External::Amazon;
37 use C4::External::Syndetics qw(get_syndetics_index get_syndetics_summary get_syndetics_toc get_syndetics_excerpt get_syndetics_reviews get_syndetics_anotes );
38 use C4::Members;
39 use C4::XSLT;
40 use C4::ShelfBrowser;
41 use C4::Reserves;
42 use C4::Charset;
43 use C4::Letters;
44 use MARC::Record;
45 use MARC::Field;
46 use List::MoreUtils qw/any none/;
47 use C4::Images;
48 use Koha::DateUtils;
49 use C4::HTML5Media;
50 use C4::CourseReserves qw(GetItemCourseReservesInfo);
51 use Koha::RecordProcessor;
52 use Koha::AuthorisedValues;
53 use Koha::Biblios;
54 use Koha::ItemTypes;
55 use Koha::Virtualshelves;
56 use Koha::Ratings;
57 use Koha::Reviews;
59 BEGIN {
60 if (C4::Context->preference('BakerTaylorEnabled')) {
61 require C4::External::BakerTaylor;
62 import C4::External::BakerTaylor qw(&image_url &link_url);
66 my $query = new CGI;
67 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
69 template_name => "opac-detail.tt",
70 query => $query,
71 type => "opac",
72 authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
76 my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
77 $biblionumber = int($biblionumber);
79 my @all_items = GetItemsInfo($biblionumber);
80 my @hiddenitems;
81 if (scalar @all_items >= 1) {
82 push @hiddenitems, GetHiddenItemnumbers(@all_items);
84 if (scalar @hiddenitems == scalar @all_items ) {
85 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
86 exit;
90 my $record = GetMarcBiblio($biblionumber);
91 if ( ! $record ) {
92 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
93 exit;
96 my $biblio = Koha::Biblios->find( $biblionumber );
97 my $framework = &GetFrameworkCode( $biblionumber );
98 my $record_processor = Koha::RecordProcessor->new({
99 filters => 'ViewPolicy',
100 options => {
101 interface => 'opac',
102 frameworkcode => $framework
105 $record_processor->process($record);
107 # redirect if opacsuppression is enabled and biblio is suppressed
108 if (C4::Context->preference('OpacSuppression')) {
109 # FIXME hardcoded; the suppression flag ought to be materialized
110 # as a column on biblio or the like
111 my $opacsuppressionfield = '942';
112 my $opacsuppressionfieldvalue = $record->field($opacsuppressionfield);
113 # redirect to opac-blocked info page or 404?
114 my $opacsuppressionredirect;
115 if ( C4::Context->preference("OpacSuppressionRedirect") ) {
116 $opacsuppressionredirect = "/cgi-bin/koha/opac-blocked.pl";
117 } else {
118 $opacsuppressionredirect = "/cgi-bin/koha/errors/404.pl";
120 if ( $opacsuppressionfieldvalue &&
121 $opacsuppressionfieldvalue->subfield("n") &&
122 $opacsuppressionfieldvalue->subfield("n") == 1) {
123 # if OPAC suppression by IP address
124 if (C4::Context->preference('OpacSuppressionByIPRange')) {
125 my $IPAddress = $ENV{'REMOTE_ADDR'};
126 my $IPRange = C4::Context->preference('OpacSuppressionByIPRange');
127 if ($IPAddress !~ /^$IPRange/) {
128 print $query->redirect($opacsuppressionredirect);
129 exit;
131 } else {
132 print $query->redirect($opacsuppressionredirect);
133 exit;
138 $template->param( biblio => $biblio );
140 # get biblionumbers stored in the cart
141 my @cart_list;
143 if($query->cookie("bib_list")){
144 my $cart_list = $query->cookie("bib_list");
145 @cart_list = split(/\//, $cart_list);
146 if ( grep {$_ eq $biblionumber} @cart_list) {
147 $template->param( incart => 1 );
152 SetUTF8Flag($record);
153 my $marcflavour = C4::Context->preference("marcflavour");
154 my $ean = GetNormalizedEAN( $record, $marcflavour );
156 # XSLT processing of some stuff
157 my $xslfile = C4::Context->preference('OPACXSLTDetailsDisplay');
158 my $lang = $xslfile ? C4::Languages::getlanguage() : undef;
159 my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef;
161 if ( $xslfile ) {
162 $template->param(
163 XSLTBloc => XSLTParse4Display(
164 $biblionumber, $record, "OPACXSLTDetailsDisplay",
165 1, undef, $sysxml, $xslfile, $lang
170 my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults");
171 $template->{VARS}->{'OpacBrowseResults'} = $OpacBrowseResults;
173 # We look for the busc param to build the simple paging from the search
174 if ($OpacBrowseResults) {
175 my $session = get_session($query->cookie("CGISESSID"));
176 my %paging = (previous => {}, next => {});
177 if ($session->param('busc')) {
178 use C4::Search;
179 use URI::Escape;
181 # Rebuild the string to store on session
182 # param value is URI encoded and params separator is HTML encode (&amp;)
183 sub rebuildBuscParam
185 my $arrParamsBusc = shift;
187 my $pasarParams = '';
188 my $j = 0;
189 for (keys %$arrParamsBusc) {
190 if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) {
191 if (defined($arrParamsBusc->{$_})) {
192 $pasarParams .= '&amp;' if ($j);
193 $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8( $arrParamsBusc->{$_} ));
194 $j++;
196 } else {
197 for my $value (@{$arrParamsBusc->{$_}}) {
198 $pasarParams .= '&amp;' if ($j);
199 $pasarParams .= $_ . '=' . Encode::decode('UTF-8', uri_escape_utf8($value));
200 $j++;
204 return $pasarParams;
205 }#rebuildBuscParam
207 # Search given the current values from the busc param
208 sub searchAgain
210 my ($arrParamsBusc, $offset, $results_per_page) = @_;
212 my $expanded_facet = $arrParamsBusc->{'expand'};
213 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
214 my @servers;
215 @servers = @{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
216 @servers = ("biblioserver") unless (@servers);
218 my ($default_sort_by, @sort_by);
219 $default_sort_by = C4::Context->preference('OPACdefaultSortField')."_".C4::Context->preference('OPACdefaultSortOrder') if (C4::Context->preference('OPACdefaultSortField') && C4::Context->preference('OPACdefaultSortOrder'));
220 @sort_by = @{$arrParamsBusc->{'sort_by'}} if $arrParamsBusc->{'sort_by'};
221 $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
222 my ($error, $results_hashref, $facets);
223 eval {
224 ($error, $results_hashref, $facets) = getRecords($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,undef,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'});
226 my $hits;
227 my @newresults;
228 for (my $i=0;$i<@servers;$i++) {
229 my $server = $servers[$i];
230 $hits = $results_hashref->{$server}->{"hits"};
231 @newresults = searchResults('opac', '', $hits, $results_per_page, $offset, $arrParamsBusc->{'scan'}, $results_hashref->{$server}->{"RECORDS"});
233 return \@newresults;
234 }#searchAgain
236 # Build the current list of biblionumbers in this search
237 sub buildListBiblios
239 my ($newresultsRef, $results_per_page) = @_;
241 my $listBiblios = '';
242 my $j = 0;
243 foreach (@$newresultsRef) {
244 my $bibnum = ($_->{biblionumber})?$_->{biblionumber}:0;
245 $listBiblios .= $bibnum . ',';
246 $j++;
247 last if ($j == $results_per_page);
249 chop $listBiblios if ($listBiblios =~ /,$/);
250 return $listBiblios;
251 }#buildListBiblios
253 my $busc = $session->param("busc");
254 my @arrBusc = split(/\&(?:amp;)?/, $busc);
255 my ($key, $value);
256 my %arrParamsBusc = ();
257 for (@arrBusc) {
258 ($key, $value) = split(/=/, $_, 2);
259 if ($key =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/) {
260 $arrParamsBusc{$key} = uri_unescape($value);
261 } else {
262 unless (exists($arrParamsBusc{$key})) {
263 $arrParamsBusc{$key} = [];
265 push @{$arrParamsBusc{$key}}, uri_unescape($value);
268 my $searchAgain = 0;
269 my $count = C4::Context->preference('OPACnumSearchResults') || 20;
270 my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
271 $arrParamsBusc{'count'} = $results_per_page;
272 my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
273 # The value OPACnumSearchResults has changed and the search has to be rebuild
274 if ($count != $results_per_page) {
275 if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
276 my $indexBiblio = 0;
277 my @arrBibliosAux = split(',', $arrParamsBusc{'listBiblios'});
278 for (@arrBibliosAux) {
279 last if ($_ == $biblionumber);
280 $indexBiblio++;
282 $indexBiblio += $offset;
283 $offset = int($indexBiblio / $count) * $count;
284 $arrParamsBusc{'offset'} = $offset;
286 $arrParamsBusc{'count'} = $count;
287 $results_per_page = $count;
288 my $newresultsRef = searchAgain(\%arrParamsBusc, $offset, $results_per_page);
289 $arrParamsBusc{'listBiblios'} = buildListBiblios($newresultsRef, $results_per_page);
290 delete $arrParamsBusc{'previous'} if (exists($arrParamsBusc{'previous'}));
291 delete $arrParamsBusc{'next'} if (exists($arrParamsBusc{'next'}));
292 delete $arrParamsBusc{'offsetSearch'} if (exists($arrParamsBusc{'offsetSearch'}));
293 delete $arrParamsBusc{'newlistBiblios'} if (exists($arrParamsBusc{'newlistBiblios'}));
294 my $newbusc = rebuildBuscParam(\%arrParamsBusc);
295 $session->param("busc" => $newbusc);
296 @arrBusc = split(/\&(?:amp;)?/, $newbusc);
297 } else {
298 my $modifyListBiblios = 0;
299 # We come from a previous click
300 if (exists($arrParamsBusc{'previous'})) {
301 $modifyListBiblios = 1 if ($biblionumber == $arrParamsBusc{'previous'});
302 delete $arrParamsBusc{'previous'};
303 } elsif (exists($arrParamsBusc{'next'})) { # We come from a next click
304 $modifyListBiblios = 2 if ($biblionumber == $arrParamsBusc{'next'});
305 delete $arrParamsBusc{'next'};
307 if ($modifyListBiblios) {
308 if (exists($arrParamsBusc{'newlistBiblios'})) {
309 my $listBibliosAux = $arrParamsBusc{'listBiblios'};
310 $arrParamsBusc{'listBiblios'} = $arrParamsBusc{'newlistBiblios'};
311 my @arrAux = split(',', $listBibliosAux);
312 $arrParamsBusc{'newlistBiblios'} = $listBibliosAux;
313 if ($modifyListBiblios == 1) {
314 $arrParamsBusc{'next'} = $arrAux[0];
315 $paging{'next'}->{biblionumber} = $arrAux[0];
316 }else {
317 $arrParamsBusc{'previous'} = $arrAux[$#arrAux];
318 $paging{'previous'}->{biblionumber} = $arrAux[$#arrAux];
320 } else {
321 delete $arrParamsBusc{'listBiblios'};
323 my $offsetAux = $arrParamsBusc{'offset'};
324 $arrParamsBusc{'offset'} = $arrParamsBusc{'offsetSearch'};
325 $arrParamsBusc{'offsetSearch'} = $offsetAux;
326 $offset = $arrParamsBusc{'offset'};
327 my $newbusc = rebuildBuscParam(\%arrParamsBusc);
328 $session->param("busc" => $newbusc);
329 @arrBusc = split(/\&(?:amp;)?/, $newbusc);
332 my $buscParam = '';
333 my $j = 0;
334 # Rebuild the query for the button "back to results"
335 for (@arrBusc) {
336 unless ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|count|offsetSearch)/) {
337 $buscParam .= '&amp;' unless ($j == 0);
338 $buscParam .= $_; # string already URI encoded
339 $j++;
342 $template->param('busc' => $buscParam);
343 my $offsetSearch;
344 my @arrBiblios;
345 # We are inside the list of biblios and we don't have to search
346 if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
347 @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
348 if (@arrBiblios) {
349 # We are at the first item of the list
350 if ($arrBiblios[0] == $biblionumber) {
351 if (@arrBiblios > 1) {
352 for (my $j = 1; $j < @arrBiblios; $j++) {
353 next unless ($arrBiblios[$j]);
354 $paging{'next'}->{biblionumber} = $arrBiblios[$j];
355 last;
358 # search again if we are not at the first searching list
359 if ($offset && !$arrParamsBusc{'previous'}) {
360 $searchAgain = 1;
361 $offsetSearch = $offset - $results_per_page;
363 # we are at the last item of the list
364 } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
365 for (my $j = $#arrBiblios - 1; $j >= 0; $j--) {
366 next unless ($arrBiblios[$j]);
367 $paging{'previous'}->{biblionumber} = $arrBiblios[$j];
368 last;
370 if (!$offset) {
371 # search again if we are at the first list and there is more results
372 $searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} != @arrBiblios);
373 } else {
374 # search again if we aren't at the first list and there is more results
375 $searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} > ($offset + @arrBiblios));
377 $offsetSearch = $offset + $results_per_page if ($searchAgain);
378 } else {
379 for (my $j = 1; $j < $#arrBiblios; $j++) {
380 if ($arrBiblios[$j] == $biblionumber) {
381 for (my $z = $j - 1; $z >= 0; $z--) {
382 next unless ($arrBiblios[$z]);
383 $paging{'previous'}->{biblionumber} = $arrBiblios[$z];
384 last;
386 for (my $z = $j + 1; $z < @arrBiblios; $z++) {
387 next unless ($arrBiblios[$z]);
388 $paging{'next'}->{biblionumber} = $arrBiblios[$z];
389 last;
391 last;
396 $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
398 if ($searchAgain) {
399 my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
400 my @newresults = @$newresultsRef;
401 # build the new listBiblios
402 my $listBiblios = buildListBiblios(\@newresults, $results_per_page);
403 unless (exists($arrParamsBusc{'listBiblios'})) {
404 $arrParamsBusc{'listBiblios'} = $listBiblios;
405 @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
406 } else {
407 $arrParamsBusc{'newlistBiblios'} = $listBiblios;
409 # From the new list we build again the next and previous result
410 if (@arrBiblios) {
411 if ($arrBiblios[0] == $biblionumber) {
412 for (my $j = $#newresults; $j >= 0; $j--) {
413 next unless ($newresults[$j]);
414 $paging{'previous'}->{biblionumber} = $newresults[$j]->{biblionumber};
415 $arrParamsBusc{'previous'} = $paging{'previous'}->{biblionumber};
416 $arrParamsBusc{'offsetSearch'} = $offsetSearch;
417 last;
419 } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
420 for (my $j = 0; $j < @newresults; $j++) {
421 next unless ($newresults[$j]);
422 $paging{'next'}->{biblionumber} = $newresults[$j]->{biblionumber};
423 $arrParamsBusc{'next'} = $paging{'next'}->{biblionumber};
424 $arrParamsBusc{'offsetSearch'} = $offsetSearch;
425 last;
429 # build new busc param
430 my $newbusc = rebuildBuscParam(\%arrParamsBusc);
431 $session->param("busc" => $newbusc);
433 my ($numberBiblioPaging, $dataBiblioPaging);
434 # Previous biblio
435 $numberBiblioPaging = $paging{'previous'}->{biblionumber};
436 if ($numberBiblioPaging) {
437 $template->param( 'previousBiblionumber' => $numberBiblioPaging );
438 $dataBiblioPaging = GetBiblioData($numberBiblioPaging);
439 $template->param('previousTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging);
441 # Next biblio
442 $numberBiblioPaging = $paging{'next'}->{biblionumber};
443 if ($numberBiblioPaging) {
444 $template->param( 'nextBiblionumber' => $numberBiblioPaging );
445 $dataBiblioPaging = GetBiblioData($numberBiblioPaging);
446 $template->param('nextTitle' => $dataBiblioPaging->{'title'}) if ($dataBiblioPaging);
448 # Partial list of biblio results
449 my @listResults;
450 for (my $j = 0; $j < @arrBiblios; $j++) {
451 next unless ($arrBiblios[$j]);
452 $dataBiblioPaging = GetBiblioData($arrBiblios[$j]) if ($arrBiblios[$j] != $biblionumber);
453 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]};
455 $template->param('listResults' => \@listResults) if (@listResults);
456 $template->param('indexPag' => 1 + $offset, 'totalPag' => $arrParamsBusc{'total'}, 'indexPagEnd' => scalar(@arrBiblios) + $offset);
461 $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
462 $template->param('OPACShowCheckoutName' => C4::Context->preference("OPACShowCheckoutName") );
463 $template->param('OPACShowBarcode' => C4::Context->preference("OPACShowBarcode") );
465 # adding items linked via host biblios
467 my $analyticfield = '773';
468 if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){
469 $analyticfield = '773';
470 } elsif ($marcflavour eq 'UNIMARC') {
471 $analyticfield = '461';
473 foreach my $hostfield ( $record->field($analyticfield)) {
474 my $hostbiblionumber = $hostfield->subfield("0");
475 my $linkeditemnumber = $hostfield->subfield("9");
476 my @hostitemInfos = GetItemsInfo($hostbiblionumber);
477 foreach my $hostitemInfo (@hostitemInfos){
478 if ($hostitemInfo->{itemnumber} eq $linkeditemnumber){
479 push(@all_items, $hostitemInfo);
484 my @items;
486 # Are there items to hide?
487 my $hideitems;
488 $hideitems = 1 if C4::Context->preference('hidelostitems') or scalar(@hiddenitems) > 0;
490 # Hide items
491 if ($hideitems) {
492 for my $itm (@all_items) {
493 if ( C4::Context->preference('hidelostitems') ) {
494 push @items, $itm unless $itm->{itemlost} or any { $itm->{'itemnumber'} eq $_ } @hiddenitems;
495 } else {
496 push @items, $itm unless any { $itm->{'itemnumber'} eq $_ } @hiddenitems;
499 } else {
500 # Or not
501 @items = @all_items;
504 my $branch = '';
505 if (C4::Context->userenv){
506 $branch = C4::Context->userenv->{branch};
508 if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
509 if (
510 ( ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )
512 C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
514 my $branchcode;
515 if ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
516 $branchcode = $branch;
518 elsif ( C4::Context->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
519 $branchcode = $ENV{'BRANCHCODE'};
522 my @our_items;
523 my @other_items;
525 foreach my $item ( @items ) {
526 if ( $item->{branchcode} eq $branchcode ) {
527 $item->{'this_branch'} = 1;
528 push( @our_items, $item );
529 } else {
530 push( @other_items, $item );
534 @items = ( @our_items, @other_items );
538 my $dat = &GetBiblioData($biblionumber);
539 my $HideMARC = $record_processor->filters->[0]->should_hide_marc(
541 frameworkcode => $dat->{'frameworkcode'},
542 interface => 'opac',
543 } );
545 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
546 # imageurl:
547 my $itemtype = $dat->{'itemtype'};
548 if ( $itemtype ) {
549 $dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
550 $dat->{'description'} = $itemtypes->{$itemtype}->{translated_description};
553 my $shelflocations =
554 { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.location' } ) };
555 my $collections =
556 { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.ccode' } ) };
557 my $copynumbers =
558 { map { $_->{authorised_value} => $_->{opac_description} } Koha::AuthorisedValues->get_descriptions_by_koha_field( { frameworkcode => $dat->{frameworkcode}, kohafield => 'items.copynumber' } ) };
560 #coping with subscriptions
561 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
562 my @subscriptions = SearchSubscriptions({ biblionumber => $biblionumber, orderby => 'title' });
564 my @subs;
565 $dat->{'serial'}=1 if $subscriptionsnumber;
566 foreach my $subscription (@subscriptions) {
567 my $serials_to_display;
568 my %cell;
569 $cell{subscriptionid} = $subscription->{subscriptionid};
570 $cell{subscriptionnotes} = $subscription->{notes};
571 $cell{missinglist} = $subscription->{missinglist};
572 $cell{opacnote} = $subscription->{opacnote};
573 $cell{histstartdate} = $subscription->{histstartdate};
574 $cell{histenddate} = $subscription->{histenddate};
575 $cell{branchcode} = $subscription->{branchcode};
576 $cell{callnumber} = $subscription->{callnumber};
577 $cell{closed} = $subscription->{closed};
578 $cell{letter} = $subscription->{letter};
579 $cell{biblionumber} = $subscription->{biblionumber};
580 #get the three latest serials.
581 $serials_to_display = $subscription->{opacdisplaycount};
582 $serials_to_display = C4::Context->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
583 $cell{opacdisplaycount} = $serials_to_display;
584 $cell{latestserials} =
585 GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display );
586 if ( $borrowernumber ) {
587 my $sub = getalert($borrowernumber,'issue',$subscription->{subscriptionid});
588 if (@$sub[0]) {
589 $cell{hasalert} = 1;
592 push @subs, \%cell;
595 $dat->{'count'} = scalar(@items);
598 my (%item_reserves, %priority);
599 my ($show_holds_count, $show_priority);
600 for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
601 m/holds/o and $show_holds_count = 1;
602 m/priority/ and $show_priority = 1;
604 my $has_hold;
605 if ( $show_holds_count || $show_priority) {
606 my $holds = $biblio->holds;
607 $template->param( holds_count => $holds->count );
608 while ( my $hold = $holds->next ) {
609 $item_reserves{ $hold->itemnumber }++ if $hold->itemnumber;
610 if ($show_priority && $hold->borrowernumber == $borrowernumber) {
611 $has_hold = 1;
612 $hold->itemnumber
613 ? ($priority{ $hold->itemnumber } = $hold->priority)
614 : ($template->param( priority => $hold->priority ));
618 $template->param( show_priority => $has_hold ) ;
620 my $norequests = 1;
621 my %itemfields;
622 my (@itemloop, @otheritemloop);
623 my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef;
624 if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
625 $template->param(SeparateHoldings => 1);
627 my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch');
628 my $viewallitems = $query->param('viewallitems');
629 my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50;
631 # Get items on order
632 my ( @itemnumbers_on_order );
633 if ( C4::Context->preference('OPACAcquisitionDetails' ) ) {
634 my $orders = C4::Acquisition::SearchOrders({
635 biblionumber => $biblionumber,
636 ordered => 1,
638 my $total_quantity = 0;
639 for my $order ( @$orders ) {
640 if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) {
641 for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) {
642 push @itemnumbers_on_order, $itemnumber;
645 $total_quantity += $order->{quantity};
647 $template->{VARS}->{acquisition_details} = {
648 total_quantity => $total_quantity,
652 if ( not $viewallitems and @items > $max_items_to_display ) {
653 $template->param(
654 too_many_items => 1,
655 items_count => scalar( @items ),
657 } else {
658 my $allow_onshelf_holds;
659 my $borrower = GetMember( 'borrowernumber' => $borrowernumber );
660 for my $itm (@items) {
661 $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
662 $itm->{priority} = $priority{ $itm->{itemnumber} };
663 $norequests = 0
664 if $norequests
665 && !$itm->{'withdrawn'}
666 && !$itm->{'itemlost'}
667 && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'})
668 && !$itemtypes->{$itm->{'itype'}}->{notforloan}
669 && $itm->{'itemnumber'};
671 $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed( $itm, $borrower )
672 unless $allow_onshelf_holds;
674 # get collection code description, too
675 my $ccode = $itm->{'ccode'};
676 $itm->{'ccode'} = $collections->{$ccode} if defined($ccode) && $collections && exists( $collections->{$ccode} );
677 my $copynumber = $itm->{'copynumber'};
678 $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
679 if ( defined $itm->{'location'} ) {
680 $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
682 if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) {
683 $itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} );
684 $itm->{'description'} = $itemtypes->{ $itm->{itype} }->{translated_description};
686 foreach (qw(ccode enumchron copynumber itemnotes uri)) {
687 $itemfields{$_} = 1 if ($itm->{$_});
690 my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber});
691 if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
692 if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
694 my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber});
695 if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
696 $itm->{transfertwhen} = $transfertwhen;
697 $itm->{transfertfrom} = $transfertfrom;
698 $itm->{transfertto} = $transfertto;
701 if ( C4::Context->preference('OPACAcquisitionDetails')
702 and C4::Context->preference('AcqCreateItem') eq 'ordering' )
704 $itm->{on_order} = 1
705 if grep /^$itm->{itemnumber}$/, @itemnumbers_on_order;
708 my $itembranch = $itm->{$separatebranch};
709 if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
710 if ($itembranch and $itembranch eq $currentbranch) {
711 push @itemloop, $itm;
712 } else {
713 push @otheritemloop, $itm;
715 } else {
716 push @itemloop, $itm;
719 $template->param( 'AllowOnShelfHolds' => $allow_onshelf_holds );
722 # Display only one tab if one items list is empty
723 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) {
724 $template->param(SeparateHoldings => 0);
725 if (scalar(@itemloop) == 0) {
726 @itemloop = @otheritemloop;
730 ## get notes and subjects from MARC record
731 if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) {
732 my $marcisbnsarray = GetMarcISBN ($record,$marcflavour);
733 my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
734 my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
735 my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
736 my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
737 my $marchostsarray = GetMarcHosts($record,$marcflavour);
739 $template->param(
740 MARCSUBJCTS => $marcsubjctsarray,
741 MARCAUTHORS => $marcauthorsarray,
742 MARCSERIES => $marcseriesarray,
743 MARCURLS => $marcurlsarray,
744 MARCISBNS => $marcisbnsarray,
745 MARCHOSTS => $marchostsarray,
749 my $marcnotesarray = GetMarcNotes ($record,$marcflavour);
750 my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
752 $template->param(
753 MARCNOTES => $marcnotesarray,
754 norequests => $norequests,
755 RequestOnOpac => C4::Context->preference("RequestOnOpac"),
756 itemdata_ccode => $itemfields{ccode},
757 itemdata_enumchron => $itemfields{enumchron},
758 itemdata_uri => $itemfields{uri},
759 itemdata_copynumber => $itemfields{copynumber},
760 itemdata_itemnotes => $itemfields{itemnotes},
761 subtitle => $subtitle,
762 OpacStarRatings => C4::Context->preference("OpacStarRatings"),
765 if (C4::Context->preference("AlternateHoldingsField") && scalar @items == 0) {
766 my $fieldspec = C4::Context->preference("AlternateHoldingsField");
767 my $subfields = substr $fieldspec, 3;
768 my $holdingsep = C4::Context->preference("AlternateHoldingsSeparator") || ' ';
769 my @alternateholdingsinfo = ();
770 my @holdingsfields = $record->field(substr $fieldspec, 0, 3);
772 for my $field (@holdingsfields) {
773 my %holding = ( holding => '' );
774 my $havesubfield = 0;
775 for my $subfield ($field->subfields()) {
776 if ((index $subfields, $$subfield[0]) >= 0) {
777 $holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0);
778 $holding{'holding'} .= $$subfield[1];
779 $havesubfield++;
782 if ($havesubfield) {
783 push(@alternateholdingsinfo, \%holding);
787 $template->param(
788 ALTERNATEHOLDINGS => \@alternateholdingsinfo,
792 # FIXME: The template uses this hash directly. Need to filter.
793 foreach ( keys %{$dat} ) {
794 next if ( $HideMARC->{$_} );
795 $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
798 # some useful variables for enhanced content;
799 # in each case, we're grabbing the first value we find in
800 # the record and normalizing it
801 my $upc = GetNormalizedUPC($record,$marcflavour);
802 my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
803 my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
804 my $content_identifier_exists;
805 if ( $isbn or $ean or $oclc or $upc ) {
806 $content_identifier_exists = 1;
808 $template->param(
809 normalized_upc => $upc,
810 normalized_ean => $ean,
811 normalized_oclc => $oclc,
812 normalized_isbn => $isbn,
813 content_identifier_exists => $content_identifier_exists,
816 # COinS format FIXME: for books Only
817 $template->param(
818 ocoins => GetCOinSBiblio($record),
821 my ( $loggedincommenter, $reviews );
822 if ( C4::Context->preference('reviewson') ) {
823 $reviews = Koha::Reviews->search(
825 biblionumber => $biblionumber,
826 -or => { approved => 1, borrowernumber => $borrowernumber }
829 order_by => { -desc => 'datereviewed' }
831 )->unblessed;
832 my $libravatar_enabled = 0;
833 if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto') ) {
834 eval {
835 require Libravatar::URL;
836 Libravatar::URL->import();
838 if ( !$@ ) {
839 $libravatar_enabled = 1;
842 for my $review (@$reviews) {
843 my $borrowerData = GetMember( 'borrowernumber' => $review->{borrowernumber} );
845 # setting some borrower info into this hash
846 $review->{title} = $borrowerData->{'title'};
847 $review->{surname} = $borrowerData->{'surname'};
848 $review->{firstname} = $borrowerData->{'firstname'};
849 if ( $libravatar_enabled and $borrowerData->{'email'} ) {
850 $review->{avatarurl} = libravatar_url( email => $borrowerData->{'email'}, https => $ENV{HTTPS} );
852 $review->{userid} = $borrowerData->{'userid'};
853 $review->{cardnumber} = $borrowerData->{'cardnumber'};
855 if ( $borrowerData->{'borrowernumber'} eq $borrowernumber ) {
856 $review->{your_comment} = 1;
857 $loggedincommenter = 1;
862 if ( C4::Context->preference("OPACISBD") ) {
863 $template->param( ISBD => 1 );
866 $template->param(
867 itemloop => \@itemloop,
868 otheritemloop => \@otheritemloop,
869 biblionumber => $biblionumber,
870 subscriptions => \@subs,
871 subscriptionsnumber => $subscriptionsnumber,
872 reviews => $reviews,
873 loggedincommenter => $loggedincommenter
876 # Lists
877 if (C4::Context->preference("virtualshelves") ) {
878 my $shelves = Koha::Virtualshelves->search(
880 biblionumber => $biblionumber,
881 category => 2,
884 join => 'virtualshelfcontents',
887 $template->param( shelves => $shelves );
890 # XISBN Stuff
891 if (C4::Context->preference("OPACFRBRizeEditions")==1) {
892 eval {
893 $template->param(
894 XISBNS => scalar get_xisbns($isbn)
897 if ($@) { warn "XISBN Failed $@"; }
900 # Serial Collection
901 my @sc_fields = $record->field(955);
902 my @lc_fields = $marcflavour eq 'UNIMARC'
903 ? $record->field(930)
904 : $record->field(852);
905 my @serialcollections = ();
907 foreach my $sc_field (@sc_fields) {
908 my %row_data;
910 $row_data{text} = $sc_field->subfield('r');
911 $row_data{branch} = $sc_field->subfield('9');
912 foreach my $lc_field (@lc_fields) {
913 $row_data{itemcallnumber} = $marcflavour eq 'UNIMARC'
914 ? $lc_field->subfield('a') # 930$a
915 : $lc_field->subfield('h') # 852$h
916 if ($sc_field->subfield('5') eq $lc_field->subfield('5'));
919 if ($row_data{text} && $row_data{branch}) {
920 push (@serialcollections, \%row_data);
924 if (scalar(@serialcollections) > 0) {
925 $template->param(
926 serialcollection => 1,
927 serialcollections => \@serialcollections);
930 # Local cover Images stuff
931 if (C4::Context->preference("OPACLocalCoverImages")){
932 $template->param(OPACLocalCoverImages => 1);
935 # HTML5 Media
936 if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->preference("HTML5MediaEnabled") eq 'opac') ) {
937 $template->param( C4::HTML5Media->gethtml5media($record));
940 my $syndetics_elements;
942 if ( C4::Context->preference("SyndeticsEnabled") ) {
943 $template->param("SyndeticsEnabled" => 1);
944 $template->param("SyndeticsClientCode" => C4::Context->preference("SyndeticsClientCode"));
945 eval {
946 $syndetics_elements = &get_syndetics_index($isbn,$upc,$oclc);
947 for my $element (values %$syndetics_elements) {
948 $template->param("Syndetics$element"."Exists" => 1 );
949 #warn "Exists: "."Syndetics$element"."Exists";
952 warn $@ if $@;
955 if ( C4::Context->preference("SyndeticsEnabled")
956 && C4::Context->preference("SyndeticsSummary")
957 && ( exists($syndetics_elements->{'SUMMARY'}) || exists($syndetics_elements->{'AVSUMMARY'}) ) ) {
958 eval {
959 my $syndetics_summary = &get_syndetics_summary($isbn,$upc,$oclc, $syndetics_elements);
960 $template->param( SYNDETICS_SUMMARY => $syndetics_summary );
962 warn $@ if $@;
966 if ( C4::Context->preference("SyndeticsEnabled")
967 && C4::Context->preference("SyndeticsTOC")
968 && exists($syndetics_elements->{'TOC'}) ) {
969 eval {
970 my $syndetics_toc = &get_syndetics_toc($isbn,$upc,$oclc);
971 $template->param( SYNDETICS_TOC => $syndetics_toc );
973 warn $@ if $@;
976 if ( C4::Context->preference("SyndeticsEnabled")
977 && C4::Context->preference("SyndeticsExcerpt")
978 && exists($syndetics_elements->{'DBCHAPTER'}) ) {
979 eval {
980 my $syndetics_excerpt = &get_syndetics_excerpt($isbn,$upc,$oclc);
981 $template->param( SYNDETICS_EXCERPT => $syndetics_excerpt );
983 warn $@ if $@;
986 if ( C4::Context->preference("SyndeticsEnabled")
987 && C4::Context->preference("SyndeticsReviews")) {
988 eval {
989 my $syndetics_reviews = &get_syndetics_reviews($isbn,$upc,$oclc,$syndetics_elements);
990 $template->param( SYNDETICS_REVIEWS => $syndetics_reviews );
992 warn $@ if $@;
995 if ( C4::Context->preference("SyndeticsEnabled")
996 && C4::Context->preference("SyndeticsAuthorNotes")
997 && exists($syndetics_elements->{'ANOTES'}) ) {
998 eval {
999 my $syndetics_anotes = &get_syndetics_anotes($isbn,$upc,$oclc);
1000 $template->param( SYNDETICS_ANOTES => $syndetics_anotes );
1002 warn $@ if $@;
1005 # LibraryThingForLibraries ID Code and Tabbed View Option
1006 if( C4::Context->preference('LibraryThingForLibrariesEnabled') )
1008 $template->param(LibraryThingForLibrariesID =>
1009 C4::Context->preference('LibraryThingForLibrariesID') );
1010 $template->param(LibraryThingForLibrariesTabbedView =>
1011 C4::Context->preference('LibraryThingForLibrariesTabbedView') );
1014 # Novelist Select
1015 if( C4::Context->preference('NovelistSelectEnabled') )
1017 $template->param(NovelistSelectProfile => C4::Context->preference('NovelistSelectProfile') );
1018 $template->param(NovelistSelectPassword => C4::Context->preference('NovelistSelectPassword') );
1019 $template->param(NovelistSelectView => C4::Context->preference('NovelistSelectView') );
1023 # Babelthèque
1024 if ( C4::Context->preference("Babeltheque") ) {
1025 $template->param(
1026 Babeltheque => 1,
1027 Babeltheque_url_js => C4::Context->preference("Babeltheque_url_js"),
1031 # Social Networks
1032 if ( C4::Context->preference( "SocialNetworks" ) ) {
1033 $template->param( current_url => C4::Context->preference('OPACBaseURL') . "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber" );
1034 $template->param( SocialNetworks => 1 );
1037 # Shelf Browser Stuff
1038 if (C4::Context->preference("OPACShelfBrowser")) {
1039 my $starting_itemnumber = $query->param('shelfbrowse_itemnumber');
1040 if (defined($starting_itemnumber)) {
1041 $template->param( OpenOPACShelfBrowser => 1) if $starting_itemnumber;
1042 my $nearby = GetNearbyItems($starting_itemnumber);
1044 $template->param(
1045 starting_itemnumber => $starting_itemnumber,
1046 starting_homebranch => $nearby->{starting_homebranch}->{description},
1047 starting_location => $nearby->{starting_location}->{description},
1048 starting_ccode => $nearby->{starting_ccode}->{description},
1049 shelfbrowser_prev_item => $nearby->{prev_item},
1050 shelfbrowser_next_item => $nearby->{next_item},
1051 shelfbrowser_items => $nearby->{items},
1054 # in which tab shelf browser should open ?
1055 if (grep { $starting_itemnumber == $_->{itemnumber} } @itemloop) {
1056 $template->param(shelfbrowser_tab => 'holdings');
1057 } else {
1058 $template->param(shelfbrowser_tab => 'otherholdings');
1063 $template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("OPACAmazonCoverImages"));
1065 if (C4::Context->preference("BakerTaylorEnabled")) {
1066 $template->param(
1067 BakerTaylorEnabled => 1,
1068 BakerTaylorImageURL => &image_url(),
1069 BakerTaylorLinkURL => &link_url(),
1070 BakerTaylorBookstoreURL => C4::Context->preference('BakerTaylorBookstoreURL'),
1072 my ($bt_user, $bt_pass);
1073 if ($isbn and
1074 $bt_user = C4::Context->preference('BakerTaylorUsername') and
1075 $bt_pass = C4::Context->preference('BakerTaylorPassword') )
1077 $template->param(
1078 BakerTaylorContentURL =>
1079 sprintf("http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y",
1080 $bt_user,$bt_pass,$isbn)
1085 my $tag_quantity;
1086 if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) {
1087 $template->param(
1088 TagsEnabled => 1,
1089 TagsShowOnDetail => $tag_quantity,
1090 TagsInputOnDetail => C4::Context->preference('TagsInputOnDetail')
1092 $template->param(TagLoop => get_tags({biblionumber=>$biblionumber, approved=>1,
1093 'sort'=>'-weight', limit=>$tag_quantity}));
1096 if (C4::Context->preference("OPACURLOpenInNewWindow")) {
1097 # These values are going to be read by Javascript, at least in the case
1098 # of the google covers
1099 $template->param(covernewwindow => 'true');
1100 } else {
1101 $template->param(covernewwindow => 'false');
1104 if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) {
1105 my $ratings = Koha::Ratings->search({ biblionumber => $biblionumber });
1106 my $my_rating = $borrowernumber ? $ratings->search({ borrowernumber => $borrowernumber })->next : undef;
1107 $template->param(
1108 ratings => $ratings,
1109 my_rating => $my_rating,
1110 borrowernumber => $borrowernumber
1114 #Search for title in links
1115 my $marccontrolnumber = GetMarcControlnumber ($record, $marcflavour);
1116 my $marcissns = GetMarcISSN ( $record, $marcflavour );
1117 my $issn = $marcissns->[0] || '';
1119 if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
1120 $dat->{title} =~ s/\/+$//; # remove trailing slash
1121 $dat->{title} =~ s/\s+$//; # remove trailing space
1122 $search_for_title = parametrized_url(
1123 $search_for_title,
1125 TITLE => $dat->{title},
1126 AUTHOR => $dat->{author},
1127 ISBN => $isbn,
1128 ISSN => $issn,
1129 CONTROLNUMBER => $marccontrolnumber,
1130 BIBLIONUMBER => $biblionumber,
1133 $template->param('OPACSearchForTitleIn' => $search_for_title);
1136 #IDREF
1137 if ( C4::Context->preference("IDREF") ) {
1138 # If the record comes from the SUDOC
1139 if ( $record->field('009') ) {
1140 my $unimarc3 = $record->field("009")->data;
1141 if ( $unimarc3 =~ /^\d+$/ ) {
1142 $template->param(
1143 IDREF => 1,
1149 # We try to select the best default tab to show, according to what
1150 # the user wants, and what's available for display
1151 my $opac_serial_default = C4::Context->preference('opacSerialDefaultTab');
1152 my $defaulttab =
1153 $viewallitems
1154 ? 'holdings' :
1155 $opac_serial_default eq 'subscriptions' && $subscriptionsnumber
1156 ? 'subscriptions' :
1157 $opac_serial_default eq 'serialcollection' && @serialcollections > 0
1158 ? 'serialcollection' :
1159 $opac_serial_default eq 'holdings' && scalar (@itemloop) > 0
1160 ? 'holdings' :
1161 scalar (@itemloop) == 0
1162 ? 'media' :
1163 $subscriptionsnumber
1164 ? 'subscriptions' :
1165 @serialcollections > 0
1166 ? 'serialcollection' : 'subscriptions';
1167 $template->param('defaulttab' => $defaulttab);
1169 if (C4::Context->preference('OPACLocalCoverImages') == 1) {
1170 my @images = ListImagesForBiblio($biblionumber);
1171 $template->{VARS}->{localimages} = \@images;
1174 $template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews');
1175 $template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer');
1176 $template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults');
1177 $template->{VARS}->{OPACPopupAuthorsSearch} = C4::Context->preference('OPACPopupAuthorsSearch');
1179 if (C4::Context->preference('OpacHighlightedWords')) {
1180 $template->{VARS}->{query_desc} = $query->param('query_desc');
1182 $template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks');
1184 if ( C4::Context->preference('UseCourseReserves') ) {
1185 foreach my $i ( @items ) {
1186 $i->{'course_reserves'} = GetItemCourseReservesInfo( itemnumber => $i->{'itemnumber'} );
1190 $template->param(
1191 'OpacLocationBranchToDisplay' => C4::Context->preference('OpacLocationBranchToDisplay') ,
1192 'OpacLocationBranchToDisplayShelving' => C4::Context->preference('OpacLocationBranchToDisplayShelving'),
1195 output_html_with_http_headers $query, $cookie, $template->output;