Bug 14510: (QA followup) remove extraneous whitespace
[koha.git] / circ / returns.pl
blobec0679f8be737b90bf8ccaba50cd27c993b77675
1 #!/usr/bin/perl
3 # Copyright 2000-2002 Katipo Communications
4 # 2006 SAN-OP
5 # 2007-2010 BibLibre, Paul POULAIN
6 # 2010 Catalyst IT
7 # 2011 PTFS-Europe Ltd.
9 # This file is part of Koha.
11 # Koha is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 3 of the License, or
14 # (at your option) any later version.
16 # Koha is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with Koha; if not, see <http://www.gnu.org/licenses>.
24 =head1 returns.pl
26 script to execute returns of books
28 =cut
30 use strict;
31 use warnings;
33 use Carp 'verbose';
34 $SIG{ __DIE__ } = sub { Carp::confess( @_ ) };
36 use CGI qw ( -utf8 );
37 use DateTime;
38 use C4::Context;
39 use C4::Auth qw/:DEFAULT get_session/;
40 use C4::Output;
41 use C4::Circulation;
42 use C4::Print;
43 use C4::Reserves;
44 use C4::Biblio;
45 use C4::Items;
46 use C4::Members;
47 use C4::Branch; # GetBranches GetBranchName
48 use C4::Koha; # FIXME : is it still useful ?
49 use C4::RotatingCollections;
50 use Koha::DateUtils;
51 use Koha::Calendar;
53 my $query = new CGI;
55 #getting the template
56 my ( $template, $librarian, $cookie ) = get_template_and_user(
58 template_name => "circ/returns.tt",
59 query => $query,
60 type => "intranet",
61 authnotrequired => 0,
62 flagsrequired => { circulate => "circulate_remaining_permissions" },
66 my $sessionID = $query->cookie("CGISESSID");
67 my $session = get_session($sessionID);
68 if ($session->param('branch') eq 'NO_LIBRARY_SET'){
69 # no branch set we can't return
70 print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
71 exit;
74 # Print a reserve slip on this page
75 if ( $query->param('print_slip') ) {
76 $template->param(
77 print_slip => 1,
78 borrowernumber => $query->param('borrowernumber'),
79 biblionumber => $query->param('biblionumber'),
83 #####################
84 #Global vars
85 my $branches = GetBranches();
86 my $printers = GetPrinters();
87 my $userenv = C4::Context->userenv;
88 my $userenv_branch = $userenv->{'branch'} // '';
89 my $printer = $userenv->{'branchprinter'} // '';
90 my $forgivemanualholdsexpire = $query->param('forgivemanualholdsexpire');
92 my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
94 # Some code to handle the error if there is no branch or printer setting.....
97 # Set up the item stack ....
98 my %returneditems;
99 my %riduedate;
100 my %riborrowernumber;
101 my @inputloop;
102 foreach ( $query->param ) {
103 my $counter;
104 if (/ri-(\d*)/) {
105 $counter = $1;
106 if ($counter > 20) {
107 next;
110 else {
111 next;
114 my %input;
115 my $barcode = $query->param("ri-$counter");
116 my $duedate = $query->param("dd-$counter");
117 my $borrowernumber = $query->param("bn-$counter");
118 $counter++;
120 # decode barcode ## Didn't we already decode them before passing them back last time??
121 $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
122 $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
124 ######################
125 #Are these lines still useful ?
126 $returneditems{$counter} = $barcode;
127 $riduedate{$counter} = $duedate;
128 $riborrowernumber{$counter} = $borrowernumber;
130 #######################
131 $input{counter} = $counter;
132 $input{barcode} = $barcode;
133 $input{duedate} = $duedate;
134 $input{borrowernumber} = $borrowernumber;
135 push( @inputloop, \%input );
138 ############
139 # Deal with the requests....
141 if ($query->param('WT-itemNumber')){
142 updateWrongTransfer ($query->param('WT-itemNumber'),$query->param('WT-waitingAt'),$query->param('WT-From'));
145 if ( $query->param('resbarcode') ) {
146 my $item = $query->param('itemnumber');
147 my $borrowernumber = $query->param('borrowernumber');
148 my $resbarcode = $query->param('resbarcode');
149 my $diffBranchReturned = $query->param('diffBranch');
150 my $iteminfo = GetBiblioFromItemNumber($item);
151 my $cancel_reserve = $query->param('cancel_reserve');
152 # fix up item type for display
153 $iteminfo->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $iteminfo->{'itype'} : $iteminfo->{'itemtype'};
155 if ( $cancel_reserve ) {
156 CancelReserve({ borrowernumber => $borrowernumber, itemnumber => $item, charge_cancel_fee => !$forgivemanualholdsexpire });
157 } else {
158 my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
159 # diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
160 # i.e., whether to apply waiting status
161 ModReserveAffect( $item, $borrowernumber, $diffBranchSend);
163 # check if we have other reserves for this document, if we have a return send the message of transfer
164 my ( $messages, $nextreservinfo ) = GetOtherReserves($item);
166 my ($borr) = GetMemberDetails( $nextreservinfo, 0 );
167 my $name = $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
168 if ( $messages->{'transfert'} ) {
169 $template->param(
170 itemtitle => $iteminfo->{'title'},
171 itemnumber => $iteminfo->{'itemnumber'},
172 itembiblionumber => $iteminfo->{'biblionumber'},
173 iteminfo => $iteminfo->{'author'},
174 tobranchname => GetBranchName($messages->{'transfert'}),
175 name => $name,
176 borrowernumber => $borrowernumber,
177 borcnum => $borr->{'cardnumber'},
178 borfirstname => $borr->{'firstname'},
179 borsurname => $borr->{'surname'},
180 diffbranch => 1,
185 my $borrower;
186 my $returned = 0;
187 my $messages;
188 my $issueinformation;
189 my $itemnumber;
190 my $barcode = $query->param('barcode');
191 my $exemptfine = $query->param('exemptfine');
192 if (
193 $exemptfine &&
194 !C4::Auth::haspermission(C4::Context->userenv->{'id'}, {'updatecharges' => 'writeoff'})
196 # silently prevent unauthorized operator from forgiving overdue
197 # fines by manually tweaking form parameters
198 undef $exemptfine;
200 my $dropboxmode = $query->param('dropboxmode');
201 my $dotransfer = $query->param('dotransfer');
202 my $canceltransfer = $query->param('canceltransfer');
203 my $dest = $query->param('dest');
204 my $calendar = Koha::Calendar->new( branchcode => $userenv_branch );
205 #dropbox: get last open day (today - 1)
206 my $today = DateTime->now( time_zone => C4::Context->tz());
207 my $dropboxdate = $calendar->addDate($today, -1);
209 my $return_date_override = $query->param('return_date_override');
210 my $return_date_override_remember =
211 $query->param('return_date_override_remember');
212 if ($return_date_override) {
213 if ( C4::Context->preference('SpecifyReturnDate') ) {
214 # FIXME we really need to stop adding more uses of C4::Dates
215 if ( $return_date_override =~ C4::Dates->regexp('syspref') ) {
217 # note that we've overriden the return date
218 $template->param( return_date_was_overriden => 1);
219 # Save the original format if we are remembering for this series
220 $template->param(
221 return_date_override => $return_date_override,
222 return_date_override_remember => 1
223 ) if ($return_date_override_remember);
225 my $dt = dt_from_string($return_date_override);
226 $return_date_override =
227 DateTime::Format::MySQL->format_datetime($dt);
230 else {
231 $return_date_override = q{};
235 if ($dotransfer){
236 # An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
237 my $transferitem = $query->param('transferitem');
238 my $tobranch = $query->param('tobranch');
239 ModItemTransfer($transferitem, $userenv_branch, $tobranch);
242 if ($canceltransfer){
243 $itemnumber=$query->param('itemnumber');
244 DeleteTransfer($itemnumber);
245 if($dest eq "ttr"){
246 print $query->redirect("/cgi-bin/koha/circ/transferstoreceive.pl");
247 exit;
248 } else {
249 $template->param( transfercancelled => 1);
253 # actually return book and prepare item table.....
254 if ($barcode) {
255 $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
256 $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
257 $itemnumber = GetItemnumberFromBarcode($barcode);
260 # save the return
263 # get biblio description
264 my $biblio = GetBiblioFromItemNumber($itemnumber);
265 # fix up item type for display
266 $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
268 # Check if we should display a checkin message, based on the the item
269 # type of the checked in item
270 my $itemtype = C4::ItemType->get( $biblio->{'itemtype'} );
271 if ( $itemtype->{'checkinmsg'} ) {
272 $template->param(
273 checkinmsg => $itemtype->{'checkinmsg'},
274 checkinmsgtype => $itemtype->{'checkinmsgtype'},
278 # make sure return branch respects home branch circulation rules, default to homebranch
279 my $hbr = GetBranchItemRule($biblio->{'homebranch'}, $itemtype)->{'returnbranch'} || "homebranch";
280 my $returnbranch = $biblio->{$hbr} ;
282 $template->param(
283 title => $biblio->{'title'},
284 homebranch => $biblio->{'homebranch'},
285 returnbranch => $returnbranch,
286 author => $biblio->{'author'},
287 itembarcode => $biblio->{'barcode'},
288 itemtype => $biblio->{'itemtype'},
289 ccode => $biblio->{'ccode'},
290 itembiblionumber => $biblio->{'biblionumber'},
291 biblionumber => $biblio->{'biblionumber'},
292 borrower => $borrower,
293 additional_materials => $biblio->{'materials'},
296 my %input = (
297 counter => 0,
298 first => 1,
299 barcode => $barcode,
302 # do the return
303 ( $returned, $messages, $issueinformation, $borrower ) =
304 AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override, $dropboxdate );
306 if ($returned) {
307 my $time_now = DateTime->now( time_zone => C4::Context->tz )->truncate( to => 'minute');
308 my $duedate = $issueinformation->{date_due}->strftime('%Y-%m-%d %H:%M');
309 $returneditems{0} = $barcode;
310 $riborrowernumber{0} = $borrower->{'borrowernumber'};
311 $riduedate{0} = $duedate;
312 $input{borrowernumber} = $borrower->{'borrowernumber'};
313 $input{duedate} = $duedate;
314 unless ( $dropboxmode ) {
315 $input{return_overdue} = 1 if (DateTime->compare($issueinformation->{date_due}, DateTime->now()) == -1);
316 } else {
317 $input{return_overdue} = 1 if (DateTime->compare($issueinformation->{date_due}, $dropboxdate) == -1);
319 push( @inputloop, \%input );
321 if ( C4::Context->preference("FineNotifyAtCheckin") ) {
322 my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrower->{'borrowernumber'} );
323 if ($fines && $fines > 0) {
324 $template->param( fines => sprintf("%.2f",$fines) );
325 $template->param( fineborrowernumber => $borrower->{'borrowernumber'} );
329 if (C4::Context->preference("WaitingNotifyAtCheckin") ) {
330 #Check for waiting holds
331 my @reserves = GetReservesFromBorrowernumber($borrower->{'borrowernumber'});
332 my $waiting_holds = 0;
333 foreach my $num_res (@reserves) {
334 if ( $num_res->{'found'} eq 'W' && $num_res->{'branchcode'} eq $userenv_branch) {
335 $waiting_holds++;
338 if ($waiting_holds > 0) {
339 $template->param(
340 waiting_holds => $waiting_holds,
341 holdsborrowernumber => $borrower->{'borrowernumber'},
342 holdsfirstname => $borrower->{'firstname'},
343 holdssurname => $borrower->{'surname'},
348 elsif ( !$messages->{'BadBarcode'} ) {
349 $input{duedate} = 0;
350 $returneditems{0} = $barcode;
351 $riduedate{0} = 0;
352 push( @inputloop, \%input );
354 $template->param( privacy => $borrower->{privacy} );
356 $template->param( inputloop => \@inputloop );
358 my $found = 0;
359 my $waiting = 0;
360 my $reserved = 0;
362 # new op dev : we check if the document must be returned to his homebranch directly,
363 # if the document is transfered, we have warning message .
365 if ( $messages->{'WasTransfered'} ) {
366 $template->param(
367 found => 1,
368 transfer => 1,
369 itemnumber => $itemnumber,
373 if ( $messages->{'NeedsTransfer'} ){
374 $template->param(
375 found => 1,
376 needstransfer => $messages->{'NeedsTransfer'},
377 itemnumber => $itemnumber,
381 if ( $messages->{'Wrongbranch'} ){
382 $template->param(
383 wrongbranch => 1,
387 # case of wrong transfert, if the document wasn't transfered to the right library (according to branchtransfer (tobranch) BDD)
389 if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) {
390 $template->param(
391 WrongTransfer => 1,
392 TransferWaitingAt => $messages->{'WrongTransfer'},
393 WrongTransferItem => $messages->{'WrongTransferItem'},
394 itemnumber => $itemnumber,
397 my $reserve = $messages->{'ResFound'};
398 my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
399 my ($borr) = GetMemberDetails( $reserve->{'borrowernumber'}, 0 );
400 my $name = $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
401 $template->param(
402 wname => $name,
403 wborfirstname => $borr->{'firstname'},
404 wborsurname => $borr->{'surname'},
405 wbortitle => $borr->{'title'},
406 wborphone => $borr->{'phone'},
407 wboremail => $borr->{'email'},
408 wborstnum => $borr->{streetnumber},
409 wboraddress => $borr->{'address'},
410 wboraddress2 => $borr->{'address2'},
411 wborcity => $borr->{'city'},
412 wborzip => $borr->{'zipcode'},
413 wborrowernumber => $reserve->{'borrowernumber'},
414 wborcnum => $borr->{'cardnumber'},
415 wtransfertFrom => $userenv_branch,
420 # reserve found and item arrived at the expected branch
422 if ( $messages->{'ResFound'}) {
423 my $reserve = $messages->{'ResFound'};
424 my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
425 my ($borr) = GetMemberDetails( $reserve->{'borrowernumber'}, 0 );
427 if ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) {
428 if ( $reserve->{'ResFound'} eq "Waiting" ) {
429 $template->param(
430 waiting => ($userenv_branch eq $reserve->{'branchcode'} ? 1 : 0 ),
432 } elsif ( $reserve->{'ResFound'} eq "Reserved" ) {
433 $template->param(
434 intransit => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ),
435 transfertodo => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ),
436 resbarcode => $barcode,
437 reserved => 1,
441 # same params for Waiting or Reserved
442 $template->param(
443 found => 1,
444 currentbranch => $branches->{$userenv_branch}->{'branchname'},
445 destbranchname => $branches->{ $reserve->{'branchcode'} }->{'branchname'},
446 name => $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'},
447 borfirstname => $borr->{'firstname'},
448 borsurname => $borr->{'surname'},
449 bortitle => $borr->{'title'},
450 borphone => $borr->{'phone'},
451 boremail => $borr->{'email'},
452 boraddress => $borr->{'address'},
453 boraddress2 => $borr->{'address2'},
454 borstnum => $borr->{streetnumber},
455 borcity => $borr->{'city'},
456 borzip => $borr->{'zipcode'},
457 borcnum => $borr->{'cardnumber'},
458 debarred => $borr->{'debarred'},
459 gonenoaddress => $borr->{'gonenoaddress'},
460 barcode => $barcode,
461 destbranch => $reserve->{'branchcode'},
462 borrowernumber => $reserve->{'borrowernumber'},
463 itemnumber => $reserve->{'itemnumber'},
464 reservenotes => $reserve->{'reservenotes'},
466 } # else { ; } # error?
469 # Error Messages
470 my @errmsgloop;
471 foreach my $code ( keys %$messages ) {
472 my %err;
473 my $exit_required_p = 0;
474 if ( $code eq 'BadBarcode' ) {
475 $err{badbarcode} = 1;
476 $err{msg} = $messages->{'BadBarcode'};
478 elsif ( $code eq 'NotIssued' ) {
479 $err{notissued} = 1;
480 $err{msg} = '';
481 $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'} if $messages->{'IsPermanent'};
483 elsif ( $code eq 'LocalUse' ) {
484 $err{localuse} = 1;
486 elsif ( $code eq 'WasLost' ) {
487 $err{waslost} = 1;
489 elsif ( $code eq 'LostItemFeeRefunded' ) {
490 $template->param( LostItemFeeRefunded => 1 );
492 elsif ( $code eq 'ResFound' ) {
493 ; # FIXME... anything to do here?
495 elsif ( $code eq 'WasReturned' ) {
496 ; # FIXME... anything to do here?
498 elsif ( $code eq 'WasTransfered' ) {
499 ; # FIXME... anything to do here?
501 elsif ( $code eq 'withdrawn' ) {
502 $err{withdrawn} = 1;
503 $exit_required_p = 1 if C4::Context->preference("BlockReturnOfWithdrawnItems");
505 elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
506 if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
507 $err{ispermanent} = 1;
508 $err{msg} =
509 $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
512 elsif ( $code eq 'WrongTransfer' ) {
513 ; # FIXME... anything to do here?
515 elsif ( $code eq 'WrongTransferItem' ) {
516 ; # FIXME... anything to do here?
518 elsif ( $code eq 'NeedsTransfer' ) {
520 elsif ( $code eq 'Wrongbranch' ) {
522 elsif ( $code eq 'Debarred' ) {
523 $err{debarred} = $messages->{'Debarred'};
524 $err{debarcardnumber} = $borrower->{cardnumber};
525 $err{debarborrowernumber} = $borrower->{borrowernumber};
526 $err{debarname} = "$borrower->{firstname} $borrower->{surname}";
528 elsif ( $code eq 'PrevDebarred' ) {
529 $err{prevdebarred} = $messages->{'PrevDebarred'};
531 elsif ( $code eq 'ForeverDebarred' ) {
532 $err{foreverdebarred} = $messages->{'ForeverDebarred'};
534 elsif ( $code eq 'NotForLoanStatusUpdated' ) {
535 $err{NotForLoanStatusUpdated} = $messages->{NotForLoanStatusUpdated};
537 else {
538 die "Unknown error code $code"; # note we need all the (empty) elsif's above, or we die.
539 # This forces the issue of staying in sync w/ Circulation.pm
541 if (%err) {
542 push( @errmsgloop, \%err );
544 last if $exit_required_p;
546 $template->param( errmsgloop => \@errmsgloop );
548 #set up so only the last 8 returned items display (make for faster loading pages)
549 my $returned_counter = ( C4::Context->preference('numReturnedItemsToShow') ) ? C4::Context->preference('numReturnedItemsToShow') : 8;
550 my $count = 0;
551 my @riloop;
552 my $shelflocations = GetKohaAuthorisedValues('items.location','');
553 foreach ( sort { $a <=> $b } keys %returneditems ) {
554 my %ri;
555 if ( $count++ < $returned_counter ) {
556 my $bar_code = $returneditems{$_};
557 if ($riduedate{$_}) {
558 my $duedate = dt_from_string( $riduedate{$_}, 'sql');
559 $ri{year} = $duedate->year();
560 $ri{month} = $duedate->month();
561 $ri{day} = $duedate->day();
562 $ri{hour} = $duedate->hour();
563 $ri{minute} = $duedate->minute();
564 $ri{duedate} = output_pref($duedate);
565 my ($b) = GetMemberDetails( $riborrowernumber{$_}, 0 );
566 unless ( $dropboxmode ) {
567 $ri{return_overdue} = 1 if (DateTime->compare($duedate, DateTime->now()) == -1);
568 } else {
569 $ri{return_overdue} = 1 if (DateTime->compare($duedate, $dropboxdate) == -1);
571 $ri{borrowernumber} = $b->{'borrowernumber'};
572 $ri{borcnum} = $b->{'cardnumber'};
573 $ri{borfirstname} = $b->{'firstname'};
574 $ri{borsurname} = $b->{'surname'};
575 $ri{bortitle} = $b->{'title'};
576 $ri{bornote} = $b->{'borrowernotes'};
577 $ri{borcategorycode}= $b->{'categorycode'};
579 else {
580 $ri{borrowernumber} = $riborrowernumber{$_};
583 # my %ri;
584 my $biblio = GetBiblioFromItemNumber(GetItemnumberFromBarcode($bar_code));
585 my $item = GetItem( GetItemnumberFromBarcode($bar_code) );
586 # fix up item type for display
587 $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
588 $ri{itembiblionumber} = $biblio->{'biblionumber'};
589 $ri{itemtitle} = $biblio->{'title'};
590 $ri{itemauthor} = $biblio->{'author'};
591 $ri{itemcallnumber} = $biblio->{'itemcallnumber'};
592 $ri{itemtype} = $biblio->{'itemtype'};
593 $ri{itemnote} = $biblio->{'itemnotes'};
594 $ri{ccode} = $biblio->{'ccode'};
595 $ri{itemnumber} = $biblio->{'itemnumber'};
596 $ri{barcode} = $bar_code;
597 $ri{homebranch} = $item->{'homebranch'};
598 $ri{holdingbranch} = $item->{'holdingbranch'};
600 $ri{location} = $biblio->{'location'};
601 my $shelfcode = $ri{'location'};
602 $ri{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) );
605 else {
606 last;
608 push @riloop, \%ri;
610 my ($genbrname, $genprname);
611 if (my $b = $branches->{$userenv_branch}) {
612 $genbrname = $b->{'branchname'};
614 if (my $p = $printers->{$printer}) {
615 $genprname = $p->{'printername'};
617 $template->param(
618 riloop => \@riloop,
619 genbrname => $genbrname,
620 genprname => $genprname,
621 branchname => $genbrname,
622 printer => $printer,
623 errmsgloop => \@errmsgloop,
624 exemptfine => $exemptfine,
625 dropboxmode => $dropboxmode,
626 dropboxdate => output_pref($dropboxdate),
627 forgivemanualholdsexpire => $forgivemanualholdsexpire,
628 overduecharges => $overduecharges,
629 soundon => C4::Context->preference("SoundOn"),
630 BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
633 $itemnumber = GetItemnumberFromBarcode( $barcode );
634 if ( $itemnumber ) {
635 my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
636 $holdingBranch //= '';
637 $collectionBranch //= '';
638 if ( ! ( $holdingBranch eq $collectionBranch ) ) {
639 $template->param(
640 collectionItemNeedsTransferred => 1,
641 collectionBranch => GetBranchName($collectionBranch),
646 # actually print the page!
647 output_html_with_http_headers $query, $cookie, $template->output;