Bug 7460: Add template toolkit's FILTER html_line_break on opac details description...
[koha.git] / reserve / request.pl
1 #!/usr/bin/perl
2
3
4 #writen 2/1/00 by chris@katipo.oc.nz
5 # Copyright 2000-2002 Katipo Communications
6 # Parts Copyright 2011 Catalyst IT
7 #
8 # This file is part of Koha.
9 #
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
13 # version.
14 #
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License along
20 # with Koha; if not, write to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
23 =head1 request.pl
24
25 script to place reserves/requests
26
27 =cut
28
29 use strict;
30 use warnings;
31 use C4::Branch;
32 use CGI;
33 use List::MoreUtils qw/uniq/;
34 use Date::Calc qw/Date_to_Days/;
35 use C4::Output;
36 use C4::Auth;
37 use C4::Reserves;
38 use C4::Biblio;
39 use C4::Items;
40 use C4::Koha;
41 use C4::Circulation;
42 use C4::Dates qw/format_date/;
43 use C4::Members;
44 use C4::Search;         # enabled_staff_search_views
45
46 my $dbh = C4::Context->dbh;
47 my $sth;
48 my $input = new CGI;
49 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
50     {
51         template_name   => "reserve/request.tmpl",
52         query           => $input,
53         type            => "intranet",
54         authnotrequired => 0,
55         flagsrequired   => { reserveforothers => 'place_holds' },
56     }
57 );
58
59 my $multihold = $input->param('multi_hold');
60 $template->param(multi_hold => $multihold);
61 my $showallitems = $input->param('showallitems');
62
63 # get Branches and Itemtypes
64 my $branches = GetBranches();
65 my $itemtypes = GetItemTypes();
66
67 my $default = C4::Context->userenv->{branch};
68 my @values;
69 my %label_of;
70
71 foreach my $branchcode (sort keys %{$branches} ) {
72     push @values, $branchcode;
73     $label_of{$branchcode} = $branches->{$branchcode}->{branchname};
74 }
75 my $CGIbranch = CGI::scrolling_list(
76                                     -name     => 'pickup',
77                                     -id          => 'pickup',
78                                     -values   => \@values,
79                                     -default  => $default,
80                                     -labels   => \%label_of,
81                                     -size     => 1,
82                                     -multiple => 0,
83                                    );
84
85 # Select borrowers infos
86 my $findborrower = $input->param('findborrower');
87 $findborrower = '' unless defined $findborrower;
88 $findborrower =~ s|,| |g;
89 my $borrowernumber_hold = $input->param('borrowernumber') || '';
90 my $borrowerslist;
91 my $messageborrower;
92 my $warnings;
93 my $messages;
94
95 my $date = C4::Dates->today('iso');
96 my $action = $input->param('action');
97 $action ||= q{};
98
99 if ( $action eq 'move' ) {
100   my $where = $input->param('where');
101   my $borrowernumber = $input->param('borrowernumber');
102   my $biblionumber = $input->param('biblionumber');
103   AlterPriority( $where, $borrowernumber, $biblionumber );
104 } elsif ( $action eq 'cancel' ) {
105   my $borrowernumber = $input->param('borrowernumber');
106   my $biblionumber = $input->param('biblionumber');
107   CancelReserve( $biblionumber, '', $borrowernumber );
108 } elsif ( $action eq 'setLowestPriority' ) {
109   my $borrowernumber = $input->param('borrowernumber');
110   my $biblionumber   = $input->param('biblionumber');
111   ToggleLowestPriority( $borrowernumber, $biblionumber );
112 }
113
114 if ($findborrower) {
115     my $borrowers = Search($findborrower, 'cardnumber');
116
117     if ($borrowers && @$borrowers) {
118         if ( @$borrowers == 1 ) {
119             $borrowernumber_hold = $borrowers->[0]->{'borrowernumber'};
120         }
121         else {
122             $borrowerslist = $borrowers;
123         }
124     } else {
125         $messageborrower = "'$findborrower'";
126     }
127 }
128
129 # If we have the borrowernumber because we've performed an action, then we
130 # don't want to try to place another reserve.
131 if ($borrowernumber_hold && !$action) {
132     my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold );
133     my $diffbranch;
134     my @getreservloop;
135     my $count_reserv = 0;
136     my $maxreserves;
137
138 #   we check the reserves of the borrower, and if he can reserv a document
139 # FIXME At this time we have a simple count of reservs, but, later, we could improve the infos "title" ...
140
141     my $number_reserves =
142       GetReserveCount( $borrowerinfo->{'borrowernumber'} );
143
144     if ( C4::Context->preference('maxreserves') && ($number_reserves >= C4::Context->preference('maxreserves')) ) {
145                 $warnings = 1;
146         $maxreserves = 1;
147     }
148
149     # we check the date expiry of the borrower (only if there is an expiry date, otherwise, set to 1 (warn)
150     my $expiry_date = $borrowerinfo->{dateexpiry};
151     my $expiry = 0; # flag set if patron account has expired
152     if ($expiry_date and $expiry_date ne '0000-00-00' and
153             Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
154                 $messages = $expiry = 1;
155     }
156
157     # check if the borrower make the reserv in a different branch
158     if ( $borrowerinfo->{'branchcode'} ne C4::Context->userenv->{'branch'} ) {
159                 $messages = 1;
160         $diffbranch = 1;
161     }
162
163     $template->param(
164                 borrowernumber      => $borrowerinfo->{'borrowernumber'},
165                 borrowersurname     => $borrowerinfo->{'surname'},
166                 borrowerfirstname   => $borrowerinfo->{'firstname'},
167                 borrowerstreetaddress   => $borrowerinfo->{'address'},
168                 borrowercity        => $borrowerinfo->{'city'},
169                 borrowerphone       => $borrowerinfo->{'phone'},
170                 borrowermobile      => $borrowerinfo->{'mobile'},
171                 borrowerfax         => $borrowerinfo->{'fax'},
172                 borrowerphonepro    => $borrowerinfo->{'phonepro'},
173                 borroweremail       => $borrowerinfo->{'email'},
174                 borroweremailpro    => $borrowerinfo->{'emailpro'},
175                 borrowercategory    => $borrowerinfo->{'category'},
176                 borrowerreservs     => $count_reserv,
177                 cardnumber          => $borrowerinfo->{'cardnumber'},
178                 maxreserves         => $maxreserves,
179                 expiry              => $expiry,
180                 diffbranch          => $diffbranch,
181                                 messages            => $messages,
182                                 warnings            => $warnings
183     );
184 }
185
186 $template->param( messageborrower => $messageborrower );
187
188 my $CGIselectborrower;
189 if ($borrowerslist) {
190     my @values;
191     my %labels;
192
193     foreach my $borrower (
194         sort {
195                 $a->{surname}
196               . $a->{firstname} cmp $b->{surname}
197               . $b->{firstname}
198         } @{$borrowerslist}
199       )
200     {
201         push @values, $borrower->{borrowernumber};
202
203         $labels{ $borrower->{borrowernumber} } = sprintf(
204             '%s, %s ... (%s - %s) ... %s',
205             $borrower->{surname} ||'',    $borrower->{firstname} || '',
206             $borrower->{cardnumber} || '', $borrower->{categorycode} || '',
207             $borrower->{address} || '',
208         );
209     }
210
211     $CGIselectborrower = CGI::scrolling_list(
212         -name     => 'borrowernumber',
213         -values   => \@values,
214         -labels   => \%labels,
215         -size     => 7,
216         -multiple => 0,
217     );
218 }
219
220 # FIXME launch another time GetMember perhaps until
221 my $borrowerinfo = GetMember( borrowernumber => $borrowernumber_hold );
222
223 my @biblionumbers = ();
224 my $biblionumbers = $input->param('biblionumbers');
225 if ($multihold) {
226     @biblionumbers = split '/', $biblionumbers;
227 } else {
228     push @biblionumbers, $input->param('biblionumber');
229 }
230
231 my $itemdata_enumchron = 0;
232 my @biblioloop = ();
233 foreach my $biblionumber (@biblionumbers) {
234
235     my %biblioloopiter = ();
236         my $maxreserves;
237
238     my $dat          = GetBiblioData($biblionumber);
239
240     unless ( CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber) ) {
241                 $warnings = 1;
242         $maxreserves = 1;
243     }
244     # get existing reserves .....
245     my ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1);
246     my $totalcount = $count;
247     my $alreadyreserved;
248
249     foreach my $res (@$reserves) {
250         if ( defined $res->{found} && $res->{found} eq 'W' ) {
251             $count--;
252         }
253
254         if ( defined $borrowerinfo && ($borrowerinfo->{borrowernumber} eq $res->{borrowernumber}) ) {
255             $warnings = 1;
256             $alreadyreserved = 1;
257             $biblioloopiter{warn} = 1;
258             $biblioloopiter{alreadyres} = 1;
259         }
260     }
261
262     $template->param( alreadyreserved => $alreadyreserved,
263                       messages => $messages,
264                       warnings => $warnings,
265                                           maxreserves=>$maxreserves
266                                           );
267
268
269     # FIXME think @optionloop, is maybe obsolete, or  must be switchable by a systeme preference fixed rank or not
270     # make priorities options
271
272     my @optionloop;
273     for ( 1 .. $count + 1 ) {
274         push(
275              @optionloop,
276              {
277               num      => $_,
278               selected => ( $_ == $count + 1 ),
279              }
280             );
281     }
282     # adding a fixed value for priority options
283     my $fixedRank = $count+1;
284
285     my @branchcodes;
286     my %itemnumbers_of_biblioitem;
287     my @itemnumbers;
288
289     ## $items is array of 'item' table numbers
290     if (my $items = get_itemnumbers_of($biblionumber)->{$biblionumber}){
291         @itemnumbers  = @$items;
292     }
293         my @hostitems = get_hostitemnumbers_of($biblionumber);
294         if (@hostitems){
295                 $template->param('hostitemsflag' => 1);
296                 push(@itemnumbers, @hostitems);
297         }
298
299     if (!@itemnumbers) {
300         $template->param('noitems' => 1);
301         $biblioloopiter{noitems} = 1;
302     }
303
304     ## Hash of item number to 'item' table fields
305     my $iteminfos_of = GetItemInfosOf(@itemnumbers);
306
307     ## Here we go backwards again to create hash of biblioitemnumber to itemnumbers,
308     ## when by definition all of the itemnumber have the same biblioitemnumber
309     foreach my $itemnumber (@itemnumbers) {
310         my $biblioitemnumber = $iteminfos_of->{$itemnumber}->{biblioitemnumber};
311         push( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} }, $itemnumber );
312     }
313
314     ## Should be same as biblionumber
315     my @biblioitemnumbers = keys %itemnumbers_of_biblioitem;
316
317     my $notforloan_label_of = get_notforloan_label_of();
318
319     ## Hash of biblioitemnumber to 'biblioitem' table records
320     my $biblioiteminfos_of  = GetBiblioItemInfosOf(@biblioitemnumbers);
321
322     my @bibitemloop;
323
324     foreach my $biblioitemnumber (@biblioitemnumbers) {
325         my $biblioitem = $biblioiteminfos_of->{$biblioitemnumber};
326         my $num_available = 0;
327         my $num_override  = 0;
328         my $hiddencount   = 0;
329
330         $biblioitem->{description} =
331           $itemtypes->{ $biblioitem->{itemtype} }{description};
332         if($biblioitem->{biblioitemnumber} ne $biblionumber){
333                 $biblioitem->{hostitemsflag}=1;
334         }
335         $biblioloopiter{description} = $biblioitem->{description};
336         $biblioloopiter{itypename} = $biblioitem->{description};
337         $biblioloopiter{imageurl} =
338           getitemtypeimagelocation('intranet', $itemtypes->{$biblioitem->{itemtype}}{imageurl});
339
340         foreach my $itemnumber ( @{ $itemnumbers_of_biblioitem{$biblioitemnumber} } )    {
341             my $item = $iteminfos_of->{$itemnumber};
342
343             unless (C4::Context->preference('item-level_itypes')) {
344                 $item->{itype} = $biblioitem->{itemtype};
345             }
346
347             $item->{itypename} = $itemtypes->{ $item->{itype} }{description};
348             $item->{imageurl} = getitemtypeimagelocation( 'intranet', $itemtypes->{ $item->{itype} }{imageurl} );
349             $item->{homebranchname} = $branches->{ $item->{homebranch} }{branchname};
350
351             # if the holdingbranch is different than the homebranch, we show the
352             # holdingbranch of the document too
353             if ( $item->{homebranch} ne $item->{holdingbranch} ) {
354                 $item->{holdingbranchname} =
355                   $branches->{ $item->{holdingbranch} }{branchname};
356             }
357
358                 if($item->{biblionumber} ne $biblionumber){
359                         $item->{hostitemsflag}=1;
360                         $item->{hosttitle} = GetBiblioData($item->{biblionumber})->{title};
361                 }
362                 
363             #   add information
364             $item->{itemcallnumber} = $item->{itemcallnumber};
365
366             # if the item is currently on loan, we display its return date and
367             # change the background color
368             my $issues= GetItemIssue($itemnumber);
369             if ( $issues->{'date_due'} ) {
370                 $item->{date_due} = format_date($issues->{'date_due'});
371                 $item->{backgroundcolor} = 'onloan';
372             }
373
374             # checking reserve
375             my ($reservedate,$reservedfor,$expectedAt) = GetReservesFromItemnumber($itemnumber);
376             my $ItemBorrowerReserveInfo = GetMember( borrowernumber => $reservedfor );
377
378             if ( defined $reservedate ) {
379                 $item->{backgroundcolor} = 'reserved';
380                 $item->{reservedate}     = format_date($reservedate);
381                 $item->{ReservedForBorrowernumber}     = $reservedfor;
382                 $item->{ReservedForSurname}     = $ItemBorrowerReserveInfo->{'surname'};
383                 $item->{ReservedForFirstname}     = $ItemBorrowerReserveInfo->{'firstname'};
384                 $item->{ExpectedAtLibrary}     = $branches->{$expectedAt}{branchname};
385
386             }
387
388             # Management of the notforloan document
389             if ( $item->{notforloan} ) {
390                 $item->{backgroundcolor} = 'other';
391                 $item->{notforloanvalue} =
392                   $notforloan_label_of->{ $item->{notforloan} };
393             }
394
395             # Management of lost or long overdue items
396             if ( $item->{itemlost} ) {
397
398                 # FIXME localized strings should never be in Perl code
399                 $item->{message} =
400                   $item->{itemlost} == 1 ? "(lost)"
401                     : $item->{itemlost} == 2 ? "(long overdue)"
402                       : "";
403                 $item->{backgroundcolor} = 'other';
404                 if (GetHideLostItemsPreference($borrowernumber) && !$showallitems) {
405                     $item->{hide} = 1;
406                     $hiddencount++;
407                 }
408             }
409
410             # Check the transit status
411             my ( $transfertwhen, $transfertfrom, $transfertto ) =
412               GetTransfers($itemnumber);
413
414             if ( defined $transfertwhen && $transfertwhen ne '' ) {
415                 $item->{transfertwhen} = format_date($transfertwhen);
416                 $item->{transfertfrom} =
417                   $branches->{$transfertfrom}{branchname};
418                 $item->{transfertto} = $branches->{$transfertto}{branchname};
419                 $item->{nocancel} = 1;
420             }
421
422             # If there is no loan, return and transfer, we show a checkbox.
423             $item->{notforloan} = $item->{notforloan} || 0;
424
425             # if independent branches is on we need to check if the person can reserve
426             # for branches they arent logged in to
427             if ( C4::Context->preference("IndependantBranches") ) {
428                 if (! C4::Context->preference("canreservefromotherbranches")){
429                     # cant reserve items so need to check if item homebranch and userenv branch match if not we cant reserve
430                     my $userenv = C4::Context->userenv;
431                     if ( ($userenv) && ( $userenv->{flags} % 2 != 1 ) ) {
432                         $item->{cantreserve} = 1 if ( $item->{homebranch} ne $userenv->{branch} );
433                     }
434                 }
435             }
436
437             my $branch = C4::Circulation::_GetCircControlBranch($item, $borrowerinfo);
438
439             my $branchitemrule = GetBranchItemRule( $branch, $item->{'itype'} );
440             my $policy_holdallowed = 1;
441
442             $item->{'holdallowed'} = $branchitemrule->{'holdallowed'};
443
444             if ( $branchitemrule->{'holdallowed'} == 0 ||
445                  ( $branchitemrule->{'holdallowed'} == 1 &&
446                      $borrowerinfo->{'branchcode'} ne $item->{'homebranch'} ) ) {
447                 $policy_holdallowed = 0;
448             }
449             
450             if (
451                    $policy_holdallowed
452                 && !$item->{cantreserve}
453                 && IsAvailableForItemLevelRequest($itemnumber)
454                 && CanItemBeReserved(
455                     $borrowerinfo->{borrowernumber}, $itemnumber
456                 )
457               )
458             {
459                 $item->{available} = 1;
460                 $num_available++;
461             }
462             elsif ( C4::Context->preference('AllowHoldPolicyOverride') ) {
463
464 # If AllowHoldPolicyOverride is set, it should override EVERY restriction, not just branch item rules
465                 $item->{override} = 1;
466                 $num_override++;
467             }
468
469             # If none of the conditions hold true, then neither override nor available is set and the item cannot be checked
470
471             # FIXME: move this to a pm
472             my $sth2 = $dbh->prepare("SELECT * FROM reserves WHERE borrowernumber=? AND itemnumber=? AND found='W'");
473             $sth2->execute($item->{ReservedForBorrowernumber},$item->{itemnumber});
474             while (my $wait_hashref = $sth2->fetchrow_hashref) {
475                 $item->{waitingdate} = format_date($wait_hashref->{waitingdate});
476             }
477
478             # Show serial enumeration when needed
479             if ($item->{enumchron}) {
480                 $itemdata_enumchron = 1;
481             }
482
483             push @{ $biblioitem->{itemloop} }, $item;
484         }
485
486         if ( $num_override == scalar( @{ $biblioitem->{itemloop} } ) ) { # That is, if all items require an override
487             $template->param( override_required => 1 );
488         } elsif ( $num_available == 0 ) {
489             $template->param( none_available => 1 );
490             $template->param( warnings => 1 );
491             $biblioloopiter{warn} = 1;
492             $biblioloopiter{none_avail} = 1;
493         }
494         $template->param( hiddencount => $hiddencount);
495
496         push @bibitemloop, $biblioitem;
497     }
498
499     # existingreserves building
500     my @reserveloop;
501     ( $count, $reserves ) = GetReservesFromBiblionumber($biblionumber,1);
502     foreach my $res ( sort {
503             my $a_found = $a->{found} || '';
504             my $b_found = $a->{found} || '';
505             $a_found cmp $b_found;
506         } @$reserves ) {
507         my %reserve;
508         my @optionloop;
509         for ( my $i = 1 ; $i <= $totalcount ; $i++ ) {
510             push(
511                  @optionloop,
512                  {
513                   num      => $i,
514                   selected => ( $i == $res->{priority} ),
515                  }
516                 );
517         }
518
519         if ( defined $res->{'found'} && $res->{'found'} eq 'W' || $res->{'found'} eq 'T' ) {
520             my $item = $res->{'itemnumber'};
521             $item = GetBiblioFromItemNumber($item,undef);
522             $reserve{'wait'}= 1;
523             $reserve{'holdingbranch'}=$item->{'holdingbranch'};
524             $reserve{'biblionumber'}=$item->{'biblionumber'};
525             $reserve{'barcodenumber'}   = $item->{'barcode'};
526             $reserve{'wbrcode'} = $res->{'branchcode'};
527             $reserve{'itemnumber'}  = $res->{'itemnumber'};
528             $reserve{'wbrname'} = $branches->{$res->{'branchcode'}}->{'branchname'};
529             if($reserve{'holdingbranch'} eq $reserve{'wbrcode'}){
530                 $reserve{'atdestination'} = 1;
531             }
532             # set found to 1 if reserve is waiting for patron pickup
533             $reserve{'found'} = 1 if $res->{'found'} eq 'W';
534             $reserve{'intransit'} = 1 if $res->{'found'} eq 'T';
535         } elsif ($res->{priority} > 0) {
536             if (defined($res->{itemnumber})) {
537                 my $item = GetItem($res->{itemnumber});
538                 $reserve{'itemnumber'}  = $res->{'itemnumber'};
539                 $reserve{'barcodenumber'}   = $item->{'barcode'};
540                 $reserve{'item_level_hold'} = 1;
541             }
542         }
543
544         #     get borrowers reserve info
545         my $reserveborrowerinfo = GetMember( borrowernumber => $res->{'borrowernumber'} );
546         if (C4::Context->preference('HidePatronName')){
547             $reserve{'hidename'} = 1;
548             $reserve{'cardnumber'} = $reserveborrowerinfo->{'cardnumber'};
549         }
550         $reserve{'expirationdate'} = format_date( $res->{'expirationdate'} )
551             unless ( !defined($res->{'expirationdate'}) || $res->{'expirationdate'} eq '0000-00-00' );
552         $reserve{'date'}           = format_date( $res->{'reservedate'} );
553         $reserve{'borrowernumber'} = $res->{'borrowernumber'};
554         $reserve{'biblionumber'}   = $res->{'biblionumber'};
555         $reserve{'borrowernumber'} = $res->{'borrowernumber'};
556         $reserve{'firstname'}      = $reserveborrowerinfo->{'firstname'};
557         $reserve{'surname'}        = $reserveborrowerinfo->{'surname'};
558         $reserve{'notes'}          = $res->{'reservenotes'};
559         $reserve{'wait'}           =
560           ( ( defined $res->{'found'} and $res->{'found'} eq 'W' ) or ( $res->{'priority'} eq '0' ) );
561         $reserve{'constrainttypea'} = ( $res->{'constrainttype'} eq 'a' );
562         $reserve{'constrainttypeo'} = ( $res->{'constrainttype'} eq 'o' );
563         $reserve{'voldesc'}         = $res->{'volumeddesc'};
564         $reserve{'ccode'}           = $res->{'ccode'};
565         $reserve{'barcode'}         = $res->{'barcode'};
566         $reserve{'priority'}    = $res->{'priority'};
567         $reserve{'lowestPriority'}    = $res->{'lowestPriority'};
568         $reserve{'branchloop'} = GetBranchesLoop($res->{'branchcode'});
569         $reserve{'optionloop'} = \@optionloop;
570
571         push( @reserveloop, \%reserve );
572     }
573
574     # get the time for the form name...
575     my $time = time();
576
577     $template->param(
578                      CGIbranch   => $CGIbranch,
579
580                      time        => $time,
581                      fixedRank   => $fixedRank,
582                     );
583
584     # display infos
585     $template->param(
586                      optionloop        => \@optionloop,
587                      bibitemloop       => \@bibitemloop,
588                      itemdata_enumchron => $itemdata_enumchron,
589                      date              => $date,
590                      biblionumber      => $biblionumber,
591                      findborrower      => $findborrower,
592                      title             => $dat->{title},
593                      author            => $dat->{author},
594                      holdsview => 1,
595                      C4::Search::enabled_staff_search_views,
596                     );
597     if (defined $borrowerinfo && exists $borrowerinfo->{'branchcode'}) {
598         $template->param(
599                      borrower_branchname => $branches->{$borrowerinfo->{'branchcode'}}->{'branchname'},
600                      borrower_branchcode => $borrowerinfo->{'branchcode'},
601         );
602     }
603     $template->param(CGIselectborrower => $CGIselectborrower) if defined $CGIselectborrower;
604
605     $biblioloopiter{biblionumber} = $biblionumber;
606     $biblioloopiter{title} = $dat->{title};
607     $biblioloopiter{rank} = $fixedRank;
608     $biblioloopiter{reserveloop} = \@reserveloop;
609
610     if (@reserveloop) {
611         $template->param( reserveloop => \@reserveloop );
612     }
613
614     push @biblioloop, \%biblioloopiter;
615 }
616
617 $template->param( biblioloop => \@biblioloop );
618 $template->param( biblionumbers => $biblionumbers );
619 $template->param( DHTMLcalendar_dateformat  => C4::Dates->DHTMLcalendar() );
620
621 if ($multihold) {
622     $template->param( multi_hold => 1 );
623 }
624
625 if ( C4::Context->preference( 'AllowHoldDateInFuture' ) ) {
626     $template->param( reserve_in_future => 1 );
627 }
628
629 # printout the page
630 output_html_with_http_headers $input, $cookie, $template->output;