Bug 17453: Inter-site holds improvement
[koha.git] / opac / opac-reserve.pl
1 #!/usr/bin/perl
2
3 # Copyright Katipo Communications 2002
4 # Copyright Koha Development team 2012
5 #
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20
21 use Modern::Perl;
22
23 use CGI qw ( -utf8 );
24 use C4::Auth;    # checkauth, getborrowernumber.
25 use C4::Koha;
26 use C4::Circulation;
27 use C4::Reserves;
28 use C4::Biblio;
29 use C4::Items;
30 use C4::Output;
31 use C4::Context;
32 use C4::Members;
33 use C4::Overdues;
34 use C4::Debug;
35 use Koha::DateUtils;
36 use Koha::Libraries;
37 use Koha::Patrons;
38 use Date::Calc qw/Today Date_to_Days/;
39 use List::MoreUtils qw/uniq/;
40
41 my $maxreserves = C4::Context->preference("maxreserves");
42
43 my $query = new CGI;
44
45 # if RequestOnOpac (for placing holds) is disabled, leave immediately
46 if ( ! C4::Context->preference('RequestOnOpac') ) {
47     print $query->redirect("/cgi-bin/koha/errors/404.pl");
48     exit;
49 }
50
51 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
52     {
53         template_name   => "opac-reserve.tt",
54         query           => $query,
55         type            => "opac",
56         authnotrequired => 0,
57         debug           => 1,
58     }
59 );
60
61 my ($show_holds_count, $show_priority);
62 for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
63     m/holds/o and $show_holds_count = 1;
64     m/priority/ and $show_priority = 1;
65 }
66
67 sub get_out {
68         output_html_with_http_headers(shift,shift,shift); # $query, $cookie, $template->output;
69         exit;
70 }
71
72 # get borrower information ....
73 my ( $borr ) = GetMember( borrowernumber => $borrowernumber );
74 my $patron = Koha::Patrons->find( $borrowernumber );
75
76 # check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
77 if ( $patron->category->effective_BlockExpiredPatronOpacActions ) {
78
79     if ( $patron->is_expired ) {
80
81         # cannot reserve, their card has expired and the rules set mean this is not allowed
82         $template->param( message => 1, expired_patron => 1 );
83         get_out( $query, $cookie, $template->output );
84     }
85 }
86
87 # Pass through any reserve charge
88 my $reservefee = $patron->category->reservefee;
89 if ( $reservefee > 0){
90     $template->param( RESERVE_CHARGE => sprintf("%.2f",$reservefee));
91 }
92
93 my $itemTypes = GetItemTypes();
94
95 # There are two ways of calling this script, with a single biblio num
96 # or multiple biblio nums.
97 my $biblionumbers = $query->param('biblionumbers');
98 my $reserveMode = $query->param('reserve_mode');
99 if ($reserveMode && ($reserveMode eq 'single')) {
100     my $bib = $query->param('single_bib');
101     $biblionumbers = "$bib/";
102 }
103 if (! $biblionumbers) {
104     $biblionumbers = $query->param('biblionumber');
105 }
106
107 if ((! $biblionumbers) && (! $query->param('place_reserve'))) {
108     $template->param(message=>1, no_biblionumber=>1);
109     &get_out($query, $cookie, $template->output);
110 }
111
112 # Pass the numbers to the page so they can be fed back
113 # when the hold is confirmed. TODO: Not necessary?
114 $template->param( biblionumbers => $biblionumbers );
115
116 # Each biblio number is suffixed with '/', e.g. "1/2/3/"
117 my @biblionumbers = split /\//, $biblionumbers;
118 if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) {
119     # TODO: New message?
120     $template->param(message=>1, no_biblionumber=>1);
121     &get_out($query, $cookie, $template->output);
122 }
123
124
125 # pass the pickup branch along....
126 my $branch = $query->param('branch') || $borr->{'branchcode'} || C4::Context->userenv->{branch} || '' ;
127 $template->param( branch => $branch );
128
129 # Is the person allowed to choose their branch
130 my $OPACChooseBranch = (C4::Context->preference("OPACAllowUserToChooseBranch")) ? 1 : 0;
131
132 $template->param( choose_branch => $OPACChooseBranch);
133
134 #
135 #
136 # Build hashes of the requested biblio(item)s and items.
137 #
138 #
139
140 my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record.
141 my %itemInfoHash; # Hash of itemnumber to item info.
142 foreach my $biblioNumber (@biblionumbers) {
143
144     my $biblioData = GetBiblioData($biblioNumber);
145     $biblioDataHash{$biblioNumber} = $biblioData;
146
147     my @itemInfos = GetItemsInfo($biblioNumber);
148
149     my $marcrecord= GetMarcBiblio($biblioNumber);
150
151     # flag indicating existence of at least one item linked via a host record
152     my $hostitemsflag;
153     # adding items linked via host biblios
154     my @hostitemInfos = GetHostItemsInfo($marcrecord);
155     if (@hostitemInfos){
156         $hostitemsflag =1;
157         push (@itemInfos,@hostitemInfos);
158     }
159
160     $biblioData->{itemInfos} = \@itemInfos;
161     foreach my $itemInfo (@itemInfos) {
162         $itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo;
163     }
164
165     # Compute the priority rank.
166     my $reserves = GetReservesFromBiblionumber({ biblionumber => $biblioNumber, all_dates => 1 });
167     my $rank = scalar( @$reserves );
168     $biblioData->{reservecount} = 1;    # new reserve
169     foreach my $res (@{$reserves}) {
170         my $found = $res->{found};
171         if ( $found && $found eq 'W' ) {
172             $rank--;
173         }
174         else {
175             $biblioData->{reservecount}++;
176         }
177     }
178     $biblioData->{rank} = $rank + 1;
179 }
180
181 #
182 #
183 # If this is the second time through this script, it
184 # means we are carrying out the hold request, possibly
185 # with a specific item for each biblionumber.
186 #
187 #
188 if ( $query->param('place_reserve') ) {
189     my $reserve_cnt = 0;
190     if ($maxreserves) {
191         $reserve_cnt = GetReservesFromBorrowernumber( $borrowernumber );
192     }
193
194     # List is composed of alternating biblio/item/branch
195     my $selectedItems = $query->param('selecteditems');
196
197     if ($query->param('reserve_mode') eq 'single') {
198         # This indicates non-JavaScript mode, so there was
199         # only a single biblio number selected.
200         my $bib = $query->param('single_bib');
201         my $item = $query->param("checkitem_$bib");
202         if ($item eq 'any') {
203             $item = '';
204         }
205         my $branch = $query->param('branch');
206         $selectedItems = "$bib/$item/$branch/";
207     }
208
209     $selectedItems =~ s!/$!!;
210     my @selectedItems = split /\//, $selectedItems, -1;
211
212     # Make sure there is a biblionum/itemnum/branch triplet for each item.
213     # The itemnum can be 'any', meaning next available.
214     my $selectionCount = @selectedItems;
215     if (($selectionCount == 0) || (($selectionCount % 3) != 0)) {
216         $template->param(message=>1, bad_data=>1);
217         &get_out($query, $cookie, $template->output);
218     }
219
220     my $failed_holds = 0;
221     while (@selectedItems) {
222         my $biblioNum = shift(@selectedItems);
223         my $itemNum   = shift(@selectedItems);
224         my $branch    = shift(@selectedItems);    # i.e., branch code, not name
225
226         my $canreserve = 0;
227
228         my $singleBranchMode = Koha::Libraries->search->count == 1;
229         if ( $singleBranchMode || !$OPACChooseBranch )
230         {    # single branch mode or disabled user choosing
231             $branch = $borr->{'branchcode'};
232         }
233
234 #item may belong to a host biblio, if yes change biblioNum to hosts bilbionumber
235         if ( $itemNum ne '' ) {
236             my $hostbiblioNum = GetBiblionumberFromItemnumber($itemNum);
237             if ( $hostbiblioNum ne $biblioNum ) {
238                 $biblioNum = $hostbiblioNum;
239             }
240         }
241
242         my $biblioData = $biblioDataHash{$biblioNum};
243         my $found;
244
245         # Check for user supplied reserve date
246         my $startdate;
247         if (   C4::Context->preference('AllowHoldDateInFuture')
248             && C4::Context->preference('OPACAllowHoldDateInFuture') )
249         {
250             $startdate = $query->param("reserve_date_$biblioNum");
251         }
252
253         my $expiration_date = $query->param("expiration_date_$biblioNum");
254
255       # If a specific item was selected and the pickup branch is the same as the
256       # holdingbranch, force the value $rank and $found.
257         my $rank = $biblioData->{rank};
258         if ( $itemNum ne '' ) {
259             $canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum ) eq 'OK';
260             $rank = '0' unless C4::Context->preference('ReservesNeedReturns');
261             my $item = GetItem($itemNum);
262             if ( $item->{'holdingbranch'} eq $branch ) {
263                 $found = 'W'
264                   unless C4::Context->preference('ReservesNeedReturns');
265             }
266         }
267         else {
268             $canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum ) eq 'OK';
269
270             # Inserts a null into the 'itemnumber' field of 'reserves' table.
271             $itemNum = undef;
272         }
273         my $notes = $query->param('notes_'.$biblioNum)||'';
274
275         if (   $maxreserves
276             && $reserve_cnt >= $maxreserves )
277         {
278             $canreserve = 0;
279         }
280
281         unless ( C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
282             $canreserve = 0 if Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch })->count;
283         }
284
285         my $itemtype = $query->param('itemtype') || undef;
286         $itemtype = undef if $itemNum;
287
288         # Here we actually do the reserveration. Stage 3.
289         if ($canreserve) {
290             my $reserve_id = AddReserve(
291                 $branch,          $borrowernumber, $biblioNum,
292                 [$biblioNum],     $rank,           $startdate,
293                 $expiration_date, $notes,          $biblioData->{title},
294                 $itemNum,         $found,          $itemtype,
295             );
296             $failed_holds++ unless $reserve_id;
297             ++$reserve_cnt;
298         }
299     }
300
301     print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds");
302     exit;
303 }
304
305 #
306 #
307 # Here we check that the borrower can actually make reserves Stage 1.
308 #
309 #
310 my $noreserves     = 0;
311 my $maxoutstanding = C4::Context->preference("maxoutstanding");
312 $template->param( noreserve => 1 ) unless $maxoutstanding;
313 my ( $amountoutstanding ) = GetMemberAccountRecords($borrowernumber);
314 if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
315     my $amount = sprintf "%.02f", $amountoutstanding;
316     $template->param( message => 1 );
317     $noreserves = 1;
318     $template->param( too_much_oweing => $amount );
319 }
320
321 if ( $borr->{gonenoaddress} && ($borr->{gonenoaddress} == 1) ) {
322     $noreserves = 1;
323     $template->param(
324         message => 1,
325         GNA     => 1
326     );
327 }
328
329 if ( $borr->{lost} && ($borr->{lost} == 1) ) {
330     $noreserves = 1;
331     $template->param(
332         message => 1,
333         lost    => 1
334     );
335 }
336
337 if ( Koha::Patrons->find( $borrowernumber )->is_debarred ) {
338     $noreserves = 1;
339     $template->param(
340         message          => 1,
341         debarred         => 1,
342         debarred_comment => $borr->{debarredcomment},
343         debarred_date    => $borr->{debarred},
344     );
345 }
346
347 my @reserves = GetReservesFromBorrowernumber( $borrowernumber );
348 my $reserves_count = scalar(@reserves);
349 $template->param( RESERVES => \@reserves );
350 if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
351     $template->param( message => 1 );
352     $noreserves = 1;
353     $template->param( too_many_reserves => scalar(@reserves));
354 }
355
356 unless ( $noreserves ) {
357     my $requested_reserves_count = scalar( @biblionumbers );
358     if ( $maxreserves && ( $reserves_count + $requested_reserves_count > $maxreserves ) ) {
359         $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
360     }
361 }
362
363 unless ($noreserves) {
364     $template->param( select_item_types => 1 );
365 }
366
367
368 #
369 #
370 # Build the template parameters that will show the info
371 # and items for each biblionumber.
372 #
373 #
374 my $notforloan_label_of = get_notforloan_label_of();
375
376 my $biblioLoop = [];
377 my $numBibsAvailable = 0;
378 my $itemdata_enumchron = 0;
379 my $anyholdable = 0;
380 my $itemLevelTypes = C4::Context->preference('item-level_itypes');
381 $template->param('item_level_itypes' => $itemLevelTypes);
382
383 foreach my $biblioNum (@biblionumbers) {
384
385     my @not_available_at = ();
386     my $record = GetMarcBiblio($biblioNum);
387     # Init the bib item with the choices for branch pickup
388     my %biblioLoopIter;
389
390     # Get relevant biblio data.
391     my $biblioData = $biblioDataHash{$biblioNum};
392     if (! $biblioData) {
393         $template->param(message=>1, bad_biblionumber=>$biblioNum);
394         &get_out($query, $cookie, $template->output);
395     }
396
397     $biblioLoopIter{biblionumber} = $biblioData->{biblionumber};
398     $biblioLoopIter{title} = $biblioData->{title};
399     $biblioLoopIter{subtitle} = GetRecordValue('subtitle', $record, GetFrameworkCode($biblioData->{biblionumber}));
400     $biblioLoopIter{author} = $biblioData->{author};
401     $biblioLoopIter{rank} = $biblioData->{rank};
402     $biblioLoopIter{reservecount} = $biblioData->{reservecount};
403     $biblioLoopIter{already_reserved} = $biblioData->{already_reserved};
404     $biblioLoopIter{mandatorynotes}=0; #FIXME: For future use
405
406     if (!$itemLevelTypes && $biblioData->{itemtype}) {
407         $biblioLoopIter{translated_description} = $itemTypes->{$biblioData->{itemtype}}{translated_description};
408         $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemTypes->{$biblioData->{itemtype}}{imageurl};
409     }
410
411     foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
412         if ($itemLevelTypes && $itemInfo->{itype}) {
413             $itemInfo->{translated_description} = $itemTypes->{$itemInfo->{itype}}{translated_description};
414             $itemInfo->{imageurl} = getitemtypeimagesrc() . "/". $itemTypes->{$itemInfo->{itype}}{imageurl};
415         }
416
417         if (!$itemInfo->{'notforloan'} && !($itemInfo->{'itemnotforloan'} > 0)) {
418             $biblioLoopIter{forloan} = 1;
419         }
420     }
421
422     $biblioLoopIter{itemLoop} = [];
423     my $numCopiesAvailable = 0;
424     my $numCopiesOPACAvailable = 0;
425     foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
426         my $itemNum = $itemInfo->{itemnumber};
427         my $itemLoopIter = {};
428
429         $itemLoopIter->{itemnumber} = $itemNum;
430         $itemLoopIter->{barcode} = $itemInfo->{barcode};
431         $itemLoopIter->{homeBranchName} = $itemInfo->{homebranch};
432         $itemLoopIter->{callNumber} = $itemInfo->{itemcallnumber};
433         $itemLoopIter->{enumchron} = $itemInfo->{enumchron};
434         $itemLoopIter->{copynumber} = $itemInfo->{copynumber};
435         if ($itemLevelTypes) {
436             $itemLoopIter->{translated_description} = $itemInfo->{translated_description};
437             $itemLoopIter->{itype} = $itemInfo->{itype};
438             $itemLoopIter->{imageurl} = $itemInfo->{imageurl};
439         }
440
441         # If the holdingbranch is different than the homebranch, we show the
442         # holdingbranch of the document too.
443         if ( $itemInfo->{homebranch} ne $itemInfo->{holdingbranch} ) {
444             $itemLoopIter->{holdingBranchName} = $itemInfo->{holdingbranch};
445         }
446
447         # If the item is currently on loan, we display its return date and
448         # change the background color.
449         my $issues= GetItemIssue($itemNum);
450         if ( $issues->{'date_due'} ) {
451             $itemLoopIter->{dateDue} = output_pref({ dt => dt_from_string($issues->{date_due}, 'sql'), as_due_date => 1 });
452             $itemLoopIter->{backgroundcolor} = 'onloan';
453         }
454
455         # checking reserve
456         my ($reservedate,$reservedfor,$expectedAt,undef,$wait) = GetReservesFromItemnumber($itemNum);
457         my $ItemBorrowerReserveInfo = GetMember( borrowernumber => $reservedfor );
458
459         # the item could be reserved for this borrower vi a host record, flag this
460         $reservedfor //= '';
461
462         if ( defined $reservedate ) {
463             $itemLoopIter->{backgroundcolor} = 'reserved';
464             $itemLoopIter->{reservedate}     = output_pref({ dt => dt_from_string($reservedate), dateonly => 1 });
465             $itemLoopIter->{ReservedForBorrowernumber} = $reservedfor;
466             $itemLoopIter->{ReservedForSurname}        = $ItemBorrowerReserveInfo->{'surname'};
467             $itemLoopIter->{ReservedForFirstname}      = $ItemBorrowerReserveInfo->{'firstname'};
468             $itemLoopIter->{ExpectedAtLibrary}         = $expectedAt;
469             #waiting status
470             $itemLoopIter->{waitingdate} = $wait;
471         }
472
473         $itemLoopIter->{notforloan} = $itemInfo->{notforloan};
474         $itemLoopIter->{itemnotforloan} = $itemInfo->{itemnotforloan};
475
476         # Management of the notforloan document
477         if ( $itemLoopIter->{notforloan} || $itemLoopIter->{itemnotforloan}) {
478             $itemLoopIter->{backgroundcolor} = 'other';
479             $itemLoopIter->{notforloanvalue} =
480               $notforloan_label_of->{ $itemLoopIter->{notforloan} };
481         }
482
483         # Management of lost or long overdue items
484         if ( $itemInfo->{itemlost} ) {
485
486             # FIXME localized strings should never be in Perl code
487             $itemLoopIter->{message} =
488                 $itemInfo->{itemlost} == 1 ? "(lost)"
489               : $itemInfo->{itemlost} == 2 ? "(long overdue)"
490               : "";
491             $itemInfo->{backgroundcolor} = 'other';
492         }
493
494         # Check of the transfered documents
495         my ( $transfertwhen, $transfertfrom, $transfertto ) =
496           GetTransfers($itemNum);
497         if ( $transfertwhen && ($transfertwhen ne '') ) {
498             $itemLoopIter->{transfertwhen} = output_pref({ dt => dt_from_string($transfertwhen), dateonly => 1 });
499             $itemLoopIter->{transfertfrom} = $transfertfrom;
500             $itemLoopIter->{transfertto} = $transfertto;
501             $itemLoopIter->{nocancel} = 1;
502         }
503
504         # if the items belongs to a host record, show link to host record
505         if ( $itemInfo->{biblionumber} ne $biblioNum ) {
506             $biblioLoopIter{hostitemsflag}    = 1;
507             $itemLoopIter->{hostbiblionumber} = $itemInfo->{biblionumber};
508             $itemLoopIter->{hosttitle}        = GetBiblioData( $itemInfo->{biblionumber} )->{title};
509         }
510
511         # If there is no loan, return and transfer, we show a checkbox.
512         $itemLoopIter->{notforloan} = $itemLoopIter->{notforloan} || 0;
513
514         my $branch = GetReservesControlBranch( $itemInfo, $borr );
515
516         my $policy_holdallowed = !$itemLoopIter->{already_reserved};
517         $policy_holdallowed &&=
518             IsAvailableForItemLevelRequest($itemInfo,$borr) &&
519             CanItemBeReserved($borrowernumber,$itemNum) eq 'OK';
520
521         if ($policy_holdallowed) {
522             if ( my $hold_allowed = OPACItemHoldsAllowed( $itemInfo, $borr ) ) {
523                 $itemLoopIter->{available} = 1;
524                 $numCopiesOPACAvailable++;
525                 $biblioLoopIter{force_hold} = 1 if $hold_allowed eq 'F';
526             }
527             $numCopiesAvailable++;
528
529             if ( not C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
530                 push @not_available_at, $itemInfo->{holdingbranch};
531             }
532         }
533
534         $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemTypes->{ $itemInfo->{itype} }{imageurl} );
535
536     # Show serial enumeration when needed
537         if ($itemLoopIter->{enumchron}) {
538             $itemdata_enumchron = 1;
539         }
540
541         push @{$biblioLoopIter{itemLoop}}, $itemLoopIter;
542     }
543     $template->param( itemdata_enumchron => $itemdata_enumchron );
544
545     if ($numCopiesAvailable > 0) {
546         $numBibsAvailable++;
547         $biblioLoopIter{bib_available} = 1;
548         $biblioLoopIter{holdable} = 1;
549         $biblioLoopIter{itemholdable} = 1 if $numCopiesOPACAvailable;
550     }
551     if ($biblioLoopIter{already_reserved}) {
552         $biblioLoopIter{holdable} = undef;
553         $biblioLoopIter{itemholdable} = undef;
554     }
555     if(not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowernumber,$biblioNum)) {
556         $biblioLoopIter{holdable} = undef;
557         $biblioLoopIter{already_patron_possession} = 1;
558     }
559
560     if ( $biblioLoopIter{holdable} ) {
561         @not_available_at = uniq @not_available_at;
562         $biblioLoopIter{not_available_at} = \@not_available_at ;
563     }
564
565     unless ( C4::Context->preference('OPACHoldsIfAvailableAtPickup') ) {
566         @not_available_at = uniq @not_available_at;
567         $biblioLoopIter{not_available_at} = \@not_available_at ;
568         # The record is not holdable is not available at any of the libraries
569         if ( Koha::Libraries->search->count == @not_available_at ) {
570             $biblioLoopIter{holdable} = 0;
571         }
572     }
573
574     $biblioLoopIter{holdable} &&= CanBookBeReserved($borrowernumber,$biblioNum) eq 'OK';
575
576     # For multiple holds per record, if a patron has previously placed a hold,
577     # the patron can only place more holds of the same type. That is, if the
578     # patron placed a record level hold, all the holds the patron places must
579     # be record level. If the patron placed an item level hold, all holds
580     # the patron places must be item level
581     my $forced_hold_level = Koha::Holds->search(
582         {
583             borrowernumber => $borrowernumber,
584             biblionumber   => $biblioNum,
585             found          => undef,
586         }
587     )->forced_hold_level();
588     if ($forced_hold_level) {
589         $biblioLoopIter{force_hold}   = 1 if $forced_hold_level eq 'item';
590         $biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
591     }
592
593
594     push @$biblioLoop, \%biblioLoopIter;
595
596     $anyholdable = 1 if $biblioLoopIter{holdable};
597 }
598
599
600 if ( $numBibsAvailable == 0 || $anyholdable == 0) {
601     $template->param( none_available => 1 );
602 }
603
604 my $show_notes=C4::Context->preference('OpacHoldNotes');
605 $template->param(OpacHoldNotes=>$show_notes);
606
607 # display infos
608 $template->param(bibitemloop => $biblioLoop);
609 # can set reserve date in future
610 if (
611     C4::Context->preference( 'AllowHoldDateInFuture' ) &&
612     C4::Context->preference( 'OPACAllowHoldDateInFuture' )
613     ) {
614     $template->param(
615             reserve_in_future         => 1,
616     );
617 }
618
619 output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };