Bug 22132: (QA follow-up) set_password now expects a hashref
[koha.git] / opac / opac-reserve.pl
blobaeb88ca0360e9c9754523b55f905db33d9e837a4
1 #!/usr/bin/perl
3 # Copyright Katipo Communications 2002
4 # Copyright Koha Development team 2012
6 # This file is part of Koha.
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.
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.
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>.
21 use Modern::Perl;
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;
36 use Koha::AuthorisedValues;
37 use Koha::Biblios;
38 use Koha::DateUtils;
39 use Koha::IssuingRules;
40 use Koha::Items;
41 use Koha::ItemTypes;
42 use Koha::Checkouts;
43 use Koha::Libraries;
44 use Koha::Patrons;
45 use Date::Calc qw/Today Date_to_Days/;
46 use List::MoreUtils qw/uniq/;
48 my $maxreserves = C4::Context->preference("maxreserves");
50 my $query = new CGI;
52 # if RequestOnOpac (for placing holds) is disabled, leave immediately
53 if ( ! C4::Context->preference('RequestOnOpac') ) {
54 print $query->redirect("/cgi-bin/koha/errors/404.pl");
55 exit;
58 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
60 template_name => "opac-reserve.tt",
61 query => $query,
62 type => "opac",
63 authnotrequired => 0,
64 debug => 1,
68 my ($show_holds_count, $show_priority);
69 for ( C4::Context->preference("OPACShowHoldQueueDetails") ) {
70 m/holds/o and $show_holds_count = 1;
71 m/priority/ and $show_priority = 1;
74 sub get_out {
75 output_html_with_http_headers(shift,shift,shift); # $query, $cookie, $template->output;
76 exit;
79 my $patron = Koha::Patrons->find( $borrowernumber );
81 my $can_place_hold_if_available_at_pickup = C4::Context->preference('OPACHoldsIfAvailableAtPickup');
82 unless ( $can_place_hold_if_available_at_pickup ) {
83 my @patron_categories = split '\|', C4::Context->preference('OPACHoldsIfAvailableAtPickupExceptions');
84 if ( @patron_categories ) {
85 my $categorycode = $patron->categorycode;
86 $can_place_hold_if_available_at_pickup = grep /^$categorycode$/, @patron_categories;
90 # check if this user can place a reserve, -1 means use sys pref, 0 means dont block, 1 means block
91 if ( $patron->category->effective_BlockExpiredPatronOpacActions ) {
93 if ( $patron->is_expired ) {
95 # cannot reserve, their card has expired and the rules set mean this is not allowed
96 $template->param( message => 1, expired_patron => 1 );
97 get_out( $query, $cookie, $template->output );
101 # Pass through any reserve charge
102 my $reservefee = $patron->category->reservefee;
103 if ( $reservefee > 0){
104 $template->param( RESERVE_CHARGE => $reservefee);
107 my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
109 # There are two ways of calling this script, with a single biblio num
110 # or multiple biblio nums.
111 my $biblionumbers = $query->param('biblionumbers');
112 my $reserveMode = $query->param('reserve_mode');
113 if ($reserveMode && ($reserveMode eq 'single')) {
114 my $bib = $query->param('single_bib');
115 $biblionumbers = "$bib/";
117 if (! $biblionumbers) {
118 $biblionumbers = $query->param('biblionumber');
121 if ((! $biblionumbers) && (! $query->param('place_reserve'))) {
122 $template->param(message=>1, no_biblionumber=>1);
123 &get_out($query, $cookie, $template->output);
126 # Pass the numbers to the page so they can be fed back
127 # when the hold is confirmed. TODO: Not necessary?
128 $template->param( biblionumbers => $biblionumbers );
130 # Each biblio number is suffixed with '/', e.g. "1/2/3/"
131 my @biblionumbers = split /\//, $biblionumbers;
132 if (($#biblionumbers < 0) && (! $query->param('place_reserve'))) {
133 # TODO: New message?
134 $template->param(message=>1, no_biblionumber=>1);
135 &get_out($query, $cookie, $template->output);
139 # pass the pickup branch along....
140 my $branch = $query->param('branch') || $patron->branchcode || C4::Context->userenv->{branch} || '' ;
141 $template->param( branch => $branch );
145 # Build hashes of the requested biblio(item)s and items.
149 my %biblioDataHash; # Hash of biblionumber to biblio/biblioitems record.
150 my %itemInfoHash; # Hash of itemnumber to item info.
151 foreach my $biblioNumber (@biblionumbers) {
153 my $biblioData = GetBiblioData($biblioNumber);
154 $biblioDataHash{$biblioNumber} = $biblioData;
156 my @itemInfos = GetItemsInfo($biblioNumber);
158 my $marcrecord= GetMarcBiblio({ biblionumber => $biblioNumber });
160 # flag indicating existence of at least one item linked via a host record
161 my $hostitemsflag;
162 # adding items linked via host biblios
163 my @hostitemInfos = GetHostItemsInfo($marcrecord);
164 if (@hostitemInfos){
165 $hostitemsflag =1;
166 push (@itemInfos,@hostitemInfos);
169 $biblioData->{itemInfos} = \@itemInfos;
170 foreach my $itemInfo (@itemInfos) {
171 $itemInfoHash{$itemInfo->{itemnumber}} = $itemInfo;
174 # Compute the priority rank.
175 my $biblio = Koha::Biblios->find( $biblioNumber );
176 $biblioData->{object} = $biblio;
177 my $holds = $biblio->holds;
178 my $rank = $holds->count;
179 $biblioData->{reservecount} = 1; # new reserve
180 while ( my $hold = $holds->next ) {
181 if ( $hold->is_waiting ) {
182 $rank--;
184 else {
185 $biblioData->{reservecount}++;
188 $biblioData->{rank} = $rank + 1;
193 # If this is the second time through this script, it
194 # means we are carrying out the hold request, possibly
195 # with a specific item for each biblionumber.
198 if ( $query->param('place_reserve') ) {
199 my $reserve_cnt = 0;
200 if ($maxreserves) {
201 $reserve_cnt = $patron->holds->count;
204 # List is composed of alternating biblio/item/branch
205 my $selectedItems = $query->param('selecteditems');
207 if ($query->param('reserve_mode') eq 'single') {
208 # This indicates non-JavaScript mode, so there was
209 # only a single biblio number selected.
210 my $bib = $query->param('single_bib');
211 my $item = $query->param("checkitem_$bib");
212 if ($item eq 'any') {
213 $item = '';
215 my $branch = $query->param('branch');
216 $selectedItems = "$bib/$item/$branch/";
219 $selectedItems =~ s!/$!!;
220 my @selectedItems = split /\//, $selectedItems, -1;
222 # Make sure there is a biblionum/itemnum/branch triplet for each item.
223 # The itemnum can be 'any', meaning next available.
224 my $selectionCount = @selectedItems;
225 if (($selectionCount == 0) || (($selectionCount % 3) != 0)) {
226 $template->param(message=>1, bad_data=>1);
227 &get_out($query, $cookie, $template->output);
230 my $failed_holds = 0;
231 while (@selectedItems) {
232 my $biblioNum = shift(@selectedItems);
233 my $itemNum = shift(@selectedItems);
234 my $branch = shift(@selectedItems); # i.e., branch code, not name
236 my $canreserve = 0;
238 my $singleBranchMode = Koha::Libraries->search->count == 1;
239 if ( $singleBranchMode || ! C4::Context->preference("OPACAllowUserToChooseBranch") )
240 { # single branch mode or disabled user choosing
241 $branch = $patron->branchcode;
244 #item may belong to a host biblio, if yes change biblioNum to hosts bilbionumber
245 if ( $itemNum ne '' ) {
246 my $item = Koha::Items->find( $itemNum );
247 my $hostbiblioNum = $item->biblio->biblionumber;
248 if ( $hostbiblioNum ne $biblioNum ) {
249 $biblioNum = $hostbiblioNum;
253 my $biblioData = $biblioDataHash{$biblioNum};
254 my $found;
256 # Check for user supplied reserve date
257 my $startdate;
258 if ( C4::Context->preference('AllowHoldDateInFuture')
259 && C4::Context->preference('OPACAllowHoldDateInFuture') )
261 $startdate = $query->param("reserve_date_$biblioNum");
264 my $expiration_date = $query->param("expiration_date_$biblioNum");
266 my $rank = $biblioData->{rank};
267 if ( $itemNum ne '' ) {
268 $canreserve = 1 if CanItemBeReserved( $borrowernumber, $itemNum )->{status} eq 'OK';
270 else {
271 $canreserve = 1 if CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'OK';
273 # Inserts a null into the 'itemnumber' field of 'reserves' table.
274 $itemNum = undef;
276 my $notes = $query->param('notes_'.$biblioNum)||'';
278 if ( $maxreserves
279 && $reserve_cnt >= $maxreserves )
281 $canreserve = 0;
284 unless ( $can_place_hold_if_available_at_pickup ) {
285 my $items_in_this_library = Koha::Items->search({ biblionumber => $biblioNum, holdingbranch => $branch });
286 my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count;
287 my $nb_of_items_unavailable = $items_in_this_library->search({ -or => { lost => { '!=' => 0 }, damaged => { '!=' => 0 }, } });
288 if ( $items_in_this_library->count > $nb_of_items_issued + $nb_of_items_unavailable ) {
289 $canreserve = 0
293 my $itemtype = $query->param('itemtype') || undef;
294 $itemtype = undef if $itemNum;
296 # Here we actually do the reserveration. Stage 3.
297 if ($canreserve) {
298 my $reserve_id = AddReserve(
299 $branch, $borrowernumber, $biblioNum,
300 [$biblioNum], $rank, $startdate,
301 $expiration_date, $notes, $biblioData->{title},
302 $itemNum, $found, $itemtype,
304 $failed_holds++ unless $reserve_id;
305 ++$reserve_cnt;
309 print $query->redirect("/cgi-bin/koha/opac-user.pl?" . ( $failed_holds ? "failed_holds=$failed_holds" : q|| ) . "#opac-user-holds");
310 exit;
315 # Here we check that the borrower can actually make reserves Stage 1.
318 my $noreserves = 0;
319 my $maxoutstanding = C4::Context->preference("maxoutstanding");
320 $template->param( noreserve => 1 ) unless $maxoutstanding;
321 my $amountoutstanding = $patron->account->balance;
322 if ( $amountoutstanding && ($amountoutstanding > $maxoutstanding) ) {
323 my $amount = sprintf "%.02f", $amountoutstanding;
324 $template->param( message => 1 );
325 $noreserves = 1;
326 $template->param( too_much_oweing => $amount );
329 if ( $patron->gonenoaddress && ($patron->gonenoaddress == 1) ) {
330 $noreserves = 1;
331 $template->param(
332 message => 1,
333 GNA => 1
337 if ( $patron->lost && ($patron->lost == 1) ) {
338 $noreserves = 1;
339 $template->param(
340 message => 1,
341 lost => 1
345 if ( $patron->is_debarred ) {
346 $noreserves = 1;
347 $template->param(
348 message => 1,
349 debarred => 1,
350 debarred_comment => $patron->debarredcomment,
351 debarred_date => $patron->debarred,
355 my $holds = $patron->holds;
356 my $reserves_count = $holds->count;
357 $template->param( RESERVES => $holds->unblessed );
358 if ( $maxreserves && ( $reserves_count >= $maxreserves ) ) {
359 $template->param( message => 1 );
360 $noreserves = 1;
361 $template->param( too_many_reserves => $holds->count );
364 unless ( $noreserves ) {
365 my $requested_reserves_count = scalar( @biblionumbers );
366 if ( $maxreserves && ( $reserves_count + $requested_reserves_count > $maxreserves ) ) {
367 $template->param( new_reserves_allowed => $maxreserves - $reserves_count );
371 unless ($noreserves) {
372 $template->param( select_item_types => 1 );
378 # Build the template parameters that will show the info
379 # and items for each biblionumber.
383 my $biblioLoop = [];
384 my $numBibsAvailable = 0;
385 my $itemdata_enumchron = 0;
386 my $itemdata_ccode = 0;
387 my $anyholdable = 0;
388 my $itemLevelTypes = C4::Context->preference('item-level_itypes');
389 my $pickup_locations = Koha::Libraries->search({ pickup_location => 1 });
390 $template->param('item_level_itypes' => $itemLevelTypes);
392 foreach my $biblioNum (@biblionumbers) {
394 my $record = GetMarcBiblio({ biblionumber => $biblioNum });
395 # Init the bib item with the choices for branch pickup
396 my %biblioLoopIter;
398 # Get relevant biblio data.
399 my $biblioData = $biblioDataHash{$biblioNum};
400 if (! $biblioData) {
401 $template->param(message=>1, bad_biblionumber=>$biblioNum);
402 &get_out($query, $cookie, $template->output);
405 my @not_available_at = ();
406 my $biblio = $biblioData->{object};
407 foreach my $library ( $pickup_locations->as_list ) {
408 push( @not_available_at, $library->branchcode ) unless $biblio->can_be_transferred({ to => $library });
411 my $frameworkcode = GetFrameworkCode( $biblioData->{biblionumber} );
412 $biblioLoopIter{biblionumber} = $biblioData->{biblionumber};
413 $biblioLoopIter{title} = $biblioData->{title};
414 $biblioLoopIter{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode);
415 $biblioLoopIter{author} = $biblioData->{author};
416 $biblioLoopIter{rank} = $biblioData->{rank};
417 $biblioLoopIter{reservecount} = $biblioData->{reservecount};
418 $biblioLoopIter{already_reserved} = $biblioData->{already_reserved};
419 $biblioLoopIter{reqholdnotes}=0; #TODO: For future use
421 if (!$itemLevelTypes && $biblioData->{itemtype}) {
422 $biblioLoopIter{translated_description} = $itemtypes->{$biblioData->{itemtype}}{translated_description};
423 $biblioLoopIter{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$biblioData->{itemtype}}{imageurl};
426 foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
427 if ($itemLevelTypes && $itemInfo->{itype}) {
428 $itemInfo->{translated_description} = $itemtypes->{$itemInfo->{itype}}{translated_description};
429 $itemInfo->{imageurl} = getitemtypeimagesrc() . "/". $itemtypes->{$itemInfo->{itype}}{imageurl};
432 if (!$itemInfo->{'notforloan'} && !($itemInfo->{'itemnotforloan'} > 0)) {
433 $biblioLoopIter{forloan} = 1;
437 my @notforloan_avs = Koha::AuthorisedValues->search_by_koha_field({ kohafield => 'items.notforloan', frameworkcode => $frameworkcode });
438 my $notforloan_label_of = { map { $_->authorised_value => $_->opac_description } @notforloan_avs };
440 $biblioLoopIter{itemLoop} = [];
441 my $numCopiesAvailable = 0;
442 my $numCopiesOPACAvailable = 0;
443 foreach my $itemInfo (@{$biblioData->{itemInfos}}) {
444 my $itemNum = $itemInfo->{itemnumber};
445 my $item = Koha::Items->find( $itemNum );
446 my $itemLoopIter = {};
448 $itemLoopIter->{itemnumber} = $itemNum;
449 $itemLoopIter->{barcode} = $itemInfo->{barcode};
450 $itemLoopIter->{homeBranchName} = $itemInfo->{homebranch};
451 $itemLoopIter->{callNumber} = $itemInfo->{itemcallnumber};
452 $itemLoopIter->{enumchron} = $itemInfo->{enumchron};
453 $itemLoopIter->{ccode} = $itemInfo->{ccode};
454 $itemLoopIter->{copynumber} = $itemInfo->{copynumber};
455 if ($itemLevelTypes) {
456 $itemLoopIter->{translated_description} = $itemInfo->{translated_description};
457 $itemLoopIter->{itype} = $itemInfo->{itype};
458 $itemLoopIter->{imageurl} = $itemInfo->{imageurl};
461 # If the holdingbranch is different than the homebranch, we show the
462 # holdingbranch of the document too.
463 if ( $itemInfo->{homebranch} ne $itemInfo->{holdingbranch} ) {
464 $itemLoopIter->{holdingBranchName} = $itemInfo->{holdingbranch};
467 # If the item is currently on loan, we display its return date and
468 # change the background color.
469 my $issue = Koha::Checkouts->find( { itemnumber => $itemNum } );
470 if ( $issue ) {
471 $itemLoopIter->{dateDue} = output_pref({ dt => dt_from_string($issue->date_due, 'sql'), as_due_date => 1 });
472 $itemLoopIter->{backgroundcolor} = 'onloan';
475 # checking reserve
476 my $holds = $item->current_holds;
478 if ( my $first_hold = $holds->next ) {
479 $itemLoopIter->{backgroundcolor} = 'reserved';
480 $itemLoopIter->{reservedate} = output_pref({ dt => dt_from_string($first_hold->reservedate), dateonly => 1 }); # FIXME Should be formatted in the template
481 $itemLoopIter->{ExpectedAtLibrary} = $first_hold->branchcode;
482 $itemLoopIter->{waitingdate} = $first_hold->waitingdate;
485 $itemLoopIter->{notforloan} = $itemInfo->{notforloan};
486 $itemLoopIter->{itemnotforloan} = $itemInfo->{itemnotforloan};
488 # Management of the notforloan document
489 if ( $itemLoopIter->{notforloan} || $itemLoopIter->{itemnotforloan}) {
490 $itemLoopIter->{backgroundcolor} = 'other';
491 $itemLoopIter->{notforloanvalue} =
492 $notforloan_label_of->{ $itemLoopIter->{notforloan} };
495 # Management of lost or long overdue items
496 if ( $itemInfo->{itemlost} ) {
498 # FIXME localized strings should never be in Perl code
499 $itemLoopIter->{message} =
500 $itemInfo->{itemlost} == 1 ? "(lost)"
501 : $itemInfo->{itemlost} == 2 ? "(long overdue)"
502 : "";
503 $itemInfo->{backgroundcolor} = 'other';
506 # Check of the transferred documents
507 my ( $transfertwhen, $transfertfrom, $transfertto ) =
508 GetTransfers($itemNum);
509 if ( $transfertwhen && ($transfertwhen ne '') ) {
510 $itemLoopIter->{transfertwhen} = output_pref({ dt => dt_from_string($transfertwhen), dateonly => 1 });
511 $itemLoopIter->{transfertfrom} = $transfertfrom;
512 $itemLoopIter->{transfertto} = $transfertto;
513 $itemLoopIter->{nocancel} = 1;
516 # if the items belongs to a host record, show link to host record
517 if ( $itemInfo->{biblionumber} ne $biblioNum ) {
518 $biblioLoopIter{hostitemsflag} = 1;
519 $itemLoopIter->{hostbiblionumber} = $itemInfo->{biblionumber};
520 $itemLoopIter->{hosttitle} = Koha::Biblios->find( $itemInfo->{biblionumber} )->title;
523 # If there is no loan, return and transfer, we show a checkbox.
524 $itemLoopIter->{notforloan} = $itemLoopIter->{notforloan} || 0;
526 my $patron_unblessed = $patron->unblessed;
527 my $branch = GetReservesControlBranch( $itemInfo, $patron_unblessed );
529 my $policy_holdallowed = !$itemLoopIter->{already_reserved};
530 $policy_holdallowed &&=
531 IsAvailableForItemLevelRequest($itemInfo,$patron_unblessed) &&
532 CanItemBeReserved( $borrowernumber, $itemNum )->{status} eq 'OK';
534 if ($policy_holdallowed) {
535 my $opac_hold_policy = Koha::IssuingRules->get_opacitemholds_policy( { item => $item, patron => $patron } );
536 if ( $opac_hold_policy ne 'N' ) { # If Y or F
537 $itemLoopIter->{available} = 1;
538 $numCopiesOPACAvailable++;
539 $biblioLoopIter{force_hold} = 1 if $opac_hold_policy eq 'F';
541 $numCopiesAvailable++;
543 unless ( $can_place_hold_if_available_at_pickup ) {
544 my $items_in_this_library = Koha::Items->search({ biblionumber => $itemInfo->{biblionumber}, holdingbranch => $itemInfo->{holdingbranch} });
545 my $nb_of_items_issued = $items_in_this_library->search({ 'issue.itemnumber' => { not => undef }}, { join => 'issue' })->count;
546 if ( $items_in_this_library->count > $nb_of_items_issued ) {
547 push @not_available_at, $itemInfo->{holdingbranch};
552 $itemLoopIter->{imageurl} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itemInfo->{itype} }{imageurl} );
554 # Show serial enumeration when needed
555 if ($itemLoopIter->{enumchron}) {
556 $itemdata_enumchron = 1;
558 # Show collection when needed
559 if ($itemLoopIter->{ccode}) {
560 $itemdata_ccode = 1;
563 push @{$biblioLoopIter{itemLoop}}, $itemLoopIter;
565 $template->param(
566 itemdata_enumchron => $itemdata_enumchron,
567 itemdata_ccode => $itemdata_ccode,
570 if ($numCopiesAvailable > 0) {
571 $numBibsAvailable++;
572 $biblioLoopIter{bib_available} = 1;
573 $biblioLoopIter{holdable} = 1;
574 $biblioLoopIter{itemholdable} = 1 if $numCopiesOPACAvailable;
576 if ($biblioLoopIter{already_reserved}) {
577 $biblioLoopIter{holdable} = undef;
578 $biblioLoopIter{itemholdable} = undef;
580 if(not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowernumber,$biblioNum)) {
581 $biblioLoopIter{holdable} = undef;
582 $biblioLoopIter{already_patron_possession} = 1;
585 if ( $biblioLoopIter{holdable} ) {
586 @not_available_at = uniq @not_available_at;
587 $biblioLoopIter{not_available_at} = \@not_available_at ;
590 unless ( $can_place_hold_if_available_at_pickup ) {
591 @not_available_at = uniq @not_available_at;
592 $biblioLoopIter{not_available_at} = \@not_available_at ;
593 # The record is not holdable is not available at any of the libraries
594 if ( Koha::Libraries->search->count == @not_available_at ) {
595 $biblioLoopIter{holdable} = 0;
599 $biblioLoopIter{holdable} &&= CanBookBeReserved( $borrowernumber, $biblioNum )->{status} eq 'OK';
601 # For multiple holds per record, if a patron has previously placed a hold,
602 # the patron can only place more holds of the same type. That is, if the
603 # patron placed a record level hold, all the holds the patron places must
604 # be record level. If the patron placed an item level hold, all holds
605 # the patron places must be item level
606 my $forced_hold_level = Koha::Holds->search(
608 borrowernumber => $borrowernumber,
609 biblionumber => $biblioNum,
610 found => undef,
612 )->forced_hold_level();
613 if ($forced_hold_level) {
614 $biblioLoopIter{force_hold} = 1 if $forced_hold_level eq 'item';
615 $biblioLoopIter{itemholdable} = 0 if $forced_hold_level eq 'record';
619 push @$biblioLoop, \%biblioLoopIter;
621 $anyholdable = 1 if $biblioLoopIter{holdable};
624 unless ($pickup_locations->count) {
625 $numBibsAvailable = 0;
626 $anyholdable = 0;
627 $template->param(
628 message => 1,
629 no_pickup_locations => 1
633 if ( $numBibsAvailable == 0 || $anyholdable == 0) {
634 $template->param( none_available => 1 );
637 if (scalar @biblionumbers > 1) {
638 $template->param( multi_hold => 1);
641 my $show_notes=C4::Context->preference('OpacHoldNotes');
642 $template->param(OpacHoldNotes=>$show_notes);
644 # display infos
645 $template->param(bibitemloop => $biblioLoop);
646 # can set reserve date in future
647 if (
648 C4::Context->preference( 'AllowHoldDateInFuture' ) &&
649 C4::Context->preference( 'OPACAllowHoldDateInFuture' )
651 $template->param(
652 reserve_in_future => 1,
656 output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 };