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>.
26 use C4
::Acquisition
qw( SearchOrders );
27 use C4
::Auth
qw(:DEFAULT get_session);
29 use C4
::Serials
; #uses getsubscriptionfrom biblionumber
34 use C4
::Tags
qw(get_tags);
35 use C4
::XISBN
qw(get_xisbns);
36 use C4
::External
::Amazon
;
37 use C4
::External
::BakerTaylor
qw( image_url link_url );
38 use C4
::External
::Syndetics
qw(get_syndetics_index get_syndetics_summary get_syndetics_toc get_syndetics_excerpt get_syndetics_reviews get_syndetics_anotes );
47 use List
::MoreUtils qw
/any none/;
51 use C4
::CourseReserves
qw(GetItemCourseReservesInfo);
54 use Koha
::RecordProcessor
;
55 use Koha
::AuthorisedValues
;
56 use Koha
::CirculationRules
;
59 use Koha
::Acquisition
::Orders
;
60 use Koha
::Virtualshelves
;
65 use Koha
::SearchEngine
::Search
;
69 my $query = CGI
->new();
71 my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
72 $biblionumber = int($biblionumber);
74 my $specific_item = $query->param('itemnumber') ? Koha
::Items
->find( scalar $query->param('itemnumber') ) : undef;
75 $biblionumber = $specific_item->biblionumber if $specific_item;
77 my ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
79 template_name
=> "opac-detail.tt",
82 authnotrequired
=> ( C4
::Context
->preference("OpacPublic") ?
1 : 0 ),
86 my @all_items = GetItemsInfo
($biblionumber);
87 if( $specific_item ) {
88 @all_items = grep { $_->{itemnumber
} == $query->param('itemnumber') } @all_items;
89 $template->param( specific_item
=> 1 );
92 my $patron = Koha
::Patrons
->find( $borrowernumber );
94 if ( C4
::Context
->preference('OpacHiddenItemsExceptions') ) {
95 $borcat = $patron ?
$patron->categorycode : q{};
98 my $record = GetMarcBiblio
({
99 biblionumber
=> $biblionumber,
102 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
106 if ( scalar @all_items >= 1 ) {
108 GetHiddenItemnumbers
( { items
=> \
@all_items, borcat
=> $borcat } );
110 if (scalar @hiddenitems == scalar @all_items ) {
111 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
116 my $biblio = Koha
::Biblios
->find( $biblionumber );
117 my $framework = $biblio ?
$biblio->frameworkcode : q{};
118 my $record_processor = Koha
::RecordProcessor
->new({
119 filters
=> 'ViewPolicy',
122 frameworkcode
=> $framework
125 $record_processor->process($record);
127 # redirect if opacsuppression is enabled and biblio is suppressed
128 if (C4
::Context
->preference('OpacSuppression')) {
129 # FIXME hardcoded; the suppression flag ought to be materialized
130 # as a column on biblio or the like
131 my $opacsuppressionfield = '942';
132 my $opacsuppressionfieldvalue = $record->field($opacsuppressionfield);
133 # redirect to opac-blocked info page or 404?
134 my $opacsuppressionredirect;
135 if ( C4
::Context
->preference("OpacSuppressionRedirect") ) {
136 $opacsuppressionredirect = "/cgi-bin/koha/opac-blocked.pl";
138 $opacsuppressionredirect = "/cgi-bin/koha/errors/404.pl";
140 if ( $opacsuppressionfieldvalue &&
141 $opacsuppressionfieldvalue->subfield("n") &&
142 $opacsuppressionfieldvalue->subfield("n") == 1) {
143 # if OPAC suppression by IP address
144 if (C4
::Context
->preference('OpacSuppressionByIPRange')) {
145 my $IPAddress = $ENV{'REMOTE_ADDR'};
146 my $IPRange = C4
::Context
->preference('OpacSuppressionByIPRange');
147 if ($IPAddress !~ /^$IPRange/) {
148 print $query->redirect($opacsuppressionredirect);
152 print $query->redirect($opacsuppressionredirect);
162 # get biblionumbers stored in the cart
165 if($query->cookie("bib_list")){
166 my $cart_list = $query->cookie("bib_list");
167 @cart_list = split(/\//, $cart_list);
168 if ( grep {$_ eq $biblionumber} @cart_list) {
169 $template->param( incart
=> 1 );
174 SetUTF8Flag
($record);
175 my $marcflavour = C4
::Context
->preference("marcflavour");
176 my $ean = GetNormalizedEAN
( $record, $marcflavour );
178 # XSLT processing of some stuff
179 my $xslfile = C4
::Context
->preference('OPACXSLTDetailsDisplay');
180 my $lang = $xslfile ? C4
::Languages
::getlanguage
() : undef;
181 my $sysxml = $xslfile ? C4
::XSLT
::get_xslt_sysprefs
() : undef;
185 my $searcher = Koha
::SearchEngine
::Search
->new(
186 { index => $Koha::SearchEngine
::BIBLIOS_INDEX
}
188 my $cleaned_title = $biblio->title;
189 $cleaned_title =~ tr
|/||;
191 ( C4
::Context
->preference('UseControlNumber') and $record->field('001') )
192 ?
'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
193 : "Host-item:$cleaned_title";
194 my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 );
196 warn "Warning from simple_search_compat: $err"
200 anonymous_session
=> ($borrowernumber) ?
0 : 1,
201 show_analytics_link
=> $count > 0 ?
1 : 0
204 my @plugin_responses = Koha
::Plugins
->call(
205 'opac_detail_xslt_variables',
207 biblio_id
=> $biblionumber,
209 patron_id
=> $borrowernumber
213 for my $plugin_variables ( @plugin_responses ) {
214 $variables = { %$variables, %$plugin_variables };
218 XSLTBloc
=> XSLTParse4Display
(
219 $biblionumber, $record, "OPACXSLTDetailsDisplay", 1, undef,
220 $sysxml, $xslfile, $lang, $variables
225 my $OpacBrowseResults = C4
::Context
->preference("OpacBrowseResults");
227 # We look for the busc param to build the simple paging from the search
228 if ($OpacBrowseResults) {
229 my $session = get_session
($query->cookie("CGISESSID"));
230 my %paging = (previous
=> {}, next => {});
231 if ($session->param('busc')) {
235 # Rebuild the string to store on session
236 # param value is URI encoded and params separator is HTML encode (&)
239 my $arrParamsBusc = shift;
241 my $pasarParams = '';
243 for (keys %$arrParamsBusc) {
244 if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) {
245 if (defined($arrParamsBusc->{$_})) {
246 $pasarParams .= '&' if ($j);
247 $pasarParams .= $_ . '=' . Encode
::decode
('UTF-8', uri_escape_utf8
( $arrParamsBusc->{$_} ));
251 for my $value (@
{$arrParamsBusc->{$_}}) {
252 next if !defined($value);
253 $pasarParams .= '&' if ($j);
254 $pasarParams .= $_ . '=' . Encode
::decode
('UTF-8', uri_escape_utf8
($value));
262 # Search given the current values from the busc param
265 my ($arrParamsBusc, $offset, $results_per_page) = @_;
267 my $itemtypes = { map { $_->{itemtype
} => $_ } @
{ Koha
::ItemTypes
->search_with_localization->unblessed } };
269 @servers = @
{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
270 @servers = ("biblioserver") unless (@servers);
272 my ($default_sort_by, @sort_by);
273 $default_sort_by = C4
::Context
->preference('OPACdefaultSortField')."_".C4
::Context
->preference('OPACdefaultSortOrder') if (C4
::Context
->preference('OPACdefaultSortField') && C4
::Context
->preference('OPACdefaultSortOrder'));
274 @sort_by = @
{$arrParamsBusc->{'sort_by'}} if $arrParamsBusc->{'sort_by'};
275 $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
276 my ($error, $results_hashref, $facets);
278 ($error, $results_hashref, $facets) = getRecords
($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\
@sort_by,\
@servers,$results_per_page,$offset,undef,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'});
282 my $search_context = {
283 'interface' => 'opac',
284 'category' => $borcat
286 for (my $i=0;$i<@servers;$i++) {
287 my $server = $servers[$i];
288 $hits = $results_hashref->{$server}->{"hits"};
289 @newresults = searchResults
( $search_context, '', $hits, $results_per_page, $offset, $arrParamsBusc->{'scan'}, $results_hashref->{$server}->{"RECORDS"});
294 # Build the current list of biblionumbers in this search
297 my ($newresultsRef, $results_per_page) = @_;
299 my $listBiblios = '';
301 foreach (@
$newresultsRef) {
302 my $bibnum = ($_->{biblionumber
})?
$_->{biblionumber
}:0;
303 $listBiblios .= $bibnum . ',';
305 last if ($j == $results_per_page);
307 chop $listBiblios if ($listBiblios =~ /,$/);
311 my $busc = $session->param("busc");
312 my @arrBusc = split(/\&(?:amp;)?/, $busc);
314 my %arrParamsBusc = ();
316 ($key, $value) = split(/=/, $_, 2);
317 if ($key =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/) {
318 $arrParamsBusc{$key} = uri_unescape
($value);
320 unless (exists($arrParamsBusc{$key})) {
321 $arrParamsBusc{$key} = [];
323 push @
{$arrParamsBusc{$key}}, uri_unescape
($value);
327 my $count = C4
::Context
->preference('OPACnumSearchResults') || 20;
328 my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?
$arrParamsBusc{'count'}:$count;
329 $arrParamsBusc{'count'} = $results_per_page;
330 my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?
$arrParamsBusc{'offset'}:0;
331 # The value OPACnumSearchResults has changed and the search has to be rebuild
332 if ($count != $results_per_page) {
333 if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
335 my @arrBibliosAux = split(',', $arrParamsBusc{'listBiblios'});
336 for (@arrBibliosAux) {
337 last if ($_ == $biblionumber);
340 $indexBiblio += $offset;
341 $offset = int($indexBiblio / $count) * $count;
342 $arrParamsBusc{'offset'} = $offset;
344 $arrParamsBusc{'count'} = $count;
345 $results_per_page = $count;
346 my $newresultsRef = searchAgain
(\
%arrParamsBusc, $offset, $results_per_page);
347 $arrParamsBusc{'listBiblios'} = buildListBiblios
($newresultsRef, $results_per_page);
348 delete $arrParamsBusc{'previous'} if (exists($arrParamsBusc{'previous'}));
349 delete $arrParamsBusc{'next'} if (exists($arrParamsBusc{'next'}));
350 delete $arrParamsBusc{'offsetSearch'} if (exists($arrParamsBusc{'offsetSearch'}));
351 delete $arrParamsBusc{'newlistBiblios'} if (exists($arrParamsBusc{'newlistBiblios'}));
352 my $newbusc = rebuildBuscParam
(\
%arrParamsBusc);
353 $session->param("busc" => $newbusc);
354 @arrBusc = split(/\&(?:amp;)?/, $newbusc);
356 my $modifyListBiblios = 0;
357 # We come from a previous click
358 if (exists($arrParamsBusc{'previous'})) {
359 $modifyListBiblios = 1 if ($biblionumber == $arrParamsBusc{'previous'});
360 delete $arrParamsBusc{'previous'};
361 } elsif (exists($arrParamsBusc{'next'})) { # We come from a next click
362 $modifyListBiblios = 2 if ($biblionumber == $arrParamsBusc{'next'});
363 delete $arrParamsBusc{'next'};
365 if ($modifyListBiblios) {
366 if (exists($arrParamsBusc{'newlistBiblios'})) {
367 my $listBibliosAux = $arrParamsBusc{'listBiblios'};
368 $arrParamsBusc{'listBiblios'} = $arrParamsBusc{'newlistBiblios'};
369 my @arrAux = split(',', $listBibliosAux);
370 $arrParamsBusc{'newlistBiblios'} = $listBibliosAux;
371 if ($modifyListBiblios == 1) {
372 $arrParamsBusc{'next'} = $arrAux[0];
373 $paging{'next'}->{biblionumber
} = $arrAux[0];
375 $arrParamsBusc{'previous'} = $arrAux[$#arrAux];
376 $paging{'previous'}->{biblionumber
} = $arrAux[$#arrAux];
379 delete $arrParamsBusc{'listBiblios'};
381 my $offsetAux = $arrParamsBusc{'offset'};
382 $arrParamsBusc{'offset'} = $arrParamsBusc{'offsetSearch'};
383 $arrParamsBusc{'offsetSearch'} = $offsetAux;
384 $offset = $arrParamsBusc{'offset'};
385 my $newbusc = rebuildBuscParam
(\
%arrParamsBusc);
386 $session->param("busc" => $newbusc);
387 @arrBusc = split(/\&(?:amp;)?/, $newbusc);
392 # Rebuild the query for the button "back to results"
394 unless ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|count|offsetSearch)/) {
395 $buscParam .= '&' unless ($j == 0);
396 $buscParam .= $_; # string already URI encoded
400 $template->param('busc' => $buscParam);
403 # We are inside the list of biblios and we don't have to search
404 if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
405 @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
407 # We are at the first item of the list
408 if ($arrBiblios[0] == $biblionumber) {
409 if (@arrBiblios > 1) {
410 for (my $j = 1; $j < @arrBiblios; $j++) {
411 next unless ($arrBiblios[$j]);
412 $paging{'next'}->{biblionumber
} = $arrBiblios[$j];
416 # search again if we are not at the first searching list
417 if ($offset && !$arrParamsBusc{'previous'}) {
419 $offsetSearch = $offset - $results_per_page;
421 # we are at the last item of the list
422 } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
423 for (my $j = $#arrBiblios - 1; $j >= 0; $j--) {
424 next unless ($arrBiblios[$j]);
425 $paging{'previous'}->{biblionumber
} = $arrBiblios[$j];
429 # search again if we are at the first list and there is more results
430 $searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} != @arrBiblios);
432 # search again if we aren't at the first list and there is more results
433 $searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} > ($offset + @arrBiblios));
435 $offsetSearch = $offset + $results_per_page if ($searchAgain);
437 for (my $j = 1; $j < $#arrBiblios; $j++) {
438 if ($arrBiblios[$j] == $biblionumber) {
439 for (my $z = $j - 1; $z >= 0; $z--) {
440 next unless ($arrBiblios[$z]);
441 $paging{'previous'}->{biblionumber
} = $arrBiblios[$z];
444 for (my $z = $j + 1; $z < @arrBiblios; $z++) {
445 next unless ($arrBiblios[$z]);
446 $paging{'next'}->{biblionumber
} = $arrBiblios[$z];
454 $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
457 my $newresultsRef = searchAgain
(\
%arrParamsBusc, $offsetSearch, $results_per_page);
458 my @newresults = @
$newresultsRef;
459 # build the new listBiblios
460 my $listBiblios = buildListBiblios
(\
@newresults, $results_per_page);
461 unless (exists($arrParamsBusc{'listBiblios'})) {
462 $arrParamsBusc{'listBiblios'} = $listBiblios;
463 @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
465 $arrParamsBusc{'newlistBiblios'} = $listBiblios;
467 # From the new list we build again the next and previous result
469 if ($arrBiblios[0] == $biblionumber) {
470 for (my $j = $#newresults; $j >= 0; $j--) {
471 next unless ($newresults[$j]);
472 $paging{'previous'}->{biblionumber
} = $newresults[$j]->{biblionumber
};
473 $arrParamsBusc{'previous'} = $paging{'previous'}->{biblionumber
};
474 $arrParamsBusc{'offsetSearch'} = $offsetSearch;
477 } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
478 for (my $j = 0; $j < @newresults; $j++) {
479 next unless ($newresults[$j]);
480 $paging{'next'}->{biblionumber
} = $newresults[$j]->{biblionumber
};
481 $arrParamsBusc{'next'} = $paging{'next'}->{biblionumber
};
482 $arrParamsBusc{'offsetSearch'} = $offsetSearch;
487 # build new busc param
488 my $newbusc = rebuildBuscParam
(\
%arrParamsBusc);
489 $session->param("busc" => $newbusc);
491 my ($numberBiblioPaging, $dataBiblioPaging);
493 $numberBiblioPaging = $paging{'previous'}->{biblionumber
};
494 if ($numberBiblioPaging) {
495 $template->param( 'previousBiblionumber' => $numberBiblioPaging );
496 $dataBiblioPaging = Koha
::Biblios
->find( $numberBiblioPaging );
497 $template->param('previousTitle' => $dataBiblioPaging->title) if $dataBiblioPaging;
500 $numberBiblioPaging = $paging{'next'}->{biblionumber
};
501 if ($numberBiblioPaging) {
502 $template->param( 'nextBiblionumber' => $numberBiblioPaging );
503 $dataBiblioPaging = Koha
::Biblios
->find( $numberBiblioPaging );
504 $template->param('nextTitle' => $dataBiblioPaging->title) if $dataBiblioPaging;
506 # Partial list of biblio results
508 for (my $j = 0; $j < @arrBiblios; $j++) {
509 next unless ($arrBiblios[$j]);
510 $dataBiblioPaging = Koha
::Biblios
->find( $arrBiblios[$j] ) if ($arrBiblios[$j] != $biblionumber);
511 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]};
513 $template->param('listResults' => \
@listResults) if (@listResults);
514 $template->param('indexPag' => 1 + $offset, 'totalPag' => $arrParamsBusc{'total'}, 'indexPagEnd' => scalar(@arrBiblios) + $offset);
515 $template->param( 'offset' => $offset );
520 OPACShowCheckoutName
=> C4
::Context
->preference("OPACShowCheckoutName"),
523 if ( C4
::Context
->preference('EasyAnalyticalRecords') ) {
524 # adding items linked via host biblios
525 my $analyticfield = '773';
526 if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){
527 $analyticfield = '773';
528 } elsif ($marcflavour eq 'UNIMARC') {
529 $analyticfield = '461';
531 foreach my $hostfield ( $record->field($analyticfield)) {
532 my $hostbiblionumber = $hostfield->subfield("0");
533 my $linkeditemnumber = $hostfield->subfield("9");
534 my @hostitemInfos = GetItemsInfo
($hostbiblionumber);
535 foreach my $hostitemInfo (@hostitemInfos){
536 if ($hostitemInfo->{itemnumber
} eq $linkeditemnumber){
537 push(@all_items, $hostitemInfo);
545 # Are there items to hide?
547 $hideitems = 1 if C4
::Context
->preference('hidelostitems') or scalar(@hiddenitems) > 0;
551 for my $itm (@all_items) {
552 if ( C4
::Context
->preference('hidelostitems') ) {
553 push @items, $itm unless $itm->{itemlost
} or any
{ $itm->{'itemnumber'} eq $_ } @hiddenitems;
555 push @items, $itm unless any
{ $itm->{'itemnumber'} eq $_ } @hiddenitems;
564 if (C4
::Context
->userenv){
565 $branch = C4
::Context
->userenv->{branch
};
567 if ( C4
::Context
->preference('HighlightOwnItemsOnOPAC') ) {
569 ( ( C4
::Context
->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )
571 C4
::Context
->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
574 if ( C4
::Context
->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
575 $branchcode = $branch;
577 elsif ( C4
::Context
->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
578 $branchcode = $ENV{'BRANCHCODE'};
584 foreach my $item ( @items ) {
585 if ( $item->{branchcode
} eq $branchcode ) {
586 $item->{'this_branch'} = 1;
587 push( @our_items, $item );
589 push( @other_items, $item );
593 @items = ( @our_items, @other_items );
597 my $dat = &GetBiblioData
($biblionumber);
598 my $HideMARC = $record_processor->filters->[0]->should_hide_marc(
600 frameworkcode
=> $dat->{'frameworkcode'},
604 my $itemtypes = { map { $_->{itemtype
} => $_ } @
{ Koha
::ItemTypes
->search_with_localization->unblessed } };
606 my $itemtype = $dat->{'itemtype'};
608 $dat->{'imageurl'} = getitemtypeimagelocation
( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
609 $dat->{'description'} = $itemtypes->{$itemtype}->{translated_description
};
613 { map { $_->{authorised_value
} => $_->{opac_description
} } Koha
::AuthorisedValues
->get_descriptions_by_koha_field( { frameworkcode
=> $dat->{frameworkcode
}, kohafield
=> 'items.location' } ) };
615 { map { $_->{authorised_value
} => $_->{opac_description
} } Koha
::AuthorisedValues
->get_descriptions_by_koha_field( { frameworkcode
=> $dat->{frameworkcode
}, kohafield
=> 'items.ccode' } ) };
617 { map { $_->{authorised_value
} => $_->{opac_description
} } Koha
::AuthorisedValues
->get_descriptions_by_koha_field( { frameworkcode
=> $dat->{frameworkcode
}, kohafield
=> 'items.copynumber' } ) };
619 #coping with subscriptions
620 my $subscriptionsnumber = CountSubscriptionFromBiblionumber
($biblionumber);
621 my @subscriptions = SearchSubscriptions
({ biblionumber
=> $biblionumber, orderby
=> 'title' });
624 $dat->{'serial'}=1 if $subscriptionsnumber;
625 foreach my $subscription (@subscriptions) {
626 my $serials_to_display;
628 $cell{subscriptionid
} = $subscription->{subscriptionid
};
629 $cell{subscriptionnotes
} = $subscription->{notes
};
630 $cell{missinglist
} = $subscription->{missinglist
};
631 $cell{opacnote
} = $subscription->{opacnote
};
632 $cell{histstartdate
} = $subscription->{histstartdate
};
633 $cell{histenddate
} = $subscription->{histenddate
};
634 $cell{branchcode
} = $subscription->{branchcode
};
635 $cell{callnumber
} = $subscription->{callnumber
};
636 $cell{location
} = $subscription->{location
};
637 $cell{closed
} = $subscription->{closed
};
638 $cell{letter
} = $subscription->{letter
};
639 $cell{biblionumber
} = $subscription->{biblionumber
};
640 #get the three latest serials.
641 $serials_to_display = $subscription->{opacdisplaycount
};
642 $serials_to_display = C4
::Context
->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
643 $cell{opacdisplaycount
} = $serials_to_display;
644 $cell{latestserials
} =
645 GetLatestSerials
( $subscription->{subscriptionid
}, $serials_to_display );
646 if ( $borrowernumber ) {
647 my $subscription_object = Koha
::Subscriptions
->find( $subscription->{subscriptionid
} );
648 my $subscriber = $subscription_object->subscribers->find( $borrowernumber );
649 $cell{hasalert
} = 1 if $subscriber;
654 $dat->{'count'} = scalar(@items);
657 my (%item_reserves, %priority);
658 my ($show_holds_count, $show_priority);
659 for ( C4
::Context
->preference("OPACShowHoldQueueDetails") ) {
660 m/holds/o and $show_holds_count = 1;
661 m/priority/ and $show_priority = 1;
664 if ( $show_holds_count || $show_priority) {
665 my $holds = $biblio->holds;
666 $template->param( holds_count
=> $holds->count );
667 while ( my $hold = $holds->next ) {
668 $item_reserves{ $hold->itemnumber }++ if $hold->itemnumber;
669 if ($show_priority && $hold->borrowernumber == $borrowernumber) {
672 ?
($priority{ $hold->itemnumber } = $hold->priority)
673 : ($template->param( priority
=> $hold->priority ));
677 $template->param( show_priority
=> $has_hold ) ;
681 my (@itemloop, @otheritemloop);
682 my $currentbranch = C4
::Context
->userenv ? C4
::Context
->userenv->{branch
} : undef;
683 if ($currentbranch and C4
::Context
->preference('OpacSeparateHoldings')) {
684 $template->param(SeparateHoldings
=> 1);
686 my $separatebranch = C4
::Context
->preference('OpacSeparateHoldingsBranch');
687 my $viewallitems = $query->param('viewallitems');
688 my $max_items_to_display = C4
::Context
->preference('OpacMaxItemsToDisplay') // 50;
691 my ( @itemnumbers_on_order );
692 if ( C4
::Context
->preference('OPACAcquisitionDetails' ) ) {
693 my $orders = C4
::Acquisition
::SearchOrders
({
694 biblionumber
=> $biblionumber,
697 my $total_quantity = 0;
698 for my $order ( @
$orders ) {
699 my $order = Koha
::Acquisition
::Orders
->find( $order->{ordernumber
} );
700 my $basket = $order->basket;
701 if ( $basket->effective_create_items eq 'ordering' ) {
702 @itemnumbers_on_order = $order->items->get_column('itemnumber');
704 $total_quantity += $order->quantity;
706 $template->{VARS
}->{acquisition_details
} = {
707 total_quantity
=> $total_quantity,
711 my $allow_onshelf_holds;
712 my ( $itemloop_has_images, $otheritemloop_has_images );
713 if ( not $viewallitems and @items > $max_items_to_display ) {
716 items_count
=> scalar( @items ),
719 for my $itm (@items) {
720 my $item = Koha
::Items
->find( $itm->{itemnumber
} );
721 $itm->{holds_count
} = $item_reserves{ $itm->{itemnumber
} };
722 $itm->{priority
} = $priority{ $itm->{itemnumber
} };
725 && !$itm->{'withdrawn'}
726 && !$itm->{'itemlost'}
727 && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'})
728 && !$itemtypes->{$itm->{'itype'}}->{notforloan
}
729 && $itm->{'itemnumber'};
731 $allow_onshelf_holds = Koha
::CirculationRules
->get_onshelfholds_policy( { item
=> $item, patron
=> $patron } )
732 unless $allow_onshelf_holds;
734 # get collection code description, too
735 my $ccode = $itm->{'ccode'};
736 $itm->{'ccode'} = $collections->{$ccode} if defined($ccode) && $collections && exists( $collections->{$ccode} );
737 my $copynumber = $itm->{'copynumber'};
738 $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
739 if ( defined $itm->{'location'} ) {
740 $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
742 if (exists $itm->{itype
} && defined($itm->{itype
}) && exists $itemtypes->{ $itm->{itype
} }) {
743 $itm->{'imageurl'} = getitemtypeimagelocation
( 'opac', $itemtypes->{ $itm->{itype
} }->{'imageurl'} );
744 $itm->{'description'} = $itemtypes->{ $itm->{itype
} }->{translated_description
};
746 foreach (qw(ccode materials enumchron copynumber itemnotes location_description uri)) {
747 $itemfields{$_} = 1 if ($itm->{$_});
750 my $reserve_status = C4
::Reserves
::GetReserveStatus
($itm->{itemnumber
});
751 if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
752 if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
754 my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers
($itm->{itemnumber
});
755 if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
756 $itm->{transfertwhen
} = $transfertwhen;
757 $itm->{transfertfrom
} = $transfertfrom;
758 $itm->{transfertto
} = $transfertto;
761 if ( C4
::Context
->preference('OPACAcquisitionDetails') ) {
763 if grep { $_ eq $itm->{itemnumber
} } @itemnumbers_on_order;
766 if ( C4
::Context
->preference("OPACLocalCoverImages") == 1 ) {
767 $itm->{imagenumber
} =
768 C4
::Images
::GetImageForItem
( $itm->{itemnumber
} );
771 my $itembranch = $itm->{$separatebranch};
772 if ($currentbranch and C4
::Context
->preference('OpacSeparateHoldings')) {
773 if ($itembranch and $itembranch eq $currentbranch) {
774 push @itemloop, $itm;
775 $itemloop_has_images++ if $itm->{imagenumber
};
777 push @otheritemloop, $itm;
778 $otheritemloop_has_images++ if $itm->{imagenumber
};
781 push @itemloop, $itm;
782 $itemloop_has_images++ if $itm->{imagenumber
};
787 if( $allow_onshelf_holds || CountItemsIssued
($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
788 $template->param( ReservableItems
=> 1 );
792 itemloop_has_images
=> $itemloop_has_images,
793 otheritemloop_has_images
=> $otheritemloop_has_images,
796 # Display only one tab if one items list is empty
797 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) {
798 $template->param(SeparateHoldings
=> 0);
799 if (scalar(@itemloop) == 0) {
800 @itemloop = @otheritemloop;
804 ## get notes and subjects from MARC record
805 if (!C4
::Context
->preference("OPACXSLTDetailsDisplay") ) {
806 my $marcisbnsarray = GetMarcISBN
($record,$marcflavour);
807 my $marcauthorsarray = GetMarcAuthors
($record,$marcflavour);
808 my $marcsubjctsarray = GetMarcSubjects
($record,$marcflavour);
809 my $marcseriesarray = GetMarcSeries
($record,$marcflavour);
810 my $marcurlsarray = GetMarcUrls
($record,$marcflavour);
813 MARCSUBJCTS
=> $marcsubjctsarray,
814 MARCAUTHORS
=> $marcauthorsarray,
815 MARCSERIES
=> $marcseriesarray,
816 MARCURLS
=> $marcurlsarray,
817 MARCISBNS
=> $marcisbnsarray,
821 my $marcnotesarray = GetMarcNotes
($record,$marcflavour,1);
823 if( C4
::Context
->preference('ArticleRequests') ) {
824 my $patron = $borrowernumber ? Koha
::Patrons
->find($borrowernumber) : undef;
825 my $itemtype = Koha
::ItemTypes
->find($biblio->itemtype);
826 my $artreqpossible = $patron
827 ?
$biblio->can_article_request( $patron )
829 ?
$itemtype->may_article_request
831 $template->param( artreqpossible
=> $artreqpossible );
835 MARCNOTES
=> $marcnotesarray,
836 norequests
=> $norequests,
837 RequestOnOpac
=> C4
::Context
->preference("RequestOnOpac"),
838 itemdata_ccode
=> $itemfields{ccode
},
839 itemdata_materials
=> $itemfields{materials
},
840 itemdata_enumchron
=> $itemfields{enumchron
},
841 itemdata_uri
=> $itemfields{uri
},
842 itemdata_copynumber
=> $itemfields{copynumber
},
843 itemdata_itemnotes
=> $itemfields{itemnotes
},
844 itemdata_location
=> $itemfields{location_description
},
845 OpacStarRatings
=> C4
::Context
->preference("OpacStarRatings"),
848 if (C4
::Context
->preference("AlternateHoldingsField") && scalar @items == 0) {
849 my $fieldspec = C4
::Context
->preference("AlternateHoldingsField");
850 my $subfields = substr $fieldspec, 3;
851 my $holdingsep = C4
::Context
->preference("AlternateHoldingsSeparator") || ' ';
852 my @alternateholdingsinfo = ();
853 my @holdingsfields = $record->field(substr $fieldspec, 0, 3);
855 for my $field (@holdingsfields) {
856 my %holding = ( holding
=> '' );
857 my $havesubfield = 0;
858 for my $subfield ($field->subfields()) {
859 if ((index $subfields, $$subfield[0]) >= 0) {
860 $holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0);
861 $holding{'holding'} .= $$subfield[1];
866 push(@alternateholdingsinfo, \
%holding);
871 ALTERNATEHOLDINGS
=> \
@alternateholdingsinfo,
875 # FIXME: The template uses this hash directly. Need to filter.
876 foreach ( keys %{$dat} ) {
877 next if ( $HideMARC->{$_} );
878 $template->param( "$_" => defined $dat->{$_} ?
$dat->{$_} : '' );
881 # some useful variables for enhanced content;
882 # in each case, we're grabbing the first value we find in
883 # the record and normalizing it
884 my $upc = GetNormalizedUPC
($record,$marcflavour);
885 my $oclc = GetNormalizedOCLCNumber
($record,$marcflavour);
886 my $isbn = GetNormalizedISBN
(undef,$record,$marcflavour);
887 my $content_identifier_exists;
888 if ( $isbn or $ean or $oclc or $upc ) {
889 $content_identifier_exists = 1;
892 normalized_upc
=> $upc,
893 normalized_ean
=> $ean,
894 normalized_oclc
=> $oclc,
895 normalized_isbn
=> $isbn,
896 content_identifier_exists
=> $content_identifier_exists,
899 # Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid
900 # COinS format FIXME: for books Only
901 my $coins = eval { $biblio->get_coins };
902 $template->param( ocoins
=> $coins );
904 my ( $loggedincommenter, $reviews );
905 if ( C4
::Context
->preference('reviewson') ) {
906 $reviews = Koha
::Reviews
->search(
908 biblionumber
=> $biblionumber,
909 -or => { approved
=> 1, borrowernumber
=> $borrowernumber }
912 order_by
=> { -desc
=> 'datereviewed' }
915 my $libravatar_enabled = 0;
916 if ( C4
::Context
->preference('ShowReviewer') and C4
::Context
->preference('ShowReviewerPhoto') ) {
918 require Libravatar
::URL
;
919 Libravatar
::URL
->import();
922 $libravatar_enabled = 1;
925 for my $review (@
$reviews) {
926 my $review_patron = Koha
::Patrons
->find( $review->{borrowernumber
} ); # FIXME Should be Koha::Review->reviewer or similar
928 # setting some borrower info into this hash
929 if ( $review_patron ) {
930 $review->{patron
} = $review_patron;
931 if ( $libravatar_enabled and $review_patron->email ) {
932 $review->{avatarurl
} = libravatar_url
( email
=> $review_patron->email, https
=> $ENV{HTTPS
} );
935 if ( $review_patron->borrowernumber eq $borrowernumber ) {
936 $loggedincommenter = 1;
942 if ( C4
::Context
->preference("OPACISBD") ) {
943 $template->param( ISBD
=> 1 );
947 itemloop
=> \
@itemloop,
948 otheritemloop
=> \
@otheritemloop,
949 biblionumber
=> $biblionumber,
950 subscriptions
=> \
@subs,
951 subscriptionsnumber
=> $subscriptionsnumber,
953 loggedincommenter
=> $loggedincommenter
957 if (C4
::Context
->preference("virtualshelves") ) {
958 my $shelves = Koha
::Virtualshelves
->search(
960 biblionumber
=> $biblionumber,
964 join => 'virtualshelfcontents',
967 $template->param( shelves
=> $shelves );
971 if (C4
::Context
->preference("OPACFRBRizeEditions")==1) {
974 XISBNS
=> scalar get_xisbns
($isbn, $biblionumber)
977 if ($@
) { warn "XISBN Failed $@"; }
981 my @sc_fields = $record->field(955);
982 my @lc_fields = $marcflavour eq 'UNIMARC'
983 ?
$record->field(930)
984 : $record->field(852);
985 my @serialcollections = ();
987 foreach my $sc_field (@sc_fields) {
990 $row_data{text
} = $sc_field->subfield('r');
991 $row_data{branch
} = $sc_field->subfield('9');
992 foreach my $lc_field (@lc_fields) {
993 $row_data{itemcallnumber
} = $marcflavour eq 'UNIMARC'
994 ?
$lc_field->subfield('a') # 930$a
995 : $lc_field->subfield('h') # 852$h
996 if ($sc_field->subfield('5') eq $lc_field->subfield('5'));
999 if ($row_data{text
} && $row_data{branch
}) {
1000 push (@serialcollections, \
%row_data);
1004 if (scalar(@serialcollections) > 0) {
1006 serialcollection
=> 1,
1007 serialcollections
=> \
@serialcollections);
1010 # Local cover Images stuff
1011 if (C4
::Context
->preference("OPACLocalCoverImages")){
1012 $template->param(OPACLocalCoverImages
=> 1);
1016 if ( (C4
::Context
->preference("HTML5MediaEnabled") eq 'both') or (C4
::Context
->preference("HTML5MediaEnabled") eq 'opac') ) {
1017 $template->param( C4
::HTML5Media
->gethtml5media($record));
1020 my $syndetics_elements;
1022 if ( C4
::Context
->preference("SyndeticsEnabled") ) {
1023 $template->param("SyndeticsEnabled" => 1);
1024 $template->param("SyndeticsClientCode" => C4
::Context
->preference("SyndeticsClientCode"));
1026 $syndetics_elements = &get_syndetics_index
($isbn,$upc,$oclc);
1027 for my $element (values %$syndetics_elements) {
1028 $template->param("Syndetics$element"."Exists" => 1 );
1029 #warn "Exists: "."Syndetics$element"."Exists";
1035 if ( C4
::Context
->preference("SyndeticsEnabled")
1036 && C4
::Context
->preference("SyndeticsSummary")
1037 && ( exists($syndetics_elements->{'SUMMARY'}) || exists($syndetics_elements->{'AVSUMMARY'}) ) ) {
1039 my $syndetics_summary = &get_syndetics_summary
($isbn,$upc,$oclc, $syndetics_elements);
1040 $template->param( SYNDETICS_SUMMARY
=> $syndetics_summary );
1046 if ( C4
::Context
->preference("SyndeticsEnabled")
1047 && C4
::Context
->preference("SyndeticsTOC")
1048 && exists($syndetics_elements->{'TOC'}) ) {
1050 my $syndetics_toc = &get_syndetics_toc
($isbn,$upc,$oclc);
1051 $template->param( SYNDETICS_TOC
=> $syndetics_toc );
1056 if ( C4
::Context
->preference("SyndeticsEnabled")
1057 && C4
::Context
->preference("SyndeticsExcerpt")
1058 && exists($syndetics_elements->{'DBCHAPTER'}) ) {
1060 my $syndetics_excerpt = &get_syndetics_excerpt
($isbn,$upc,$oclc);
1061 $template->param( SYNDETICS_EXCERPT
=> $syndetics_excerpt );
1066 if ( C4
::Context
->preference("SyndeticsEnabled")
1067 && C4
::Context
->preference("SyndeticsReviews")) {
1069 my $syndetics_reviews = &get_syndetics_reviews
($isbn,$upc,$oclc,$syndetics_elements);
1070 $template->param( SYNDETICS_REVIEWS
=> $syndetics_reviews );
1075 if ( C4
::Context
->preference("SyndeticsEnabled")
1076 && C4
::Context
->preference("SyndeticsAuthorNotes")
1077 && exists($syndetics_elements->{'ANOTES'}) ) {
1079 my $syndetics_anotes = &get_syndetics_anotes
($isbn,$upc,$oclc);
1080 $template->param( SYNDETICS_ANOTES
=> $syndetics_anotes );
1085 # LibraryThingForLibraries ID Code and Tabbed View Option
1086 if( C4
::Context
->preference('LibraryThingForLibrariesEnabled') )
1088 $template->param(LibraryThingForLibrariesID
=>
1089 C4
::Context
->preference('LibraryThingForLibrariesID') );
1090 $template->param(LibraryThingForLibrariesTabbedView
=>
1091 C4
::Context
->preference('LibraryThingForLibrariesTabbedView') );
1095 if( C4
::Context
->preference('NovelistSelectEnabled') )
1097 $template->param(NovelistSelectProfile
=> C4
::Context
->preference('NovelistSelectProfile') );
1098 $template->param(NovelistSelectPassword
=> C4
::Context
->preference('NovelistSelectPassword') );
1099 $template->param(NovelistSelectView
=> C4
::Context
->preference('NovelistSelectView') );
1104 if ( C4
::Context
->preference("Babeltheque") ) {
1107 Babeltheque_url_js
=> C4
::Context
->preference("Babeltheque_url_js"),
1112 if ( C4
::Context
->preference( "SocialNetworks" ) ) {
1113 $template->param( current_url
=> C4
::Context
->preference('OPACBaseURL') . "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber" );
1114 $template->param( SocialNetworks
=> 1 );
1117 # Shelf Browser Stuff
1118 if (C4
::Context
->preference("OPACShelfBrowser")) {
1119 my $starting_itemnumber = $query->param('shelfbrowse_itemnumber');
1120 if (defined($starting_itemnumber)) {
1121 $template->param( OpenOPACShelfBrowser
=> 1) if $starting_itemnumber;
1122 my $nearby = GetNearbyItems
($starting_itemnumber);
1125 starting_itemnumber
=> $starting_itemnumber,
1126 starting_homebranch
=> $nearby->{starting_homebranch
}->{description
},
1127 starting_location
=> $nearby->{starting_location
}->{description
},
1128 starting_ccode
=> $nearby->{starting_ccode
}->{description
},
1129 shelfbrowser_prev_item
=> $nearby->{prev_item
},
1130 shelfbrowser_next_item
=> $nearby->{next_item
},
1131 shelfbrowser_items
=> $nearby->{items
},
1134 # in which tab shelf browser should open ?
1135 if (grep { $starting_itemnumber == $_->{itemnumber
} } @itemloop) {
1136 $template->param(shelfbrowser_tab
=> 'holdings');
1138 $template->param(shelfbrowser_tab
=> 'otherholdings');
1143 $template->param( AmazonTld
=> get_amazon_tld
() ) if ( C4
::Context
->preference("OPACAmazonCoverImages"));
1145 if (C4
::Context
->preference("BakerTaylorEnabled")) {
1147 BakerTaylorEnabled
=> 1,
1148 BakerTaylorImageURL
=> &image_url
(),
1149 BakerTaylorLinkURL
=> &link_url
(),
1150 BakerTaylorBookstoreURL
=> C4
::Context
->preference('BakerTaylorBookstoreURL'),
1152 my ($bt_user, $bt_pass);
1154 $bt_user = C4
::Context
->preference('BakerTaylorUsername') and
1155 $bt_pass = C4
::Context
->preference('BakerTaylorPassword') )
1158 BakerTaylorContentURL
=>
1159 sprintf("https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y",
1160 $bt_user,$bt_pass,$isbn)
1166 if (C4
::Context
->preference('TagsEnabled') and $tag_quantity = C4
::Context
->preference('TagsShowOnDetail')) {
1169 TagsShowOnDetail
=> $tag_quantity,
1170 TagsInputOnDetail
=> C4
::Context
->preference('TagsInputOnDetail')
1172 $template->param(TagLoop
=> get_tags
({biblionumber
=>$biblionumber, approved
=>1,
1173 'sort'=>'-weight', limit
=>$tag_quantity}));
1176 if (C4
::Context
->preference("OPACURLOpenInNewWindow")) {
1177 # These values are going to be read by Javascript, at least in the case
1178 # of the google covers
1179 $template->param(covernewwindow
=> 'true');
1181 $template->param(covernewwindow
=> 'false');
1184 $template->param(borrowernumber
=> $borrowernumber);
1186 if ( C4
::Context
->preference('OpacStarRatings') !~ /disable/ ) {
1187 my $ratings = Koha
::Ratings
->search({ biblionumber
=> $biblionumber });
1188 my $my_rating = $borrowernumber ?
$ratings->search({ borrowernumber
=> $borrowernumber })->next : undef;
1190 ratings
=> $ratings,
1191 my_rating
=> $my_rating,
1195 #Search for title in links
1196 my $marccontrolnumber = GetMarcControlnumber
($record, $marcflavour);
1197 my $marcissns = GetMarcISSN
( $record, $marcflavour );
1198 my $issn = $marcissns->[0] || '';
1200 if (my $search_for_title = C4
::Context
->preference('OPACSearchForTitleIn')){
1201 $dat->{title
} =~ s/\/+$//; # remove trailing slash
1202 $dat->{title
} =~ s/\s+$//; # remove trailing space
1203 $search_for_title = parametrized_url
(
1206 TITLE
=> $dat->{title
},
1207 AUTHOR
=> $dat->{author
},
1210 CONTROLNUMBER
=> $marccontrolnumber,
1211 BIBLIONUMBER
=> $biblionumber,
1214 $template->param('OPACSearchForTitleIn' => $search_for_title);
1218 if ( C4
::Context
->preference("IDREF") ) {
1219 # If the record comes from the SUDOC
1220 if ( $record->field('009') ) {
1221 my $unimarc3 = $record->field("009")->data;
1222 if ( $unimarc3 =~ /^\d+$/ ) {
1230 # We try to select the best default tab to show, according to what
1231 # the user wants, and what's available for display
1232 my $opac_serial_default = C4
::Context
->preference('opacSerialDefaultTab');
1236 $opac_serial_default eq 'subscriptions' && $subscriptionsnumber
1238 $opac_serial_default eq 'serialcollection' && @serialcollections > 0
1239 ?
'serialcollection' :
1240 $opac_serial_default eq 'holdings' && scalar (@itemloop) > 0
1242 scalar (@itemloop) == 0
1244 $subscriptionsnumber
1246 @serialcollections > 0
1247 ?
'serialcollection' : 'subscriptions';
1248 $template->param('defaulttab' => $defaulttab);
1250 if (C4
::Context
->preference('OPACLocalCoverImages') == 1) {
1251 my @images = ListImagesForBiblio
($biblionumber);
1252 $template->{VARS
}->{localimages
} = \
@images;
1255 $template->{VARS
}->{OPACPopupAuthorsSearch
} = C4
::Context
->preference('OPACPopupAuthorsSearch');
1257 if (C4
::Context
->preference('OpacHighlightedWords')) {
1258 $template->{VARS
}->{query_desc
} = $query->param('query_desc');
1260 $template->{VARS
}->{'trackclicks'} = C4
::Context
->preference('TrackClicks');
1262 if ( C4
::Context
->preference('UseCourseReserves') ) {
1263 foreach my $i ( @items ) {
1264 $i->{'course_reserves'} = GetItemCourseReservesInfo
( itemnumber
=> $i->{'itemnumber'} );
1269 'OpacLocationBranchToDisplay' => C4
::Context
->preference('OpacLocationBranchToDisplay'),
1272 output_html_with_http_headers
$query, $cookie, $template->output;