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/;
50 use C4
::CourseReserves
qw(GetItemCourseReservesInfo);
53 use Koha
::RecordProcessor
;
54 use Koha
::AuthorisedValues
;
55 use Koha
::CirculationRules
;
58 use Koha
::Acquisition
::Orders
;
59 use Koha
::Virtualshelves
;
64 use Koha
::SearchEngine
::Search
;
68 my $query = CGI
->new();
70 my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
71 $biblionumber = int($biblionumber);
73 my $specific_item = $query->param('itemnumber') ? Koha
::Items
->find( scalar $query->param('itemnumber') ) : undef;
74 $biblionumber = $specific_item->biblionumber if $specific_item;
76 my ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
78 template_name
=> "opac-detail.tt",
81 authnotrequired
=> ( C4
::Context
->preference("OpacPublic") ?
1 : 0 ),
85 my @all_items = GetItemsInfo
($biblionumber);
86 if( $specific_item ) {
87 @all_items = grep { $_->{itemnumber
} == $query->param('itemnumber') } @all_items;
88 $template->param( specific_item
=> 1 );
91 my $patron = Koha
::Patrons
->find( $borrowernumber );
93 if ( C4
::Context
->preference('OpacHiddenItemsExceptions') ) {
94 $borcat = $patron ?
$patron->categorycode : q{};
97 my $record = GetMarcBiblio
({
98 biblionumber
=> $biblionumber,
101 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
105 if ( scalar @all_items >= 1 ) {
107 GetHiddenItemnumbers
( { items
=> \
@all_items, borcat
=> $borcat } );
109 if (scalar @hiddenitems == scalar @all_items ) {
110 print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
115 my $biblio = Koha
::Biblios
->find( $biblionumber );
116 my $framework = $biblio ?
$biblio->frameworkcode : q{};
117 my $record_processor = Koha
::RecordProcessor
->new({
118 filters
=> 'ViewPolicy',
121 frameworkcode
=> $framework
124 $record_processor->process($record);
126 # redirect if opacsuppression is enabled and biblio is suppressed
127 if (C4
::Context
->preference('OpacSuppression')) {
128 # FIXME hardcoded; the suppression flag ought to be materialized
129 # as a column on biblio or the like
130 my $opacsuppressionfield = '942';
131 my $opacsuppressionfieldvalue = $record->field($opacsuppressionfield);
132 # redirect to opac-blocked info page or 404?
133 my $opacsuppressionredirect;
134 if ( C4
::Context
->preference("OpacSuppressionRedirect") ) {
135 $opacsuppressionredirect = "/cgi-bin/koha/opac-blocked.pl";
137 $opacsuppressionredirect = "/cgi-bin/koha/errors/404.pl";
139 if ( $opacsuppressionfieldvalue &&
140 $opacsuppressionfieldvalue->subfield("n") &&
141 $opacsuppressionfieldvalue->subfield("n") == 1) {
142 # if OPAC suppression by IP address
143 if (C4
::Context
->preference('OpacSuppressionByIPRange')) {
144 my $IPAddress = $ENV{'REMOTE_ADDR'};
145 my $IPRange = C4
::Context
->preference('OpacSuppressionByIPRange');
146 if ($IPAddress !~ /^$IPRange/) {
147 print $query->redirect($opacsuppressionredirect);
151 print $query->redirect($opacsuppressionredirect);
161 # get biblionumbers stored in the cart
164 if($query->cookie("bib_list")){
165 my $cart_list = $query->cookie("bib_list");
166 @cart_list = split(/\//, $cart_list);
167 if ( grep {$_ eq $biblionumber} @cart_list) {
168 $template->param( incart
=> 1 );
173 SetUTF8Flag
($record);
174 my $marcflavour = C4
::Context
->preference("marcflavour");
175 my $ean = GetNormalizedEAN
( $record, $marcflavour );
177 # XSLT processing of some stuff
178 my $xslfile = C4
::Context
->preference('OPACXSLTDetailsDisplay');
179 my $lang = $xslfile ? C4
::Languages
::getlanguage
() : undef;
180 my $sysxml = $xslfile ? C4
::XSLT
::get_xslt_sysprefs
() : undef;
184 my $searcher = Koha
::SearchEngine
::Search
->new(
185 { index => $Koha::SearchEngine
::BIBLIOS_INDEX
}
187 my $cleaned_title = $biblio->title;
188 $cleaned_title =~ tr
|/||;
190 ( C4
::Context
->preference('UseControlNumber') and $record->field('001') )
191 ?
'rcn:'. $record->field('001')->data . ' AND (bib-level:a OR bib-level:b)'
192 : "Host-item:$cleaned_title";
193 my ( $err, $result, $count ) = $searcher->simple_search_compat( $query, 0, 0 );
195 warn "Warning from simple_search_compat: $err"
199 anonymous_session
=> ($borrowernumber) ?
0 : 1,
200 show_analytics_link
=> $count > 0 ?
1 : 0
203 my @plugin_responses = Koha
::Plugins
->call(
204 'opac_detail_xslt_variables',
206 biblio_id
=> $biblionumber,
208 patron_id
=> $borrowernumber
212 for my $plugin_variables ( @plugin_responses ) {
213 $variables = { %$variables, %$plugin_variables };
217 XSLTBloc
=> XSLTParse4Display
(
218 $biblionumber, $record, "OPACXSLTDetailsDisplay", 1, undef,
219 $sysxml, $xslfile, $lang, $variables
224 my $OpacBrowseResults = C4
::Context
->preference("OpacBrowseResults");
226 # We look for the busc param to build the simple paging from the search
227 if ($OpacBrowseResults) {
228 my $session = get_session
($query->cookie("CGISESSID"));
229 my %paging = (previous
=> {}, next => {});
230 if ($session->param('busc')) {
234 # Rebuild the string to store on session
235 # param value is URI encoded and params separator is HTML encode (&)
238 my $arrParamsBusc = shift;
240 my $pasarParams = '';
242 for (keys %$arrParamsBusc) {
243 if ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|total|offset|offsetSearch|next|previous|count|expand|scan)/) {
244 if (defined($arrParamsBusc->{$_})) {
245 $pasarParams .= '&' if ($j);
246 $pasarParams .= $_ . '=' . Encode
::decode
('UTF-8', uri_escape_utf8
( $arrParamsBusc->{$_} ));
250 for my $value (@
{$arrParamsBusc->{$_}}) {
251 next if !defined($value);
252 $pasarParams .= '&' if ($j);
253 $pasarParams .= $_ . '=' . Encode
::decode
('UTF-8', uri_escape_utf8
($value));
261 # Search given the current values from the busc param
264 my ($arrParamsBusc, $offset, $results_per_page) = @_;
266 my $itemtypes = { map { $_->{itemtype
} => $_ } @
{ Koha
::ItemTypes
->search_with_localization->unblessed } };
268 @servers = @
{$arrParamsBusc->{'server'}} if $arrParamsBusc->{'server'};
269 @servers = ("biblioserver") unless (@servers);
271 my ($default_sort_by, @sort_by);
272 $default_sort_by = C4
::Context
->preference('OPACdefaultSortField')."_".C4
::Context
->preference('OPACdefaultSortOrder') if (C4
::Context
->preference('OPACdefaultSortField') && C4
::Context
->preference('OPACdefaultSortOrder'));
273 @sort_by = @
{$arrParamsBusc->{'sort_by'}} if $arrParamsBusc->{'sort_by'};
274 $sort_by[0] = $default_sort_by if !$sort_by[0] && defined($default_sort_by);
275 my ($error, $results_hashref, $facets);
277 ($error, $results_hashref, $facets) = getRecords
($arrParamsBusc->{'query'},$arrParamsBusc->{'simple_query'},\
@sort_by,\
@servers,$results_per_page,$offset,undef,$itemtypes,$arrParamsBusc->{'query_type'},$arrParamsBusc->{'scan'});
281 my $search_context = {
282 'interface' => 'opac',
283 'category' => $borcat
285 for (my $i=0;$i<@servers;$i++) {
286 my $server = $servers[$i];
287 $hits = $results_hashref->{$server}->{"hits"};
288 @newresults = searchResults
( $search_context, '', $hits, $results_per_page, $offset, $arrParamsBusc->{'scan'}, $results_hashref->{$server}->{"RECORDS"});
293 # Build the current list of biblionumbers in this search
296 my ($newresultsRef, $results_per_page) = @_;
298 my $listBiblios = '';
300 foreach (@
$newresultsRef) {
301 my $bibnum = ($_->{biblionumber
})?
$_->{biblionumber
}:0;
302 $listBiblios .= $bibnum . ',';
304 last if ($j == $results_per_page);
306 chop $listBiblios if ($listBiblios =~ /,$/);
310 my $busc = $session->param("busc");
311 my @arrBusc = split(/\&(?:amp;)?/, $busc);
313 my %arrParamsBusc = ();
315 ($key, $value) = split(/=/, $_, 2);
316 if ($key =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|offset|offsetSearch|count|expand|scan)/) {
317 $arrParamsBusc{$key} = uri_unescape
($value);
319 unless (exists($arrParamsBusc{$key})) {
320 $arrParamsBusc{$key} = [];
322 push @
{$arrParamsBusc{$key}}, uri_unescape
($value);
326 my $count = C4
::Context
->preference('OPACnumSearchResults') || 20;
327 my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?
$arrParamsBusc{'count'}:$count;
328 $arrParamsBusc{'count'} = $results_per_page;
329 my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?
$arrParamsBusc{'offset'}:0;
330 # The value OPACnumSearchResults has changed and the search has to be rebuild
331 if ($count != $results_per_page) {
332 if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
334 my @arrBibliosAux = split(',', $arrParamsBusc{'listBiblios'});
335 for (@arrBibliosAux) {
336 last if ($_ == $biblionumber);
339 $indexBiblio += $offset;
340 $offset = int($indexBiblio / $count) * $count;
341 $arrParamsBusc{'offset'} = $offset;
343 $arrParamsBusc{'count'} = $count;
344 $results_per_page = $count;
345 my $newresultsRef = searchAgain
(\
%arrParamsBusc, $offset, $results_per_page);
346 $arrParamsBusc{'listBiblios'} = buildListBiblios
($newresultsRef, $results_per_page);
347 delete $arrParamsBusc{'previous'} if (exists($arrParamsBusc{'previous'}));
348 delete $arrParamsBusc{'next'} if (exists($arrParamsBusc{'next'}));
349 delete $arrParamsBusc{'offsetSearch'} if (exists($arrParamsBusc{'offsetSearch'}));
350 delete $arrParamsBusc{'newlistBiblios'} if (exists($arrParamsBusc{'newlistBiblios'}));
351 my $newbusc = rebuildBuscParam
(\
%arrParamsBusc);
352 $session->param("busc" => $newbusc);
353 @arrBusc = split(/\&(?:amp;)?/, $newbusc);
355 my $modifyListBiblios = 0;
356 # We come from a previous click
357 if (exists($arrParamsBusc{'previous'})) {
358 $modifyListBiblios = 1 if ($biblionumber == $arrParamsBusc{'previous'});
359 delete $arrParamsBusc{'previous'};
360 } elsif (exists($arrParamsBusc{'next'})) { # We come from a next click
361 $modifyListBiblios = 2 if ($biblionumber == $arrParamsBusc{'next'});
362 delete $arrParamsBusc{'next'};
364 if ($modifyListBiblios) {
365 if (exists($arrParamsBusc{'newlistBiblios'})) {
366 my $listBibliosAux = $arrParamsBusc{'listBiblios'};
367 $arrParamsBusc{'listBiblios'} = $arrParamsBusc{'newlistBiblios'};
368 my @arrAux = split(',', $listBibliosAux);
369 $arrParamsBusc{'newlistBiblios'} = $listBibliosAux;
370 if ($modifyListBiblios == 1) {
371 $arrParamsBusc{'next'} = $arrAux[0];
372 $paging{'next'}->{biblionumber
} = $arrAux[0];
374 $arrParamsBusc{'previous'} = $arrAux[$#arrAux];
375 $paging{'previous'}->{biblionumber
} = $arrAux[$#arrAux];
378 delete $arrParamsBusc{'listBiblios'};
380 my $offsetAux = $arrParamsBusc{'offset'};
381 $arrParamsBusc{'offset'} = $arrParamsBusc{'offsetSearch'};
382 $arrParamsBusc{'offsetSearch'} = $offsetAux;
383 $offset = $arrParamsBusc{'offset'};
384 my $newbusc = rebuildBuscParam
(\
%arrParamsBusc);
385 $session->param("busc" => $newbusc);
386 @arrBusc = split(/\&(?:amp;)?/, $newbusc);
391 # Rebuild the query for the button "back to results"
393 unless ($_ =~ /^(?:query|listBiblios|newlistBiblios|query_type|simple_query|next|previous|total|count|offsetSearch)/) {
394 $buscParam .= '&' unless ($j == 0);
395 $buscParam .= $_; # string already URI encoded
399 $template->param('busc' => $buscParam);
402 # We are inside the list of biblios and we don't have to search
403 if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
404 @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
406 # We are at the first item of the list
407 if ($arrBiblios[0] == $biblionumber) {
408 if (@arrBiblios > 1) {
409 for (my $j = 1; $j < @arrBiblios; $j++) {
410 next unless ($arrBiblios[$j]);
411 $paging{'next'}->{biblionumber
} = $arrBiblios[$j];
415 # search again if we are not at the first searching list
416 if ($offset && !$arrParamsBusc{'previous'}) {
418 $offsetSearch = $offset - $results_per_page;
420 # we are at the last item of the list
421 } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
422 for (my $j = $#arrBiblios - 1; $j >= 0; $j--) {
423 next unless ($arrBiblios[$j]);
424 $paging{'previous'}->{biblionumber
} = $arrBiblios[$j];
428 # search again if we are at the first list and there is more results
429 $searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} != @arrBiblios);
431 # search again if we aren't at the first list and there is more results
432 $searchAgain = 1 if (!$arrParamsBusc{'next'} && $arrParamsBusc{'total'} > ($offset + @arrBiblios));
434 $offsetSearch = $offset + $results_per_page if ($searchAgain);
436 for (my $j = 1; $j < $#arrBiblios; $j++) {
437 if ($arrBiblios[$j] == $biblionumber) {
438 for (my $z = $j - 1; $z >= 0; $z--) {
439 next unless ($arrBiblios[$z]);
440 $paging{'previous'}->{biblionumber
} = $arrBiblios[$z];
443 for (my $z = $j + 1; $z < @arrBiblios; $z++) {
444 next unless ($arrBiblios[$z]);
445 $paging{'next'}->{biblionumber
} = $arrBiblios[$z];
453 $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
456 my $newresultsRef = searchAgain
(\
%arrParamsBusc, $offsetSearch, $results_per_page);
457 my @newresults = @
$newresultsRef;
458 # build the new listBiblios
459 my $listBiblios = buildListBiblios
(\
@newresults, $results_per_page);
460 unless (exists($arrParamsBusc{'listBiblios'})) {
461 $arrParamsBusc{'listBiblios'} = $listBiblios;
462 @arrBiblios = split(',', $arrParamsBusc{'listBiblios'});
464 $arrParamsBusc{'newlistBiblios'} = $listBiblios;
466 # From the new list we build again the next and previous result
468 if ($arrBiblios[0] == $biblionumber) {
469 for (my $j = $#newresults; $j >= 0; $j--) {
470 next unless ($newresults[$j]);
471 $paging{'previous'}->{biblionumber
} = $newresults[$j]->{biblionumber
};
472 $arrParamsBusc{'previous'} = $paging{'previous'}->{biblionumber
};
473 $arrParamsBusc{'offsetSearch'} = $offsetSearch;
476 } elsif ($arrBiblios[$#arrBiblios] == $biblionumber) {
477 for (my $j = 0; $j < @newresults; $j++) {
478 next unless ($newresults[$j]);
479 $paging{'next'}->{biblionumber
} = $newresults[$j]->{biblionumber
};
480 $arrParamsBusc{'next'} = $paging{'next'}->{biblionumber
};
481 $arrParamsBusc{'offsetSearch'} = $offsetSearch;
486 # build new busc param
487 my $newbusc = rebuildBuscParam
(\
%arrParamsBusc);
488 $session->param("busc" => $newbusc);
490 my ($numberBiblioPaging, $dataBiblioPaging);
492 $numberBiblioPaging = $paging{'previous'}->{biblionumber
};
493 if ($numberBiblioPaging) {
494 $template->param( 'previousBiblionumber' => $numberBiblioPaging );
495 $dataBiblioPaging = Koha
::Biblios
->find( $numberBiblioPaging );
496 $template->param('previousTitle' => $dataBiblioPaging->title) if $dataBiblioPaging;
499 $numberBiblioPaging = $paging{'next'}->{biblionumber
};
500 if ($numberBiblioPaging) {
501 $template->param( 'nextBiblionumber' => $numberBiblioPaging );
502 $dataBiblioPaging = Koha
::Biblios
->find( $numberBiblioPaging );
503 $template->param('nextTitle' => $dataBiblioPaging->title) if $dataBiblioPaging;
505 # Partial list of biblio results
507 for (my $j = 0; $j < @arrBiblios; $j++) {
508 next unless ($arrBiblios[$j]);
509 $dataBiblioPaging = Koha
::Biblios
->find( $arrBiblios[$j] ) if ($arrBiblios[$j] != $biblionumber);
510 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]};
512 $template->param('listResults' => \
@listResults) if (@listResults);
513 $template->param('indexPag' => 1 + $offset, 'totalPag' => $arrParamsBusc{'total'}, 'indexPagEnd' => scalar(@arrBiblios) + $offset);
514 $template->param( 'offset' => $offset );
519 OPACShowCheckoutName
=> C4
::Context
->preference("OPACShowCheckoutName"),
522 if ( C4
::Context
->preference('EasyAnalyticalRecords') ) {
523 # adding items linked via host biblios
524 my $analyticfield = '773';
525 if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){
526 $analyticfield = '773';
527 } elsif ($marcflavour eq 'UNIMARC') {
528 $analyticfield = '461';
530 foreach my $hostfield ( $record->field($analyticfield)) {
531 my $hostbiblionumber = $hostfield->subfield("0");
532 my $linkeditemnumber = $hostfield->subfield("9");
533 my @hostitemInfos = GetItemsInfo
($hostbiblionumber);
534 foreach my $hostitemInfo (@hostitemInfos){
535 if ($hostitemInfo->{itemnumber
} eq $linkeditemnumber){
536 push(@all_items, $hostitemInfo);
544 # Are there items to hide?
546 $hideitems = 1 if C4
::Context
->preference('hidelostitems') or scalar(@hiddenitems) > 0;
550 for my $itm (@all_items) {
551 if ( C4
::Context
->preference('hidelostitems') ) {
552 push @items, $itm unless $itm->{itemlost
} or any
{ $itm->{'itemnumber'} eq $_ } @hiddenitems;
554 push @items, $itm unless any
{ $itm->{'itemnumber'} eq $_ } @hiddenitems;
563 if (C4
::Context
->userenv){
564 $branch = C4
::Context
->userenv->{branch
};
566 if ( C4
::Context
->preference('HighlightOwnItemsOnOPAC') ) {
568 ( ( C4
::Context
->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) && $branch )
570 C4
::Context
->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch'
573 if ( C4
::Context
->preference('HighlightOwnItemsOnOPACWhich') eq 'PatronBranch' ) {
574 $branchcode = $branch;
576 elsif ( C4
::Context
->preference('HighlightOwnItemsOnOPACWhich') eq 'OpacURLBranch' ) {
577 $branchcode = $ENV{'BRANCHCODE'};
583 foreach my $item ( @items ) {
584 if ( $item->{branchcode
} eq $branchcode ) {
585 $item->{'this_branch'} = 1;
586 push( @our_items, $item );
588 push( @other_items, $item );
592 @items = ( @our_items, @other_items );
596 my $dat = &GetBiblioData
($biblionumber);
597 my $HideMARC = $record_processor->filters->[0]->should_hide_marc(
599 frameworkcode
=> $dat->{'frameworkcode'},
603 my $itemtypes = { map { $_->{itemtype
} => $_ } @
{ Koha
::ItemTypes
->search_with_localization->unblessed } };
605 my $itemtype = $dat->{'itemtype'};
607 $dat->{'imageurl'} = getitemtypeimagelocation
( 'opac', $itemtypes->{$itemtype}->{'imageurl'} );
608 $dat->{'description'} = $itemtypes->{$itemtype}->{translated_description
};
612 { map { $_->{authorised_value
} => $_->{opac_description
} } Koha
::AuthorisedValues
->get_descriptions_by_koha_field( { frameworkcode
=> $dat->{frameworkcode
}, kohafield
=> 'items.location' } ) };
614 { map { $_->{authorised_value
} => $_->{opac_description
} } Koha
::AuthorisedValues
->get_descriptions_by_koha_field( { frameworkcode
=> $dat->{frameworkcode
}, kohafield
=> 'items.ccode' } ) };
616 { map { $_->{authorised_value
} => $_->{opac_description
} } Koha
::AuthorisedValues
->get_descriptions_by_koha_field( { frameworkcode
=> $dat->{frameworkcode
}, kohafield
=> 'items.copynumber' } ) };
618 #coping with subscriptions
619 my $subscriptionsnumber = CountSubscriptionFromBiblionumber
($biblionumber);
620 my @subscriptions = SearchSubscriptions
({ biblionumber
=> $biblionumber, orderby
=> 'title' });
623 $dat->{'serial'}=1 if $subscriptionsnumber;
624 foreach my $subscription (@subscriptions) {
625 my $serials_to_display;
627 $cell{subscriptionid
} = $subscription->{subscriptionid
};
628 $cell{subscriptionnotes
} = $subscription->{notes
};
629 $cell{missinglist
} = $subscription->{missinglist
};
630 $cell{opacnote
} = $subscription->{opacnote
};
631 $cell{histstartdate
} = $subscription->{histstartdate
};
632 $cell{histenddate
} = $subscription->{histenddate
};
633 $cell{branchcode
} = $subscription->{branchcode
};
634 $cell{callnumber
} = $subscription->{callnumber
};
635 $cell{location
} = $subscription->{location
};
636 $cell{closed
} = $subscription->{closed
};
637 $cell{letter
} = $subscription->{letter
};
638 $cell{biblionumber
} = $subscription->{biblionumber
};
639 #get the three latest serials.
640 $serials_to_display = $subscription->{opacdisplaycount
};
641 $serials_to_display = C4
::Context
->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
642 $cell{opacdisplaycount
} = $serials_to_display;
643 $cell{latestserials
} =
644 GetLatestSerials
( $subscription->{subscriptionid
}, $serials_to_display );
645 if ( $borrowernumber ) {
646 my $subscription_object = Koha
::Subscriptions
->find( $subscription->{subscriptionid
} );
647 my $subscriber = $subscription_object->subscribers->find( $borrowernumber );
648 $cell{hasalert
} = 1 if $subscriber;
653 $dat->{'count'} = scalar(@items);
656 my (%item_reserves, %priority);
657 my ($show_holds_count, $show_priority);
658 for ( C4
::Context
->preference("OPACShowHoldQueueDetails") ) {
659 m/holds/o and $show_holds_count = 1;
660 m/priority/ and $show_priority = 1;
663 if ( $show_holds_count || $show_priority) {
664 my $holds = $biblio->holds;
665 $template->param( holds_count
=> $holds->count );
666 while ( my $hold = $holds->next ) {
667 $item_reserves{ $hold->itemnumber }++ if $hold->itemnumber;
668 if ($show_priority && $hold->borrowernumber == $borrowernumber) {
671 ?
($priority{ $hold->itemnumber } = $hold->priority)
672 : ($template->param( priority
=> $hold->priority ));
676 $template->param( show_priority
=> $has_hold ) ;
680 my (@itemloop, @otheritemloop);
681 my $currentbranch = C4
::Context
->userenv ? C4
::Context
->userenv->{branch
} : undef;
682 if ($currentbranch and C4
::Context
->preference('OpacSeparateHoldings')) {
683 $template->param(SeparateHoldings
=> 1);
685 my $separatebranch = C4
::Context
->preference('OpacSeparateHoldingsBranch');
686 my $viewallitems = $query->param('viewallitems');
687 my $max_items_to_display = C4
::Context
->preference('OpacMaxItemsToDisplay') // 50;
690 my ( @itemnumbers_on_order );
691 if ( C4
::Context
->preference('OPACAcquisitionDetails' ) ) {
692 my $orders = C4
::Acquisition
::SearchOrders
({
693 biblionumber
=> $biblionumber,
696 my $total_quantity = 0;
697 for my $order ( @
$orders ) {
698 my $order = Koha
::Acquisition
::Orders
->find( $order->{ordernumber
} );
699 my $basket = $order->basket;
700 if ( $basket->effective_create_items eq 'ordering' ) {
701 @itemnumbers_on_order = $order->items->get_column('itemnumber');
703 $total_quantity += $order->quantity;
705 $template->{VARS
}->{acquisition_details
} = {
706 total_quantity
=> $total_quantity,
710 my $allow_onshelf_holds;
711 my ( $itemloop_has_images, $otheritemloop_has_images );
712 if ( not $viewallitems and @items > $max_items_to_display ) {
715 items_count
=> scalar( @items ),
718 for my $itm (@items) {
719 my $item = Koha
::Items
->find( $itm->{itemnumber
} );
720 $itm->{holds_count
} = $item_reserves{ $itm->{itemnumber
} };
721 $itm->{priority
} = $priority{ $itm->{itemnumber
} };
724 && !$itm->{'withdrawn'}
725 && !$itm->{'itemlost'}
726 && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'})
727 && !$itemtypes->{$itm->{'itype'}}->{notforloan
}
728 && $itm->{'itemnumber'};
730 $allow_onshelf_holds = Koha
::CirculationRules
->get_onshelfholds_policy( { item
=> $item, patron
=> $patron } )
731 unless $allow_onshelf_holds;
733 # get collection code description, too
734 my $ccode = $itm->{'ccode'};
735 $itm->{'ccode'} = $collections->{$ccode} if defined($ccode) && $collections && exists( $collections->{$ccode} );
736 my $copynumber = $itm->{'copynumber'};
737 $itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) );
738 if ( defined $itm->{'location'} ) {
739 $itm->{'location_description'} = $shelflocations->{ $itm->{'location'} };
741 if (exists $itm->{itype
} && defined($itm->{itype
}) && exists $itemtypes->{ $itm->{itype
} }) {
742 $itm->{'imageurl'} = getitemtypeimagelocation
( 'opac', $itemtypes->{ $itm->{itype
} }->{'imageurl'} );
743 $itm->{'description'} = $itemtypes->{ $itm->{itype
} }->{translated_description
};
745 foreach (qw(ccode materials enumchron copynumber itemnotes location_description uri)) {
746 $itemfields{$_} = 1 if ($itm->{$_});
749 my $reserve_status = C4
::Reserves
::GetReserveStatus
($itm->{itemnumber
});
750 if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; }
751 if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; }
753 my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers
($itm->{itemnumber
});
754 if ( defined( $transfertwhen ) && $transfertwhen ne '' ) {
755 $itm->{transfertwhen
} = $transfertwhen;
756 $itm->{transfertfrom
} = $transfertfrom;
757 $itm->{transfertto
} = $transfertto;
760 if ( C4
::Context
->preference('OPACAcquisitionDetails') ) {
762 if grep { $_ eq $itm->{itemnumber
} } @itemnumbers_on_order;
765 if ( C4
::Context
->preference("OPACLocalCoverImages") == 1 ) {
766 $itm->{cover_images
} = $item->cover_images;
769 my $itembranch = $itm->{$separatebranch};
770 if ($currentbranch and C4
::Context
->preference('OpacSeparateHoldings')) {
771 if ($itembranch and $itembranch eq $currentbranch) {
772 push @itemloop, $itm;
773 $itemloop_has_images++ if $item->cover_images->count;
775 push @otheritemloop, $itm;
776 $otheritemloop_has_images++ if $item->cover_images->count;
779 push @itemloop, $itm;
780 $itemloop_has_images++ if $item->cover_images->count;
785 if( $allow_onshelf_holds || CountItemsIssued
($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
786 $template->param( ReservableItems
=> 1 );
790 itemloop_has_images
=> $itemloop_has_images,
791 otheritemloop_has_images
=> $otheritemloop_has_images,
794 # Display only one tab if one items list is empty
795 if (scalar(@itemloop) == 0 || scalar(@otheritemloop) == 0) {
796 $template->param(SeparateHoldings
=> 0);
797 if (scalar(@itemloop) == 0) {
798 @itemloop = @otheritemloop;
802 ## get notes and subjects from MARC record
803 if (!C4
::Context
->preference("OPACXSLTDetailsDisplay") ) {
804 my $marcisbnsarray = GetMarcISBN
($record,$marcflavour);
805 my $marcauthorsarray = GetMarcAuthors
($record,$marcflavour);
806 my $marcsubjctsarray = GetMarcSubjects
($record,$marcflavour);
807 my $marcseriesarray = GetMarcSeries
($record,$marcflavour);
808 my $marcurlsarray = GetMarcUrls
($record,$marcflavour);
811 MARCSUBJCTS
=> $marcsubjctsarray,
812 MARCAUTHORS
=> $marcauthorsarray,
813 MARCSERIES
=> $marcseriesarray,
814 MARCURLS
=> $marcurlsarray,
815 MARCISBNS
=> $marcisbnsarray,
819 my $marcnotesarray = GetMarcNotes
($record,$marcflavour,1);
821 if( C4
::Context
->preference('ArticleRequests') ) {
822 my $patron = $borrowernumber ? Koha
::Patrons
->find($borrowernumber) : undef;
823 my $itemtype = Koha
::ItemTypes
->find($biblio->itemtype);
824 my $artreqpossible = $patron
825 ?
$biblio->can_article_request( $patron )
827 ?
$itemtype->may_article_request
829 $template->param( artreqpossible
=> $artreqpossible );
833 MARCNOTES
=> $marcnotesarray,
834 norequests
=> $norequests,
835 RequestOnOpac
=> C4
::Context
->preference("RequestOnOpac"),
836 itemdata_ccode
=> $itemfields{ccode
},
837 itemdata_materials
=> $itemfields{materials
},
838 itemdata_enumchron
=> $itemfields{enumchron
},
839 itemdata_uri
=> $itemfields{uri
},
840 itemdata_copynumber
=> $itemfields{copynumber
},
841 itemdata_itemnotes
=> $itemfields{itemnotes
},
842 itemdata_location
=> $itemfields{location_description
},
843 OpacStarRatings
=> C4
::Context
->preference("OpacStarRatings"),
846 if (C4
::Context
->preference("AlternateHoldingsField") && scalar @items == 0) {
847 my $fieldspec = C4
::Context
->preference("AlternateHoldingsField");
848 my $subfields = substr $fieldspec, 3;
849 my $holdingsep = C4
::Context
->preference("AlternateHoldingsSeparator") || ' ';
850 my @alternateholdingsinfo = ();
851 my @holdingsfields = $record->field(substr $fieldspec, 0, 3);
853 for my $field (@holdingsfields) {
854 my %holding = ( holding
=> '' );
855 my $havesubfield = 0;
856 for my $subfield ($field->subfields()) {
857 if ((index $subfields, $$subfield[0]) >= 0) {
858 $holding{'holding'} .= $holdingsep if (length $holding{'holding'} > 0);
859 $holding{'holding'} .= $$subfield[1];
864 push(@alternateholdingsinfo, \
%holding);
869 ALTERNATEHOLDINGS
=> \
@alternateholdingsinfo,
873 # FIXME: The template uses this hash directly. Need to filter.
874 foreach ( keys %{$dat} ) {
875 next if ( $HideMARC->{$_} );
876 $template->param( "$_" => defined $dat->{$_} ?
$dat->{$_} : '' );
879 # some useful variables for enhanced content;
880 # in each case, we're grabbing the first value we find in
881 # the record and normalizing it
882 my $upc = GetNormalizedUPC
($record,$marcflavour);
883 my $oclc = GetNormalizedOCLCNumber
($record,$marcflavour);
884 my $isbn = GetNormalizedISBN
(undef,$record,$marcflavour);
885 my $content_identifier_exists;
886 if ( $isbn or $ean or $oclc or $upc ) {
887 $content_identifier_exists = 1;
890 normalized_upc
=> $upc,
891 normalized_ean
=> $ean,
892 normalized_oclc
=> $oclc,
893 normalized_isbn
=> $isbn,
894 content_identifier_exists
=> $content_identifier_exists,
897 # Catch the exception as Koha::Biblio::Metadata->record can explode if the MARCXML is invalid
898 # COinS format FIXME: for books Only
899 my $coins = eval { $biblio->get_coins };
900 $template->param( ocoins
=> $coins );
902 my ( $loggedincommenter, $reviews );
903 if ( C4
::Context
->preference('reviewson') ) {
904 $reviews = Koha
::Reviews
->search(
906 biblionumber
=> $biblionumber,
907 -or => { approved
=> 1, borrowernumber
=> $borrowernumber }
910 order_by
=> { -desc
=> 'datereviewed' }
913 my $libravatar_enabled = 0;
914 if ( C4
::Context
->preference('ShowReviewer') and C4
::Context
->preference('ShowReviewerPhoto') ) {
916 require Libravatar
::URL
;
917 Libravatar
::URL
->import();
920 $libravatar_enabled = 1;
923 for my $review (@
$reviews) {
924 my $review_patron = Koha
::Patrons
->find( $review->{borrowernumber
} ); # FIXME Should be Koha::Review->reviewer or similar
926 # setting some borrower info into this hash
927 if ( $review_patron ) {
928 $review->{patron
} = $review_patron;
929 if ( $libravatar_enabled and $review_patron->email ) {
930 $review->{avatarurl
} = libravatar_url
( email
=> $review_patron->email, https
=> $ENV{HTTPS
} );
933 if ( $review_patron->borrowernumber eq $borrowernumber ) {
934 $loggedincommenter = 1;
940 if ( C4
::Context
->preference("OPACISBD") ) {
941 $template->param( ISBD
=> 1 );
945 itemloop
=> \
@itemloop,
946 otheritemloop
=> \
@otheritemloop,
947 biblionumber
=> $biblionumber,
948 subscriptions
=> \
@subs,
949 subscriptionsnumber
=> $subscriptionsnumber,
951 loggedincommenter
=> $loggedincommenter
955 if (C4
::Context
->preference("virtualshelves") ) {
956 my $shelves = Koha
::Virtualshelves
->search(
958 biblionumber
=> $biblionumber,
962 join => 'virtualshelfcontents',
965 $template->param( shelves
=> $shelves );
969 if (C4
::Context
->preference("OPACFRBRizeEditions")==1) {
972 XISBNS
=> scalar get_xisbns
($isbn, $biblionumber)
975 if ($@
) { warn "XISBN Failed $@"; }
979 my @sc_fields = $record->field(955);
980 my @lc_fields = $marcflavour eq 'UNIMARC'
981 ?
$record->field(930)
982 : $record->field(852);
983 my @serialcollections = ();
985 foreach my $sc_field (@sc_fields) {
988 $row_data{text
} = $sc_field->subfield('r');
989 $row_data{branch
} = $sc_field->subfield('9');
990 foreach my $lc_field (@lc_fields) {
991 $row_data{itemcallnumber
} = $marcflavour eq 'UNIMARC'
992 ?
$lc_field->subfield('a') # 930$a
993 : $lc_field->subfield('h') # 852$h
994 if ($sc_field->subfield('5') eq $lc_field->subfield('5'));
997 if ($row_data{text
} && $row_data{branch
}) {
998 push (@serialcollections, \
%row_data);
1002 if (scalar(@serialcollections) > 0) {
1004 serialcollection
=> 1,
1005 serialcollections
=> \
@serialcollections);
1008 # Local cover Images stuff
1009 if (C4
::Context
->preference("OPACLocalCoverImages")){
1010 $template->param(OPACLocalCoverImages
=> 1);
1014 if ( (C4
::Context
->preference("HTML5MediaEnabled") eq 'both') or (C4
::Context
->preference("HTML5MediaEnabled") eq 'opac') ) {
1015 $template->param( C4
::HTML5Media
->gethtml5media($record));
1018 my $syndetics_elements;
1020 if ( C4
::Context
->preference("SyndeticsEnabled") ) {
1021 $template->param("SyndeticsEnabled" => 1);
1022 $template->param("SyndeticsClientCode" => C4
::Context
->preference("SyndeticsClientCode"));
1024 $syndetics_elements = &get_syndetics_index
($isbn,$upc,$oclc);
1025 for my $element (values %$syndetics_elements) {
1026 $template->param("Syndetics$element"."Exists" => 1 );
1027 #warn "Exists: "."Syndetics$element"."Exists";
1033 if ( C4
::Context
->preference("SyndeticsEnabled")
1034 && C4
::Context
->preference("SyndeticsSummary")
1035 && ( exists($syndetics_elements->{'SUMMARY'}) || exists($syndetics_elements->{'AVSUMMARY'}) ) ) {
1037 my $syndetics_summary = &get_syndetics_summary
($isbn,$upc,$oclc, $syndetics_elements);
1038 $template->param( SYNDETICS_SUMMARY
=> $syndetics_summary );
1044 if ( C4
::Context
->preference("SyndeticsEnabled")
1045 && C4
::Context
->preference("SyndeticsTOC")
1046 && exists($syndetics_elements->{'TOC'}) ) {
1048 my $syndetics_toc = &get_syndetics_toc
($isbn,$upc,$oclc);
1049 $template->param( SYNDETICS_TOC
=> $syndetics_toc );
1054 if ( C4
::Context
->preference("SyndeticsEnabled")
1055 && C4
::Context
->preference("SyndeticsExcerpt")
1056 && exists($syndetics_elements->{'DBCHAPTER'}) ) {
1058 my $syndetics_excerpt = &get_syndetics_excerpt
($isbn,$upc,$oclc);
1059 $template->param( SYNDETICS_EXCERPT
=> $syndetics_excerpt );
1064 if ( C4
::Context
->preference("SyndeticsEnabled")
1065 && C4
::Context
->preference("SyndeticsReviews")) {
1067 my $syndetics_reviews = &get_syndetics_reviews
($isbn,$upc,$oclc,$syndetics_elements);
1068 $template->param( SYNDETICS_REVIEWS
=> $syndetics_reviews );
1073 if ( C4
::Context
->preference("SyndeticsEnabled")
1074 && C4
::Context
->preference("SyndeticsAuthorNotes")
1075 && exists($syndetics_elements->{'ANOTES'}) ) {
1077 my $syndetics_anotes = &get_syndetics_anotes
($isbn,$upc,$oclc);
1078 $template->param( SYNDETICS_ANOTES
=> $syndetics_anotes );
1083 # LibraryThingForLibraries ID Code and Tabbed View Option
1084 if( C4
::Context
->preference('LibraryThingForLibrariesEnabled') )
1086 $template->param(LibraryThingForLibrariesID
=>
1087 C4
::Context
->preference('LibraryThingForLibrariesID') );
1088 $template->param(LibraryThingForLibrariesTabbedView
=>
1089 C4
::Context
->preference('LibraryThingForLibrariesTabbedView') );
1093 if( C4
::Context
->preference('NovelistSelectEnabled') )
1095 $template->param(NovelistSelectProfile
=> C4
::Context
->preference('NovelistSelectProfile') );
1096 $template->param(NovelistSelectPassword
=> C4
::Context
->preference('NovelistSelectPassword') );
1097 $template->param(NovelistSelectView
=> C4
::Context
->preference('NovelistSelectView') );
1102 if ( C4
::Context
->preference("Babeltheque") ) {
1105 Babeltheque_url_js
=> C4
::Context
->preference("Babeltheque_url_js"),
1110 if ( C4
::Context
->preference( "SocialNetworks" ) ) {
1111 $template->param( current_url
=> C4
::Context
->preference('OPACBaseURL') . "/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber" );
1112 $template->param( SocialNetworks
=> 1 );
1115 # Shelf Browser Stuff
1116 if (C4
::Context
->preference("OPACShelfBrowser")) {
1117 my $starting_itemnumber = $query->param('shelfbrowse_itemnumber');
1118 if (defined($starting_itemnumber)) {
1119 $template->param( OpenOPACShelfBrowser
=> 1) if $starting_itemnumber;
1120 my $nearby = GetNearbyItems
($starting_itemnumber);
1123 starting_itemnumber
=> $starting_itemnumber,
1124 starting_homebranch
=> $nearby->{starting_homebranch
}->{description
},
1125 starting_location
=> $nearby->{starting_location
}->{description
},
1126 starting_ccode
=> $nearby->{starting_ccode
}->{description
},
1127 shelfbrowser_prev_item
=> $nearby->{prev_item
},
1128 shelfbrowser_next_item
=> $nearby->{next_item
},
1129 shelfbrowser_items
=> $nearby->{items
},
1132 # in which tab shelf browser should open ?
1133 if (grep { $starting_itemnumber == $_->{itemnumber
} } @itemloop) {
1134 $template->param(shelfbrowser_tab
=> 'holdings');
1136 $template->param(shelfbrowser_tab
=> 'otherholdings');
1141 $template->param( AmazonTld
=> get_amazon_tld
() ) if ( C4
::Context
->preference("OPACAmazonCoverImages"));
1143 if (C4
::Context
->preference("BakerTaylorEnabled")) {
1145 BakerTaylorEnabled
=> 1,
1146 BakerTaylorImageURL
=> &image_url
(),
1147 BakerTaylorLinkURL
=> &link_url
(),
1148 BakerTaylorBookstoreURL
=> C4
::Context
->preference('BakerTaylorBookstoreURL'),
1150 my ($bt_user, $bt_pass);
1152 $bt_user = C4
::Context
->preference('BakerTaylorUsername') and
1153 $bt_pass = C4
::Context
->preference('BakerTaylorPassword') )
1156 BakerTaylorContentURL
=>
1157 sprintf("https://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=%s&Password=%s&ItemKey=%s&Options=Y",
1158 $bt_user,$bt_pass,$isbn)
1164 if (C4
::Context
->preference('TagsEnabled') and $tag_quantity = C4
::Context
->preference('TagsShowOnDetail')) {
1167 TagsShowOnDetail
=> $tag_quantity,
1168 TagsInputOnDetail
=> C4
::Context
->preference('TagsInputOnDetail')
1170 $template->param(TagLoop
=> get_tags
({biblionumber
=>$biblionumber, approved
=>1,
1171 'sort'=>'-weight', limit
=>$tag_quantity}));
1174 if (C4
::Context
->preference("OPACURLOpenInNewWindow")) {
1175 # These values are going to be read by Javascript, at least in the case
1176 # of the google covers
1177 $template->param(covernewwindow
=> 'true');
1179 $template->param(covernewwindow
=> 'false');
1182 $template->param(borrowernumber
=> $borrowernumber);
1184 if ( C4
::Context
->preference('OpacStarRatings') !~ /disable/ ) {
1185 my $ratings = Koha
::Ratings
->search({ biblionumber
=> $biblionumber });
1186 my $my_rating = $borrowernumber ?
$ratings->search({ borrowernumber
=> $borrowernumber })->next : undef;
1188 ratings
=> $ratings,
1189 my_rating
=> $my_rating,
1193 #Search for title in links
1194 my $marccontrolnumber = GetMarcControlnumber
($record, $marcflavour);
1195 my $marcissns = GetMarcISSN
( $record, $marcflavour );
1196 my $issn = $marcissns->[0] || '';
1198 if (my $search_for_title = C4
::Context
->preference('OPACSearchForTitleIn')){
1199 $dat->{title
} =~ s/\/+$//; # remove trailing slash
1200 $dat->{title
} =~ s/\s+$//; # remove trailing space
1201 $search_for_title = parametrized_url
(
1204 TITLE
=> $dat->{title
},
1205 AUTHOR
=> $dat->{author
},
1208 CONTROLNUMBER
=> $marccontrolnumber,
1209 BIBLIONUMBER
=> $biblionumber,
1212 $template->param('OPACSearchForTitleIn' => $search_for_title);
1216 if ( C4
::Context
->preference("IDREF") ) {
1217 # If the record comes from the SUDOC
1218 if ( $record->field('009') ) {
1219 my $unimarc3 = $record->field("009")->data;
1220 if ( $unimarc3 =~ /^\d+$/ ) {
1228 # We try to select the best default tab to show, according to what
1229 # the user wants, and what's available for display
1230 my $opac_serial_default = C4
::Context
->preference('opacSerialDefaultTab');
1234 $opac_serial_default eq 'subscriptions' && $subscriptionsnumber
1236 $opac_serial_default eq 'serialcollection' && @serialcollections > 0
1237 ?
'serialcollection' :
1238 $opac_serial_default eq 'holdings' && scalar (@itemloop) > 0
1240 scalar (@itemloop) == 0
1242 $subscriptionsnumber
1244 @serialcollections > 0
1245 ?
'serialcollection' : 'subscriptions';
1246 $template->param('defaulttab' => $defaulttab);
1248 if (C4
::Context
->preference('OPACLocalCoverImages') == 1) {
1249 $template->param( localimages
=> $biblio->cover_images );
1252 $template->{VARS
}->{OPACPopupAuthorsSearch
} = C4
::Context
->preference('OPACPopupAuthorsSearch');
1254 if (C4
::Context
->preference('OpacHighlightedWords')) {
1255 $template->{VARS
}->{query_desc
} = $query->param('query_desc');
1257 $template->{VARS
}->{'trackclicks'} = C4
::Context
->preference('TrackClicks');
1259 if ( C4
::Context
->preference('UseCourseReserves') ) {
1260 foreach my $i ( @items ) {
1261 $i->{'course_reserves'} = GetItemCourseReservesInfo
( itemnumber
=> $i->{'itemnumber'} );
1266 'OpacLocationBranchToDisplay' => C4
::Context
->preference('OpacLocationBranchToDisplay'),
1269 output_html_with_http_headers
$query, $cookie, $template->output;