Bug 7143: Update about page for new dev - Pongtawat Chippimolchai
[koha.git] / circ / circulation.pl
blob7414378d41fba9df854ffa7da327485d68a7ae24
1 #!/usr/bin/perl
3 # script to execute issuing of books
5 # Copyright 2000-2002 Katipo Communications
6 # copyright 2010 BibLibre
7 # Copyright 2011 PTFS-Europe Ltd.
8 # Copyright 2012 software.coop and MJ Ray
10 # This file is part of Koha.
12 # Koha is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 3 of the License, or
15 # (at your option) any later version.
17 # Koha is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with Koha; if not, see <http://www.gnu.org/licenses>.
25 # FIXME There are too many calls to Koha::Patrons->find in this script
27 use Modern::Perl;
28 use CGI qw ( -utf8 );
29 use DateTime;
30 use DateTime::Duration;
31 use C4::Output;
32 use C4::Print;
33 use C4::Auth qw/:DEFAULT get_session haspermission/;
34 use C4::Koha; # GetPrinter
35 use C4::Circulation;
36 use C4::Utils::DataTables::Members;
37 use C4::Members;
38 use C4::Biblio;
39 use C4::Search;
40 use MARC::Record;
41 use C4::Reserves;
42 use Koha::Holds;
43 use C4::Context;
44 use CGI::Session;
45 use C4::Members::Attributes qw(GetBorrowerAttributes);
46 use Koha::AuthorisedValues;
47 use Koha::CsvProfiles;
48 use Koha::Patrons;
49 use Koha::Patron::Debarments qw(GetDebarments);
50 use Koha::DateUtils;
51 use Koha::Database;
52 use Koha::BiblioFrameworks;
53 use Koha::Items;
54 use Koha::Patron::Messages;
55 use Koha::SearchEngine;
56 use Koha::SearchEngine::Search;
57 use Koha::Patron::Modifications;
59 use Date::Calc qw(
60 Today
61 Add_Delta_Days
62 Date_to_Days
64 use List::MoreUtils qw/uniq/;
67 # PARAMETERS READING
69 my $query = new CGI;
71 my $override_high_holds = $query->param('override_high_holds');
72 my $override_high_holds_tmp = $query->param('override_high_holds_tmp');
74 my $sessionID = $query->cookie("CGISESSID") ;
75 my $session = get_session($sessionID);
76 if (!C4::Context->userenv){
77 if ($session->param('branch') eq 'NO_LIBRARY_SET'){
78 # no branch set we can't issue
79 print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
80 exit;
84 my $barcodes = [];
85 my $barcode = $query->param('barcode');
86 my $findborrower;
87 my $autoswitched;
88 my $borrowernumber = $query->param('borrowernumber');
90 if (C4::Context->preference("AutoSwitchPatron") && $barcode) {
91 if (Koha::Patrons->search( { cardnumber => $barcode} )->count() > 0) {
92 $findborrower = $barcode;
93 undef $barcode;
94 undef $borrowernumber;
95 $autoswitched = 1;
98 $findborrower ||= $query->param('findborrower') || q{};
99 $findborrower =~ s|,| |g;
101 # Barcode given by user could be '0'
102 if ( $barcode || ( defined($barcode) && $barcode eq '0' ) ) {
103 $barcodes = [ $barcode ];
104 } else {
105 my $filefh = $query->upload('uploadfile');
106 if ( $filefh ) {
107 while ( my $content = <$filefh> ) {
108 $content =~ s/[\r\n]*$//g;
109 push @$barcodes, $content if $content;
111 } elsif ( my $list = $query->param('barcodelist') ) {
112 push @$barcodes, split( /\s\n/, $list );
113 $barcodes = [ map { $_ =~ /^\s*$/ ? () : $_ } @$barcodes ];
114 } else {
115 @$barcodes = $query->multi_param('barcodes');
119 $barcodes = [ uniq @$barcodes ];
121 my $template_name = q|circ/circulation.tt|;
122 my $patron = $borrowernumber ? Koha::Patrons->find( $borrowernumber ) : undef;
123 my $batch = $query->param('batch');
124 my $batch_allowed = 0;
125 if ( $batch && C4::Context->preference('BatchCheckouts') ) {
126 $template_name = q|circ/circulation_batch_checkouts.tt|;
127 my @batch_category_codes = split '\|', C4::Context->preference('BatchCheckoutsValidCategories');
128 my $categorycode = $patron->categorycode;
129 if ( $categorycode && grep {/^$categorycode$/} @batch_category_codes ) {
130 $batch_allowed = 1;
131 } else {
132 $barcodes = [];
136 my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
138 template_name => $template_name,
139 query => $query,
140 type => "intranet",
141 authnotrequired => 0,
142 flagsrequired => { circulate => 'circulate_remaining_permissions' },
145 my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
147 my $force_allow_issue = $query->param('forceallow') || 0;
148 if (!C4::Auth::haspermission( C4::Context->userenv->{id} , { circulate => 'force_checkout' } )) {
149 $force_allow_issue = 0;
152 my $onsite_checkout = $query->param('onsite_checkout');
154 my @failedrenews = $query->multi_param('failedrenew'); # expected to be itemnumbers
155 our %renew_failed = ();
156 for (@failedrenews) { $renew_failed{$_} = 1; }
158 my @failedreturns = $query->multi_param('failedreturn');
159 our %return_failed = ();
160 for (@failedreturns) { $return_failed{$_} = 1; }
162 my $searchtype = $query->param('searchtype') || q{contain};
164 my $branch = C4::Context->userenv->{'branch'};
166 if (C4::Context->preference("DisplayClearScreenButton")) {
167 $template->param(DisplayClearScreenButton => 1);
170 for my $barcode ( @$barcodes ) {
171 $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
172 $barcode = barcodedecode($barcode)
173 if( $barcode && C4::Context->preference('itemBarcodeInputFilter'));
176 my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate');
177 my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate');
178 $duedatespec = eval { output_pref( { dt => dt_from_string( $duedatespec ), dateformat => 'iso', timeformat => '24hr' }); }
179 if ( $duedatespec );
180 my $restoreduedatespec = $query->param('restoreduedatespec') || $duedatespec || $session->param('stickyduedate');
181 if ( $restoreduedatespec && $restoreduedatespec eq "highholds_empty" ) {
182 undef $restoreduedatespec;
184 my $issueconfirmed = $query->param('issueconfirmed');
185 my $cancelreserve = $query->param('cancelreserve');
186 my $print = $query->param('print') || q{};
187 my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt error dialog twice
188 my $charges = $query->param('charges') || q{};
190 # Check if stickyduedate is turned off
191 if ( @$barcodes ) {
192 # was stickyduedate loaded from session?
193 if ( $stickyduedate && ! $query->param("stickyduedate") ) {
194 $session->clear( 'stickyduedate' );
195 $stickyduedate = $query->param('stickyduedate');
196 $duedatespec = $query->param('duedatespec');
198 $session->param('auto_renew', scalar $query->param('auto_renew'));
200 else {
201 $session->clear('auto_renew');
204 my ($datedue,$invalidduedate);
206 my $duedatespec_allow = C4::Context->preference('SpecifyDueDate');
207 if( $onsite_checkout && !$duedatespec_allow ) {
208 $datedue = output_pref({ dt => dt_from_string, dateonly => 1, dateformat => 'iso' });
209 $datedue .= ' 23:59:00';
210 } elsif( $duedatespec_allow ) {
211 if ( $duedatespec ) {
212 $datedue = eval { dt_from_string( $duedatespec ) };
213 if (! $datedue ) {
214 $invalidduedate = 1;
215 $template->param( IMPOSSIBLE=>1, INVALID_DATE=>$duedatespec );
220 # check and see if we should print
221 if ( @$barcodes == 0 && $print eq 'maybe' ) {
222 $print = 'yes';
225 my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess');
226 if ( @$barcodes == 0 && $charges eq 'yes' ) {
227 $template->param(
228 PAYCHARGES => 'yes',
229 borrowernumber => $borrowernumber
233 if ( $print eq 'yes' && $borrowernumber ne '' ) {
234 if ( C4::Context->boolean_preference('printcirculationslips') ) {
235 my $letter = IssueSlip($branch, $borrowernumber, "QUICK");
236 NetworkPrint($letter->{content});
238 $query->param( 'borrowernumber', '' );
239 $borrowernumber = '';
243 # STEP 2 : FIND BORROWER
244 # if there is a list of find borrowers....
246 my $message;
247 if ($findborrower) {
248 my $patron = Koha::Patrons->find( { cardnumber => $findborrower } );
249 if ( $patron ) {
250 $borrowernumber = $patron->borrowernumber;
251 } else {
252 my $dt_params = { iDisplayLength => -1 };
253 my $results = C4::Utils::DataTables::Members::search(
255 searchmember => $findborrower,
256 searchtype => $searchtype,
257 dt_params => $dt_params,
260 my $borrowers = $results->{patrons};
261 if ( scalar @$borrowers == 1 ) {
262 $borrowernumber = $borrowers->[0]->{borrowernumber};
263 $query->param( 'borrowernumber', $borrowernumber );
264 $query->param( 'barcode', '' );
265 } elsif ( @$borrowers ) {
266 $template->param( borrowers => $borrowers );
267 } else {
268 $query->param( 'findborrower', '' );
269 $message = "'$findborrower'";
274 # get the borrower information.....
275 $patron ||= Koha::Patrons->find( $borrowernumber ) if $borrowernumber;
276 if ($patron) {
278 $template->param( borrowernumber => $patron->borrowernumber );
279 output_and_exit_if_error( $query, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
281 my $overdues = $patron->get_overdues;
282 my $issues = $patron->checkouts;
283 my $balance = $patron->account->balance;
286 # if the expiry date is before today ie they have expired
287 if ( $patron->is_expired ) {
288 #borrowercard expired, no issues
289 $template->param(
290 noissues => ($force_allow_issue) ? 0 : "1",
291 forceallow => $force_allow_issue,
292 expired => "1",
295 # check for NotifyBorrowerDeparture
296 elsif ( $patron->is_going_to_expire ) {
297 # borrower card soon to expire warn librarian
298 $template->param( "warndeparture" => $patron->dateexpiry ,
300 if (C4::Context->preference('ReturnBeforeExpiry')){
301 $template->param("returnbeforeexpiry" => 1);
304 $template->param(
305 overduecount => $overdues->count,
306 issuecount => $issues->count,
307 finetotal => $balance,
310 if ( $patron and $patron->is_debarred ) {
311 $template->param(
312 'userdebarred' => $patron->debarred,
313 'debarredcomment' => $patron->debarredcomment,
316 if ( $patron->debarred ne "9999-12-31" ) {
317 $template->param( 'userdebarreddate' => $patron->debarred );
324 # STEP 3 : ISSUING
327 if (@$barcodes) {
328 my $checkout_infos;
329 for my $barcode ( @$barcodes ) {
330 my $template_params = { barcode => $barcode };
331 # always check for blockers on issuing
332 my ( $error, $question, $alerts, $messages ) = CanBookBeIssued(
333 $patron,
334 $barcode, $datedue,
335 $inprocess,
336 undef,
338 onsite_checkout => $onsite_checkout,
339 override_high_holds => $override_high_holds || $override_high_holds_tmp || 0,
343 my $blocker = $invalidduedate ? 1 : 0;
345 $template_params->{alert} = $alerts;
346 $template_params->{messages} = $messages;
348 my $item = Koha::Items->find({ barcode => $barcode });
349 my ( $biblio, $mss );
351 if ( $item ) {
352 $biblio = $item->biblio;
353 my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.notforloan', authorised_value => { not => undef } });
354 $template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorised_value : undef;
357 # Fix for bug 7494: optional checkout-time fallback search for a book
359 if ( $error->{'UNKNOWN_BARCODE'}
360 && C4::Context->preference("itemBarcodeFallbackSearch")
361 && not $batch
364 $template_params->{FALLBACK} = 1;
366 my $searcher = Koha::SearchEngine::Search->new({index => $Koha::SearchEngine::BIBLIOS_INDEX});
367 my $query = "kw=" . $barcode;
368 my ( $searcherror, $results, $total_hits ) = $searcher->simple_search_compat($query, 0, 10);
370 # if multiple hits, offer options to librarian
371 if ( $total_hits > 0 ) {
372 my @options = ();
373 foreach my $hit ( @{$results} ) {
374 my $chosen =
375 TransformMarcToKoha( C4::Search::new_record_from_zebra('biblioserver',$hit) );
377 # offer all barcodes individually
378 if ( $chosen->{barcode} ) {
379 foreach my $barcode ( sort split(/\s*\|\s*/, $chosen->{barcode}) ) {
380 my %chosen_single = %{$chosen};
381 $chosen_single{barcode} = $barcode;
382 push( @options, \%chosen_single );
386 $template_params->{options} = \@options;
390 if ( $error->{UNKNOWN_BARCODE} or not $onsite_checkout or not C4::Context->preference("OnSiteCheckoutsForce") ) {
391 delete $question->{'DEBT'} if ($debt_confirmed);
392 foreach my $impossible ( keys %$error ) {
393 $template_params->{$impossible} = $$error{$impossible};
394 $template_params->{IMPOSSIBLE} = 1;
395 $blocker = 1;
399 if( $item and ( !$blocker or $force_allow_issue ) ){
400 my $confirm_required = 0;
401 unless($issueconfirmed){
402 # Get the item title for more information
403 my $materials = $item->materials;
404 my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials });
405 $materials = $descriptions->{lib} // $materials;
406 $template_params->{additional_materials} = $materials;
407 $template_params->{itemhomebranch} = $item->homebranch;
409 # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed.
410 foreach my $needsconfirmation ( keys %$question ) {
411 $template_params->{$needsconfirmation} = $$question{$needsconfirmation};
412 $template_params->{getTitleMessageIteminfo} = $biblio->title;
413 $template_params->{getBarcodeMessageIteminfo} = $item->barcode;
414 $template_params->{NEEDSCONFIRMATION} = 1;
415 $template_params->{onsite_checkout} = $onsite_checkout;
416 $template_params->{auto_renew} = $session->param('auto_renew');
417 $confirm_required = 1;
420 unless($confirm_required) {
421 my $switch_onsite_checkout = exists $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED};
422 my $issue = AddIssue( $patron->unblessed, $barcode, $datedue, $cancelreserve, undef, undef, { onsite_checkout => $onsite_checkout, auto_renew => $session->param('auto_renew'), switch_onsite_checkout => $switch_onsite_checkout, } );
423 $template_params->{issue} = $issue;
424 $session->clear('auto_renew');
425 $inprocess = 1;
429 if ($question->{RESERVE_WAITING} or $question->{RESERVED}){
430 $template->param(
431 reserveborrowernumber => $question->{'resborrowernumber'}
436 # FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue
437 $patron = Koha::Patrons->find( $borrowernumber );
438 $template_params->{issuecount} = $patron->checkouts->count;
440 if ( $item ) {
441 $template_params->{item} = $item;
442 $template_params->{biblio} = $biblio;
443 $template_params->{itembiblionumber} = $biblio->biblionumber;
445 push @$checkout_infos, $template_params;
447 unless ( $batch ) {
448 $template->param( %{$checkout_infos->[0]} );
449 $template->param( barcode => $barcodes->[0] );
450 } else {
451 my $confirmation_needed = grep { $_->{NEEDSCONFIRMATION} } @$checkout_infos;
452 $template->param(
453 checkout_infos => $checkout_infos,
454 confirmation_needed => $confirmation_needed,
459 ##################################################################################
460 # BUILD HTML
461 # show all reserves of this borrower, and the position of the reservation ....
462 if ($patron) {
463 my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); # FIXME must be Koha::Patron->holds
464 my $waiting_holds = $holds->waiting;
465 $template->param(
466 holds_count => $holds->count(),
467 WaitingHolds => $waiting_holds,
471 #title
472 my $flags = $patron ? C4::Members::patronflags( $patron->unblessed ) : {};
473 foreach my $flag ( sort keys %$flags ) {
474 $flags->{$flag}->{'message'} =~ s#\n#<br />#g;
475 if ( $flags->{$flag}->{'noissues'} ) {
476 $template->param(
477 noissues => ($force_allow_issue) ? 0 : 'true',
478 forceallow => $force_allow_issue,
480 if ( $flag eq 'GNA' ) {
481 $template->param( gna => 'true' );
483 elsif ( $flag eq 'LOST' ) {
484 $template->param( lost => 'true' );
486 elsif ( $flag eq 'DBARRED' ) {
487 $template->param( dbarred => 'true' );
489 elsif ( $flag eq 'CHARGES' ) {
490 $template->param(
491 charges => 'true',
492 chargesmsg => $flags->{'CHARGES'}->{'message'},
493 chargesamount => $flags->{'CHARGES'}->{'amount'},
494 charges_is_blocker => 1
497 elsif ( $flag eq 'CHARGES_GUARANTEES' ) {
498 $template->param(
499 charges_guarantees => 'true',
500 chargesmsg_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'message'},
501 chargesamount_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'amount'},
502 charges_guarantees_is_blocker => 1
505 elsif ( $flag eq 'CREDITS' ) {
506 $template->param(
507 credits => 'true',
508 creditsmsg => $flags->{'CREDITS'}->{'message'},
509 creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov
513 else {
514 if ( $flag eq 'CHARGES' ) {
515 $template->param(
516 charges => 'true',
517 chargesmsg => $flags->{'CHARGES'}->{'message'},
518 chargesamount => $flags->{'CHARGES'}->{'amount'},
521 elsif ( $flag eq 'CHARGES_GUARANTEES' ) {
522 $template->param(
523 charges_guarantees => 'true',
524 chargesmsg_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'message'},
525 chargesamount_guarantees => $flags->{'CHARGES_GUARANTEES'}->{'amount'},
528 elsif ( $flag eq 'CREDITS' ) {
529 $template->param(
530 credits => 'true',
531 creditsmsg => $flags->{'CREDITS'}->{'message'},
532 creditsamount => sprintf("%.02f", -($flags->{'CREDITS'}->{'amount'})), # from patron's pov
535 elsif ( $flag eq 'ODUES' ) {
536 $template->param(
537 odues => 'true',
538 oduesmsg => $flags->{'ODUES'}->{'message'}
541 my $items = $flags->{$flag}->{'itemlist'};
542 if ( ! $query->param('module') || $query->param('module') ne 'returns' ) {
543 $template->param( nonreturns => 'true' );
546 elsif ( $flag eq 'NOTES' ) {
547 $template->param(
548 notes => 'true',
549 notesmsg => $flags->{'NOTES'}->{'message'}
555 my $amountold = $flags ? $flags->{'CHARGES'}->{'message'} || 0 : 0;
556 $amountold =~ s/^.*\$//; # remove upto the $, if any
558 my ( $total, $accts, $numaccts) = GetMemberAccountRecords( $borrowernumber );
560 if ( $patron && $patron->is_child) {
561 my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']});
562 $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1;
563 $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1;
566 my $messages = Koha::Patron::Messages->search(
568 'me.borrowernumber' => $borrowernumber,
571 join => 'manager',
572 '+select' => ['manager.surname', 'manager.firstname' ],
573 '+as' => ['manager_surname', 'manager_firstname'],
577 my $fast_cataloging = 0;
578 if ( Koha::BiblioFrameworks->find('FA') ) {
579 $fast_cataloging = 1
582 if (C4::Context->preference('ExtendedPatronAttributes')) {
583 my $attributes = GetBorrowerAttributes($borrowernumber);
584 $template->param(
585 ExtendedPatronAttributes => 1,
586 extendedattributes => $attributes
589 my $view = $batch
590 ?'batch_checkout_view'
591 : 'circview';
593 my @relatives;
594 if ( $borrowernumber ) {
595 if ( $patron ) {
596 if ( my $guarantor = $patron->guarantor ) {
597 push @relatives, $guarantor->borrowernumber;
598 push @relatives, $_->borrowernumber for $patron->siblings;
599 } else {
600 push @relatives, $_->borrowernumber for $patron->guarantees;
604 my $relatives_issues_count =
605 Koha::Database->new()->schema()->resultset('Issue')
606 ->count( { borrowernumber => \@relatives } );
608 if ( $patron ) {
609 my $av = Koha::AuthorisedValues->search({ category => 'ROADTYPE', authorised_value => $patron->streettype });
610 my $roadtype = $av->count ? $av->next->lib : '';
611 $template->param(
612 roadtype => $roadtype,
613 patron => $patron,
614 categoryname => $patron->category->description,
615 expiry => $patron->dateexpiry,
619 # Restore date if changed by holds and/or save stickyduedate to session
620 if ($restoreduedatespec || $stickyduedate) {
621 $duedatespec = $restoreduedatespec || $duedatespec;
623 if ($stickyduedate) {
624 $session->param( 'stickyduedate', $duedatespec );
626 } elsif (defined($duedatespec) && !defined($restoreduedatespec)) {
627 undef $duedatespec;
630 $template->param(
631 messages => $messages,
632 borrowernumber => $borrowernumber,
633 branch => $branch,
634 was_renewed => scalar $query->param('was_renewed') ? 1 : 0,
635 amountold => $amountold,
636 barcodes => $barcodes,
637 stickyduedate => $stickyduedate,
638 duedatespec => $duedatespec,
639 restoreduedatespec => $restoreduedatespec,
640 message => $message,
641 totaldue => sprintf('%.2f', $total),
642 inprocess => $inprocess,
643 $view => 1,
644 batch_allowed => $batch_allowed,
645 batch => $batch,
646 AudioAlerts => C4::Context->preference("AudioAlerts"),
647 fast_cataloging => $fast_cataloging,
648 CircAutoPrintQuickSlip => C4::Context->preference("CircAutoPrintQuickSlip"),
649 RoutingSerials => C4::Context->preference('RoutingSerials'),
650 relatives_issues_count => $relatives_issues_count,
651 relatives_borrowernumbers => \@relatives,
655 if ( C4::Context->preference("ExportCircHistory") ) {
656 $template->param(csv_profiles => [ Koha::CsvProfiles->search({ type => 'marc' }) ]);
659 my $has_modifications = Koha::Patron::Modifications->search( { borrowernumber => $borrowernumber } )->count;
660 $template->param(
661 debt_confirmed => $debt_confirmed,
662 SpecifyDueDate => $duedatespec_allow,
663 CircAutocompl => C4::Context->preference("CircAutocompl"),
664 debarments => scalar GetDebarments({ borrowernumber => $borrowernumber }),
665 todaysdate => output_pref( { dt => dt_from_string()->set(hour => 23)->set(minute => 59), dateformat => 'sql' } ),
666 has_modifications => $has_modifications,
667 override_high_holds => $override_high_holds,
668 nopermission => scalar $query->param('nopermission'),
669 autoswitched => $autoswitched,
672 output_html_with_http_headers $query, $cookie, $template->output;