Increment version for 22.11.12 release
[koha.git] / opac / opac-reserve.pl
1 #!/usr/bin/perl
2
3
4 # Copyright Katipo Communications 2002
5 # Copyright Koha Development team 2012
6 #
7 # This file is part of Koha.
8 #
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.
13 #
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.
18 #
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>.
21
22 use Modern::Perl;
23
24 use CGI qw ( -utf8 );
25 use C4::Auth qw( get_template_and_user );
26 use C4::Koha qw( getitemtypeimagelocation getitemtypeimagesrc );
27 use C4::Circulation qw( GetBranchItemRule );
28 use C4::Reserves qw( CanItemBeReserved CanBookBeReserved AddReserve GetReservesControlBranch ItemsAnyAvailableAndNotRestricted IsAvailableForItemLevelRequest GetReserveFee );
29 use C4::Biblio qw( GetBiblioData GetFrameworkCode );
30 use C4::Output qw( output_html_with_http_headers );
31 use C4::Context;
32 use C4::Members;
33 use C4::Overdues;
34
35 use Koha::AuthorisedValues;
36 use Koha::Biblios;
37 use Koha::CirculationRules;
38 use Koha::Items;
39 use Koha::ItemTypes;
40 use Koha::Checkouts;
41 use Koha::Libraries;
42 use Koha::Patrons;
43 use List::MoreUtils qw( uniq );
44
45 my $maxreserves = C4::Context->preference("maxreserves");
46
47 my $query = CGI->new;
48
49 # if OPACHoldRequests (for placing holds) is disabled, leave immediately
50 if ( ! C4::Context->preference('OPACHoldRequests') ) {
51     print $query->redirect("/cgi-bin/koha/errors/404.pl");
52     exit;
53 }
54
55 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
56     {
57         template_name   => "opac-reserve.tt",
58         query           => $query,
59         type            => "opac",
60     }
61 );
62
63 my $patron = Koha::Patrons->find( $borrowernumber, { prefetch => ['categorycode'] } );
64 my $category = $patron->category;
65
66 my $can_place_hold_if_available_at_pickup = C4::Context->preference('OPACHoldsIfAvailableAtPickup');
67 unless ( $can_place_hold_if_available_at_pickup ) {
68     my @patron_categories = split ',', C4::Context->preference('OPACHoldsIfAvailableAtPickupExceptions');
69     if ( @patron_categories ) {
70         my $categorycode = $patron->categorycode;
71         $can_place_hold_if_available_at_pickup = grep { $_ eq $categorycode } @patron_categories;
72     }
73 }
74
75 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
76
77 # There are two ways of calling this script, with a single biblio num
78 # or multiple biblio nums.
79 my $biblionumbers = $query->param('biblionumbers');
80 my $reserveMode = $query->param('reserve_mode');
81 if ($reserveMode && ($reserveMode eq 'single')) {
82     my $bib = $query->param('single_bib');
83     $biblionumbers = "$bib/";
84 }
85 if (! $biblionumbers) {
86     $biblionumbers = $query->param('biblionumber');
87 }
88
89 if ((! $biblionumbers) && (! $query->param('place_reserve'))) {
90     $template->param(message=>1, no_biblionumber=>1);
91     output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
92     exit;
93 }
94
95 # Pass the numbers to the page so they can be fed back
96 # when the hold is confirmed. TODO: Not necessary?
97 $template->param( biblionumbers => $biblionumbers );
98
99 # Each biblio number is suffixed with '/', e.g. "1/2/3/"
100 my @biblionumbers = split /\//, $biblionumbers;
101 if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) {
102     # TODO: New message?
103     $template->param(message=>1, no_biblionumber=>1);
104     output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
105     exit;
106 }
107
108 #
109 #
110 # Here we check that the borrower can actually make reserves Stage 1.
111 #
112 #
113 my $noreserves     = 0;
114 if ( $category->effective_BlockExpiredPatronOpacActions ) {
115     if ( $patron->is_expired ) {
116         # cannot reserve, their card has expired and the rules set mean this is not allowed
117         $noreserves = 1;
118         $template->param( message => 1, expired_patron => 1 );
119     }
120 }
121
122 my $maxoutstanding = C4::Context->preference("maxoutstanding");
123 my $amountoutstanding = $patron->account->balance;
124 if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
125     my $amount = sprintf "%.02f", $amountoutstanding;
126     $template->param( message => 1 );
127     $noreserves = 1;
128     $template->param( too_much_oweing => $amount );
129 }
130
131 if ( $patron->gonenoaddress && ($patron->gonenoaddress == 1) ) {
132     $noreserves = 1;
133     $template->param(
134         message => 1,
135         GNA     => 1
136     );
137 }
138
139 if ( $patron->lost && ($patron->lost == 1) ) {
140     $noreserves = 1;
141     $template->param(
142         message => 1,
143         lost    => 1
144     );
145 }
146
147 if ( $patron->is_debarred ) {
148     $noreserves = 1;
149     $template->param(
150         message          => 1,
151         debarred         => 1,
152         debarred_comment => $patron->debarredcomment,
153         debarred_date    => $patron->debarred,
154     );
155 }
156
157 my $holds = $patron->holds;
158 my $reserves_count = $holds->count;
159 $template->param( RESERVES => $holds->unblessed );
160 if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
161     $template->param( message => 1 );
162     $noreserves = 1;
163     $template->param( too_many_reserves => $holds->count );
164 }
165
166 if( $noreserves ){
167     output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
168     exit;
169 }
170
171
172 # pass the pickup branch along....
173 my $branch = $query->param('branch') || $patron->branchcode || C4::Context->userenv->{branch} || '' ;
174 $template->param( branch => $branch );
175
176 #
177 #
178 # Here we are carrying out the hold request, possibly
179 # with a specific item for each biblionumber.
180 #
181 #
182 if ( $query->param('place_reserve') ) {
183     my $reserve_cnt = 0;
184     if ($maxreserves) {
185         $reserve_cnt = $patron->holds->count;
186     }
187
188     # List is composed of alternating biblio/item/branch
189     my $selectedItems = $query->param('selecteditems');
190
191     if ($query->param('reserve_mode') eq 'single') {
192         # This indicates non-JavaScript mode, so there was
193         # only a single biblio number selected.
194         my $bib = $query->param('single_bib');
195         my $item = $query->param("checkitem_$bib");
196         if ($item eq 'any') {
197             $item = '';
198         }
199         my $branch = $query->param('branch');
200         $selectedItems = "$bib/$item/$branch/";
201     }
202
203     $selectedItems =~ s!/$!!;
204     my @selectedItems = split /\//, $selectedItems, -1;
205
206     # Make sure there is a biblionum/itemnum/branch triplet for each item.
207     # The itemnum can be 'any', meaning next available.
208     my $selectionCount = @selectedItems;
209     if (($selectionCount == 0) || (($selectionCount % 3) != 0)) {
210         $template->param(message=>1, bad_data=>1);
211         output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
212         exit;
213     }
214
215     my @failed_holds;
216     while (@selectedItems) {
217         my $biblioNum = shift(@selectedItems);
218         my $itemNum   = shift(@selectedItems);
219         my $branch    = shift(@selectedItems);    # i.e., branch code, not name
220
221         my $canreserve = 0;
222
223         my $singleBranchMode = Koha::Libraries->search->count == 1;
224         if ( $singleBranchMode || ! C4::Context->preference("OPACAllowUserToChooseBranch") )
225         {    # single branch mode or disabled user choosing
226             $branch = $patron->branchcode;
227         }
228
229         # FIXME We shouldn't need to fetch the item here
230         my $item = $itemNum ? Koha::Items->find( $itemNum ) : undef;
231         # When choosing a specific item, the default pickup library should be dictated by the default hold policy
232         if ( ! C4::Context->preference("OPACAllowUserToChooseBranch") && $item ) {
233             my $type = $item->effective_itemtype;
234             my $rule = GetBranchItemRule( $patron->branchcode, $type );
235
236             if ( $rule->{hold_fulfillment_policy} eq 'any' || $rule->{hold_fulfillment_policy} eq 'patrongroup' ) {
237                 $branch = $patron->branchcode;
238             } elsif ( $rule->{hold_fulfillment_policy} eq 'holdgroup' ){
239                 $branch = $item->homebranch;
240             } else {
241                 my $policy = $rule->{hold_fulfillment_policy};
242                 $branch = $item->$policy;
243             }
244         }
245
246         # if we have an item, we are placing the hold on the item's bib, in case of analytics
247         if ( $item ) {
248             $biblioNum = $item->biblionumber;
249         }
250
251         # Check for user supplied reserve date
252         my $startdate;
253         if (   C4::Context->preference('AllowHoldDateInFuture')
254             && C4::Context->preference('OPACAllowHoldDateInFuture') )
255         {
256             $startdate = $query->param("reserve_date_$biblioNum");
257         }
258
259         my $patron_expiration_date = $query->param("expiration_date_$biblioNum");
260
261         my $itemtype = $query->param('itemtype') || undef;
262         $itemtype = undef if $itemNum;
263
264         my $biblio = Koha::Biblios->find($biblioNum);
265         my $rank = $biblio->holds->search( { found => [ { "!=" => "W" }, undef ] } )->count + 1;
266         if ( $item ) {
267             my $status = CanItemBeReserved( $patron, $item, $branch )->{status};
268             if( $status eq 'OK' ){
269                 $canreserve = 1;
270             } else {
271                 push @failed_holds, $status;
272             }
273
274         }
275         else {
276             my $status = CanBookBeReserved( $borrowernumber, $biblioNum, $branch, { itemtype => $itemtype } )->{status};
277             if( $status eq 'OK'){
278                 $canreserve = 1;
279             } else {
280                 push @failed_holds, $status;
281             }
282
283             # Inserts a null into the 'itemnumber' field of 'reserves' table.
284             $itemNum = undef;
285         }
286         my $notes = $query->param('notes_'.$biblioNum)||'';
287         my $item_group_id = $query->param("item_group_id_$biblioNum") || undef;
288
289         if (   $maxreserves
290             && $reserve_cnt >= $maxreserves )
291         {
292             push @failed_holds, 'tooManyReserves';
293             $canreserve = 0;
294         }
295
296         unless ( $can_place_hold_if_available_at_pickup ) {
297             my $items_in_this_library = Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch });
298             my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count;
299             my $nb_of_items_unavailable = $items_in_this_library->search({ -or => { lost => { '!=' => 0 }, damaged => { '!=' => 0 }, } });
300             if ( $items_in_this_library->count > $nb_of_items_issued + $nb_of_items_unavailable ) {
301                 $canreserve = 0;
302                 push @failed_holds, 'items_available';
303             }
304         }
305
306         # Here we actually do the reserveration. Stage 3.
307         if ($canreserve) {
308             my $reserve_id = AddReserve(
309                 {
310                     branchcode       => $branch,
311                     borrowernumber   => $borrowernumber,
312                     biblionumber     => $biblioNum,
313                     priority         => $rank,
314                     reservation_date => $startdate,
315                     expiration_date  => $patron_expiration_date,
316                     notes            => $notes,
317                     title            => $biblio->title,
318                     itemnumber       => $itemNum,
319                     found            => undef,
320                     itemtype         => $itemtype,
321                     item_group_id    => $item_group_id,
322                 }
323             );
324             if( $reserve_id ){
325                 ++$reserve_cnt;
326             } else {
327                 push @failed_holds, 'not_placed';
328             }
329         }
330     }
331
332     print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( @failed_holds ? "failed_holds=" . join('|',@failed_holds) : q|| ) . "#opac-user-holds");
333     exit;
334 }
335
336 #
337 #
338 # Build hashes of the requested biblio(item)s and items.
339 #
340 #
341
342 my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record.
343 foreach my $biblioNumber (@biblionumbers) {
344
345     my $biblioData = GetBiblioData($biblioNumber);
346     $biblioDataHash{$biblioNumber} = $biblioData;
347
348     my $biblio = Koha::Biblios->find( $biblioNumber );
349     next unless $biblio;
350
351     my $items = Koha::Items->search_ordered(
352         [
353             'me.biblionumber' => $biblioNumber,
354             'me.itemnumber' => {
355                 -in => [
356                     $biblio->host_items->get_column('itemnumber')
357                 ]
358             }
359         ],
360         { prefetch => [ 'issue', 'homebranch', 'holdingbranch' ] }
361     )->filter_by_visible_in_opac({ patron => $patron });
362
363     $biblioData->{items} = [$items->as_list]; # FIXME Potentially a lot in memory here!
364
365     # Compute the priority rank.
366     $biblioData->{object} = $biblio;
367     my $reservecount = $biblio->holds->search({ found => [ {"!=" => "W"},undef] })->count;
368     $biblioData->{reservecount} = $reservecount;
369     $biblioData->{rank} = $reservecount + 1;
370 }
371
372
373 my $requested_reserves_count = scalar( @biblionumbers );
374 if ( $maxreserves && ( $reserves_count + $requested_reserves_count > $maxreserves ) ) {
375     $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
376 }
377
378 $template->param( select_item_types => 1 );
379
380
381 #
382 #
383 # Build the template parameters that will show the info
384 # and items for each biblionumber.
385 #
386 #
387
388 my $biblioLoop = [];
389 my $numBibsAvailable = 0;
390 my $itemdata_enumchron = 0;
391 my $itemdata_ccode = 0;
392 my $anyholdable = 0;
393 my $itemLevelTypes = C4::Context->preference('item-level_itypes');
394 my $pickup_locations = Koha::Libraries->search({ pickup_location => 1 });
395 $template->param('item_level_itypes' => $itemLevelTypes);
396
397 my $patron_unblessed = $patron->unblessed;
398 foreach my $biblioNum (@biblionumbers) {
399
400     # Init the bib item with the choices for branch pickup
401     my %biblioLoopIter;
402
403     # Get relevant biblio data.
404     my $biblioData = $biblioDataHash{$biblioNum};
405     if (! $biblioData) {
406         $template->param(message=>1, bad_biblionumber=>$biblioNum);
407         output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };
408         exit;
409     }
410
411     my @not_available_at = ();
412     my $biblio = $biblioData->{object};
413     foreach my $library ( $pickup_locations->as_list ) {
414         push( @not_available_at, $library->branchcode ) unless $biblio->can_be_transferred({ to => $library });
415     }
416
417     my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} );
418     $biblioLoopIter{biblionumber} = $biblioData->{biblionumber};
419     $biblioLoopIter{title} = $biblioData->{title};
420     $biblioLoopIter{subtitle} = $biblioData->{'subtitle'};
421     $biblioLoopIter{medium} = $biblioData->{medium};
422     $biblioLoopIter{part_number} = $biblioData->{part_number};
423     $biblioLoopIter{part_name} = $biblioData->{part_name};
424     $biblioLoopIter{author} = $biblioData->{author};
425     $biblioLoopIter{rank} = $biblioData->{rank};
426     $biblioLoopIter{reservecount} = $biblioData->{reservecount};
427     $biblioLoopIter{already_reserved} = $biblioData->{already_reserved};
428     $biblioLoopIter{object} = $biblio;
429
430     if (!$itemLevelTypes && $biblioData->{itemtype}) {
431         $biblioLoopIter{translated_description} = $itemtypes->{$biblioData->{itemtype}}{translated_description};
432         $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$biblioData->{itemtype}}{imageurl};
433     }
434
435
436
437     $biblioLoopIter{itemLoop} = [];
438     my $numCopiesAvailable = 0;
439     my $numCopiesOPACAvailable = 0;
440     # iterating through all items first to check if any of them available
441     # to pass this value further inside down to IsAvailableForItemLevelRequest to
442     # it's complicated logic to analyse.
443     # (before this loop was inside that sub loop so it was O(n^2) )
444     my $items_any_available;
445     $items_any_available = ItemsAnyAvailableAndNotRestricted( { biblionumber => $biblioNum, patron => $patron }) if $patron;
446     foreach my $item (@{$biblioData->{items}}) {
447
448         my $item_info = $item->unblessed;
449         $item_info->{holding_branch} = $item->holding_branch;
450         $item_info->{home_branch}    = $item->home_branch;
451         if ($itemLevelTypes) {
452             my $itemtype = $item->itemtype;
453             $item_info->{'imageurl'} = getitemtypeimagelocation( 'opac',
454                 $itemtypes->{ $itemtype->itemtype }->{'imageurl'} );
455             $item_info->{'translated_description'} =
456               $itemtypes->{ $itemtype->itemtype }->{translated_description};
457         }
458
459         # checking for holds
460         my $holds = $item->current_holds;
461         if ( my $first_hold = $holds->next ) {
462             $item_info->{first_hold} = $first_hold;
463         }
464
465         $item_info->{checkout} = $item->checkout;
466
467         # Check of the transferred documents
468         my $transfer = $item->get_transfer;
469         if ( $transfer && $transfer->in_transit ) {
470             $item_info->{transfertwhen} = $transfer->datesent;
471             $item_info->{transfertfrom} = $transfer->frombranch;
472             $item_info->{transfertto} = $transfer->tobranch;
473             $item_info->{nocancel} = 1;
474         }
475
476         # if the items belongs to a host record, show link to host record
477         if ( $item_info->{biblionumber} ne $biblioNum ) {
478             $item_info->{hostbiblionumber} = $item->biblionumber;
479             $item_info->{hosttitle}        = Koha::Biblios->find( $item_info->{biblionumber} )->title;
480         }
481
482         my $branch = GetReservesControlBranch( $item_info, $patron_unblessed );
483
484         # items_any_available defined outside of the current loop,
485         # so we avoiding loop inside IsAvailableForItemLevelRequest:
486         my $policy_holdallowed =
487             CanItemBeReserved( $patron, $item )->{status} eq 'OK' &&
488             IsAvailableForItemLevelRequest($item, $patron, undef, $items_any_available);
489
490         if ($policy_holdallowed) {
491             my $opac_hold_policy = Koha::CirculationRules->get_opacitemholds_policy( { item => $item, patron => $patron } );
492             if ( $opac_hold_policy ne 'N' ) { # If Y or F
493                 $item_info->{available} = 1;
494                 $numCopiesOPACAvailable++;
495                 $biblioLoopIter{force_hold} = 1 if $opac_hold_policy eq 'F';
496             }
497             $numCopiesAvailable++;
498
499             unless ( $can_place_hold_if_available_at_pickup ) {
500                 my $items_in_this_library = Koha::Items->search({ biblionumber => $item->biblionumber, holdingbranch => $item->holdingbranch });
501                 my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count;
502                 if ( $items_in_this_library->count > $nb_of_items_issued ) {
503                     push @not_available_at, $item->holdingbranch;
504                 }
505             }
506         }
507
508         # Show serial enumeration when needed
509         if ($item_info->{enumchron}) {
510             $itemdata_enumchron = 1;
511         }
512         # Show collection when needed
513         if ($item_info->{ccode}) {
514             $itemdata_ccode = 1;
515         }
516
517         push @{$biblioLoopIter{itemLoop}}, $item_info;
518     }
519     $template->param(
520         itemdata_enumchron => $itemdata_enumchron,
521         itemdata_ccode     => $itemdata_ccode,
522     );
523
524     if ($numCopiesAvailable > 0) {
525         $numBibsAvailable++;
526         $biblioLoopIter{bib_available} = 1;
527         $biblioLoopIter{holdable} = 1;
528         $biblioLoopIter{itemholdable} = 1 if $numCopiesOPACAvailable;
529     }
530     if ($biblioLoopIter{already_reserved}) {
531         $biblioLoopIter{holdable} = undef;
532         $biblioLoopIter{itemholdable} = undef;
533     }
534     if ( $biblioLoopIter{holdable} ) {
535         @not_available_at = uniq @not_available_at;
536         $biblioLoopIter{not_available_at} = \@not_available_at ;
537     }
538
539     unless ( $can_place_hold_if_available_at_pickup ) {
540         @not_available_at = uniq @not_available_at;
541         $biblioLoopIter{not_available_at} = \@not_available_at ;
542         # The record is not holdable is not available at any of the libraries
543         if ( Koha::Libraries->search->count == @not_available_at ) {
544             $biblioLoopIter{holdable} = 0;
545         }
546     }
547
548     my $status = CanBookBeReserved( $borrowernumber, $biblioNum )->{status};
549     $biblioLoopIter{holdable} &&= $status eq 'OK';
550     $biblioLoopIter{$status} = 1;
551
552     if ( $biblioLoopIter{holdable} and C4::Context->preference('AllowHoldItemTypeSelection') ) {
553         # build the allowed item types loop
554         my $rs = $biblio->items->search_ordered(
555             undef,
556             {   select => [ { distinct => 'itype' } ],
557                 as     => 'item_type'
558             }
559         );
560
561         my @item_types =
562           grep { CanBookBeReserved( $borrowernumber, $biblioNum, $branch, { itemtype => $_ } )->{status} eq 'OK' }
563           $rs->get_column('item_type');
564
565         $biblioLoopIter{allowed_item_types} = \@item_types;
566     }
567
568     if ( $status eq 'recall' ) {
569         $biblioLoopIter{recall} = 1;
570     }
571
572     # For multiple holds per record, if a patron has previously placed a hold,
573     # the patron can only place more holds of the same type. That is, if the
574     # patron placed a record level hold, all the holds the patron places must
575     # be record level. If the patron placed an item level hold, all holds
576     # the patron places must be item level
577     my $forced_hold_level = Koha::Holds->search(
578         {
579             borrowernumber => $borrowernumber,
580             biblionumber   => $biblioNum,
581             found          => undef,
582         }
583     )->forced_hold_level();
584     if ($forced_hold_level) {
585         $biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
586         $biblioLoopIter{force_hold}   = 0 if $forced_hold_level eq 'item_group';
587         $biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
588         $biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'item_group';
589         $biblioLoopIter{forced_hold_level} = $forced_hold_level;
590     }
591
592     # Pass through any reserve charge
593     $biblioLoopIter{reserve_charge} = GetReserveFee( $patron->id, $biblioNum );
594
595     push @$biblioLoop, \%biblioLoopIter;
596
597     $anyholdable = 1 if $biblioLoopIter{holdable};
598 }
599
600 unless ($pickup_locations->count) {
601     $numBibsAvailable = 0;
602     $anyholdable = 0;
603     $template->param(
604         message => 1,
605         no_pickup_locations => 1
606     );
607 }
608
609 if ( $numBibsAvailable == 0 || $anyholdable == 0) {
610     $template->param( none_available => 1 );
611 }
612
613 if (scalar @biblionumbers > 1) {
614     $template->param( multi_hold => 1);
615 }
616
617 my $show_notes=C4::Context->preference('OpacHoldNotes');
618 $template->param(OpacHoldNotes=>$show_notes);
619
620 # display infos
621 $template->param(bibitemloop => $biblioLoop);
622 # can set reserve date in future
623 if (
624     C4::Context->preference( 'AllowHoldDateInFuture' ) &&
625     C4::Context->preference( 'OPACAllowHoldDateInFuture' )
626     ) {
627     $template->param(
628             reserve_in_future         => 1,
629     );
630 }
631
632 output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };