Bug 10694 - Allow arbitrary backdating of returns
[koha.git] / circ / returns.pl
1 #!/usr/bin/perl
2
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.
8 #
9 # This file is part of Koha.
10 #
11 # Koha is free software; you can redistribute it and/or modify it under the
12 # terms of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
14 # version.
15 #
16 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
17 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
18 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License along
21 # with Koha; if not, write to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
24 =head1 returns.pl
25
26 script to execute returns of books
27
28 =cut
29
30 use strict;
31 use warnings;
32
33 use CGI;
34 use DateTime;
35 use C4::Context;
36 use C4::Auth qw/:DEFAULT get_session/;
37 use C4::Output;
38 use C4::Circulation;
39 use C4::Print;
40 use C4::Reserves;
41 use C4::Biblio;
42 use C4::Items;
43 use C4::Members;
44 use C4::Branch; # GetBranches GetBranchName
45 use C4::Koha;   # FIXME : is it still useful ?
46 use C4::RotatingCollections;
47 use Koha::DateUtils;
48 use Koha::Calendar;
49
50 my $query = new CGI;
51
52 #getting the template
53 my ( $template, $librarian, $cookie ) = get_template_and_user(
54     {
55         template_name   => "circ/returns.tmpl",
56         query           => $query,
57         type            => "intranet",
58         authnotrequired => 0,
59         flagsrequired   => { circulate => "circulate_remaining_permissions" },
60     }
61 );
62
63 my $sessionID = $query->cookie("CGISESSID");
64 my $session = get_session($sessionID);
65 if ($session->param('branch') eq 'NO_LIBRARY_SET'){
66     # no branch set we can't return
67     print $query->redirect("/cgi-bin/koha/circ/selectbranchprinter.pl");
68     exit;
69 }
70
71 #####################
72 #Global vars
73 my $branches = GetBranches();
74 my $printers = GetPrinters();
75 my $userenv = C4::Context->userenv;
76 my $userenv_branch = $userenv->{'branch'} // '';
77 my $printer = $userenv->{'branchprinter'} // '';
78
79 my $overduecharges = (C4::Context->preference('finesMode') && C4::Context->preference('finesMode') ne 'off');
80 #
81 # Some code to handle the error if there is no branch or printer setting.....
82 #
83
84 # Set up the item stack ....
85 my %returneditems;
86 my %riduedate;
87 my %riborrowernumber;
88 my @inputloop;
89 foreach ( $query->param ) {
90     my $counter;
91     if (/ri-(\d*)/) {
92         $counter = $1;
93         if ($counter > 20) {
94             next;
95         }
96     }
97     else {
98         next;
99     }
100
101     my %input;
102     my $barcode        = $query->param("ri-$counter");
103     my $duedate        = $query->param("dd-$counter");
104     my $borrowernumber = $query->param("bn-$counter");
105     $counter++;
106
107     # decode barcode    ## Didn't we already decode them before passing them back last time??
108     $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
109     $barcode = barcodedecode($barcode) if(C4::Context->preference('itemBarcodeInputFilter'));
110
111     ######################
112     #Are these lines still useful ?
113     $returneditems{$counter}    = $barcode;
114     $riduedate{$counter}        = $duedate;
115     $riborrowernumber{$counter} = $borrowernumber;
116
117     #######################
118     $input{counter}        = $counter;
119     $input{barcode}        = $barcode;
120     $input{duedate}        = $duedate;
121     $input{borrowernumber} = $borrowernumber;
122     push( @inputloop, \%input );
123 }
124
125 ############
126 # Deal with the requests....
127
128 if ($query->param('WT-itemNumber')){
129         updateWrongTransfer ($query->param('WT-itemNumber'),$query->param('WT-waitingAt'),$query->param('WT-From'));
130 }
131
132 if ( $query->param('resbarcode') ) {
133     my $item           = $query->param('itemnumber');
134     my $borrowernumber = $query->param('borrowernumber');
135     my $resbarcode     = $query->param('resbarcode');
136     my $diffBranchReturned = $query->param('diffBranch');
137     my $iteminfo   = GetBiblioFromItemNumber($item);
138     # fix up item type for display
139     $iteminfo->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $iteminfo->{'itype'} : $iteminfo->{'itemtype'};
140     my $diffBranchSend = ($userenv_branch ne $diffBranchReturned) ? $diffBranchReturned : undef;
141 # diffBranchSend tells ModReserveAffect whether document is expected in this library or not,
142 # i.e., whether to apply waiting status
143     ModReserveAffect( $item, $borrowernumber, $diffBranchSend);
144 #   check if we have other reserves for this document, if we have a return send the message of transfer
145     my ( $messages, $nextreservinfo ) = GetOtherReserves($item);
146
147     my ($borr) = GetMemberDetails( $nextreservinfo, 0 );
148     my $name   = $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
149     if ( $messages->{'transfert'} ) {
150         $template->param(
151             itemtitle      => $iteminfo->{'title'},
152             itemnumber     => $iteminfo->{'itemnumber'},
153             itembiblionumber => $iteminfo->{'biblionumber'},
154             iteminfo       => $iteminfo->{'author'},
155             tobranchname   => GetBranchName($messages->{'transfert'}),
156             name           => $name,
157             borrowernumber => $borrowernumber,
158             borcnum        => $borr->{'cardnumber'},
159             borfirstname   => $borr->{'firstname'},
160             borsurname     => $borr->{'surname'},
161             diffbranch     => 1,
162         );
163     }
164 }
165
166 my $borrower;
167 my $returned = 0;
168 my $messages;
169 my $issueinformation;
170 my $itemnumber;
171 my $barcode     = $query->param('barcode');
172 my $exemptfine  = $query->param('exemptfine');
173 if (
174   $exemptfine &&
175   !C4::Auth::haspermission(C4::Context->userenv->{'id'}, {'updatecharges' => 'writeoff'})
176 ) {
177     # silently prevent unauthorized operator from forgiving overdue
178     # fines by manually tweaking form parameters
179     undef $exemptfine;
180 }
181 my $dropboxmode = $query->param('dropboxmode');
182 my $dotransfer  = $query->param('dotransfer');
183 my $canceltransfer = $query->param('canceltransfer');
184 my $dest = $query->param('dest');
185 my $calendar    = Koha::Calendar->new( branchcode => $userenv_branch );
186 #dropbox: get last open day (today - 1)
187 my $today       = DateTime->now( time_zone => C4::Context->tz());
188 my $dropboxdate = $calendar->addDate($today, -1);
189
190 my $return_date_override = $query->param('return_date_override');
191 my $return_date_override_remember =
192   $query->param('return_date_override_remember');
193 if ($return_date_override) {
194     if ( C4::Context->preference('SpecifyReturnDate') ) {
195         if ( $return_date_override =~ C4::Dates->regexp('syspref') ) {
196
197             # Save the original format if we are remembering for this series
198             $template->param(
199                 return_date_override          => $return_date_override,
200                 return_date_override_remember => 1
201             ) if ($return_date_override_remember);
202
203             my $dt = dt_from_string($return_date_override);
204             $return_date_override =
205               DateTime::Format::MySQL->format_datetime($dt);
206         }
207     }
208     else {
209         $return_date_override = q{};
210     }
211 }
212
213 if ($dotransfer){
214 # An item has been returned to a branch other than the homebranch, and the librarian has chosen to initiate a transfer
215     my $transferitem = $query->param('transferitem');
216     my $tobranch     = $query->param('tobranch');
217     ModItemTransfer($transferitem, $userenv_branch, $tobranch); 
218 }
219
220 if ($canceltransfer){
221     $itemnumber=$query->param('itemnumber');
222     DeleteTransfer($itemnumber);
223     if($dest eq "ttr"){
224         print $query->redirect("/cgi-bin/koha/circ/transferstoreceive.pl");
225         exit;
226     } else {
227         $template->param( transfercancelled => 1);
228     }
229 }
230
231 # actually return book and prepare item table.....
232 if ($barcode) {
233     $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace
234     $barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
235     $itemnumber = GetItemnumberFromBarcode($barcode);
236
237     if ( C4::Context->preference("InProcessingToShelvingCart") ) {
238         my $item = GetItem( $itemnumber );
239         if ( $item->{'location'} eq 'PROC' ) {
240             $item->{'location'} = 'CART';
241             ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
242         }
243     }
244
245 #
246 # save the return
247 #
248     ( $returned, $messages, $issueinformation, $borrower ) =
249       AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override );
250     my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn');
251     $homeorholdingbranchreturn ||= 'homebranch';
252
253     # get biblio description
254     my $biblio = GetBiblioFromItemNumber($itemnumber);
255     # fix up item type for display
256     $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
257
258     # Check if we should display a checkin message, based on the the item
259     # type of the checked in item
260     my $itemtype = C4::ItemType->get( $biblio->{'itemtype'} );
261     if ( $itemtype->{'checkinmsg'} ) {
262         $template->param(
263             checkinmsg     => $itemtype->{'checkinmsg'},
264             checkinmsgtype => $itemtype->{'checkinmsgtype'},
265         );
266     }
267
268     $template->param(
269         title            => $biblio->{'title'},
270         homebranch       => $biblio->{'homebranch'},
271         homebranchname   => GetBranchName( $biblio->{$homeorholdingbranchreturn} ),
272         author           => $biblio->{'author'},
273         itembarcode      => $biblio->{'barcode'},
274         itemtype         => $biblio->{'itemtype'},
275         ccode            => $biblio->{'ccode'},
276         itembiblionumber => $biblio->{'biblionumber'},    
277         additional_materials => $biblio->{'materials'}
278     );
279
280     my %input = (
281         counter => 0,
282         first   => 1,
283         barcode => $barcode,
284     );
285
286     if ($returned) {
287         my $time_now = DateTime->now( time_zone => C4::Context->tz )->truncate( to => 'minute');
288         my $duedate = $issueinformation->{date_due}->strftime('%Y-%m-%d %H:%M');
289         $returneditems{0}      = $barcode;
290         $riborrowernumber{0}   = $borrower->{'borrowernumber'};
291         $riduedate{0}          = $duedate;
292         $input{borrowernumber} = $borrower->{'borrowernumber'};
293         $input{duedate}        = $duedate;
294         $input{return_overdue} = 1 if (DateTime->compare($issueinformation->{date_due}, $time_now) == -1);
295         push( @inputloop, \%input );
296
297         if ( C4::Context->preference("FineNotifyAtCheckin") ) {
298             my ( $od, $issue, $fines ) = GetMemberIssuesAndFines( $borrower->{'borrowernumber'} );
299             if ($fines && $fines > 0) {
300                 $template->param( fines => sprintf("%.2f",$fines) );
301                 $template->param( fineborrowernumber => $borrower->{'borrowernumber'} );
302             }
303         }
304         
305         if (C4::Context->preference("WaitingNotifyAtCheckin") ) {
306             #Check for waiting holds
307             my @reserves = GetReservesFromBorrowernumber($borrower->{'borrowernumber'});
308             my $waiting_holds = 0;
309             foreach my $num_res (@reserves) {
310                 if ( $num_res->{'found'} eq 'W' && $num_res->{'branchcode'} eq $userenv_branch) {
311                     $waiting_holds++;
312                 }
313             } 
314             if ($waiting_holds > 0) {
315                 $template->param(
316                     waiting_holds       => $waiting_holds,
317                     holdsborrowernumber => $borrower->{'borrowernumber'},
318                     holdsfirstname => $borrower->{'firstname'},
319                     holdssurname => $borrower->{'surname'},
320                 );
321             }
322         }
323     }
324     elsif ( !$messages->{'BadBarcode'} ) {
325         $input{duedate}   = 0;
326         $returneditems{0} = $barcode;
327         $riduedate{0}     = 0;
328         push( @inputloop, \%input );
329     }
330 }
331 $template->param( inputloop => \@inputloop );
332
333 my $found    = 0;
334 my $waiting  = 0;
335 my $reserved = 0;
336
337 # new op dev : we check if the document must be returned to his homebranch directly,
338 #  if the document is transfered, we have warning message .
339
340 if ( $messages->{'WasTransfered'} ) {
341     $template->param(
342         found          => 1,
343         transfer       => 1,
344         itemnumber     => $itemnumber,
345     );
346 }
347
348 if ( $messages->{'NeedsTransfer'} ){
349     $template->param(
350         found          => 1,
351         needstransfer  => 1,
352         itemnumber     => $itemnumber,
353     );
354 }
355
356 if ( $messages->{'Wrongbranch'} ){
357     $template->param(
358         wrongbranch => 1,
359     );
360 }
361
362 # case of wrong transfert, if the document wasn't transfered to the right library (according to branchtransfer (tobranch) BDD)
363
364 if ( $messages->{'WrongTransfer'} and not $messages->{'WasTransfered'}) {
365     $template->param(
366         WrongTransfer  => 1,
367         TransferWaitingAt => $messages->{'WrongTransfer'},
368         WrongTransferItem => $messages->{'WrongTransferItem'},
369         itemnumber => $itemnumber,
370     );
371
372     my $reserve    = $messages->{'ResFound'};
373     my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
374     my ($borr) = GetMemberDetails( $reserve->{'borrowernumber'}, 0 );
375     my $name = $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'};
376     $template->param(
377             wname           => $name,
378             wborfirstname   => $borr->{'firstname'},
379             wborsurname     => $borr->{'surname'},
380             wbortitle       => $borr->{'title'},
381             wborphone       => $borr->{'phone'},
382             wboremail       => $borr->{'email'},
383             wboraddress     => $borr->{'address'},
384             wboraddress2    => $borr->{'address2'},
385             wborcity        => $borr->{'city'},
386             wborzip         => $borr->{'zipcode'},
387             wborrowernumber => $reserve->{'borrowernumber'},
388             wborcnum        => $borr->{'cardnumber'},
389             wtransfertFrom  => $userenv_branch,
390     );
391 }
392
393 #
394 # reserve found and item arrived at the expected branch
395 #
396 if ( $messages->{'ResFound'}) {
397     my $reserve    = $messages->{'ResFound'};
398     my $branchname = $branches->{ $reserve->{'branchcode'} }->{'branchname'};
399     my ($borr) = GetMemberDetails( $reserve->{'borrowernumber'}, 0 );
400
401     if ( $reserve->{'ResFound'} eq "Waiting" or $reserve->{'ResFound'} eq "Reserved" ) {
402         if ( $reserve->{'ResFound'} eq "Waiting" ) {
403             $template->param(
404                 waiting      => ($userenv_branch eq $reserve->{'branchcode'} ? 1 : 0 ),
405             );
406         } elsif ( $reserve->{'ResFound'} eq "Reserved" ) {
407             $template->param(
408                 intransit    => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ),
409                 transfertodo => ($userenv_branch eq $reserve->{'branchcode'} ? 0 : 1 ),
410                 resbarcode   => $barcode,
411                 reserved     => 1,
412             );
413         }
414
415         # same params for Waiting or Reserved
416         $template->param(
417             found          => 1,
418             currentbranch  => $branches->{$userenv_branch}->{'branchname'},
419             destbranchname => $branches->{ $reserve->{'branchcode'} }->{'branchname'},
420             name           => $borr->{'surname'} . ", " . $borr->{'title'} . " " . $borr->{'firstname'},
421             borfirstname   => $borr->{'firstname'},
422             borsurname     => $borr->{'surname'},
423             bortitle       => $borr->{'title'},
424             borphone       => $borr->{'phone'},
425             boremail       => $borr->{'email'},
426             boraddress     => $borr->{'address'},
427             boraddress2    => $borr->{'address2'},
428             borcity        => $borr->{'city'},
429             borzip         => $borr->{'zipcode'},
430             borcnum        => $borr->{'cardnumber'},
431             debarred       => $borr->{'debarred'},
432             gonenoaddress  => $borr->{'gonenoaddress'},
433             barcode        => $barcode,
434             destbranch     => $reserve->{'branchcode'},
435             borrowernumber => $reserve->{'borrowernumber'},
436             itemnumber     => $reserve->{'itemnumber'},
437             reservenotes   => $reserve->{'reservenotes'},
438         );
439     } # else { ; }  # error?
440 }
441
442 # Error Messages
443 my @errmsgloop;
444 foreach my $code ( keys %$messages ) {
445     my %err;
446     my $exit_required_p = 0;
447     if ( $code eq 'BadBarcode' ) {
448         $err{badbarcode} = 1;
449         $err{msg}        = $messages->{'BadBarcode'};
450     }
451     elsif ( $code eq 'NotIssued' ) {
452         $err{notissued} = 1;
453         $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
454     }
455     elsif ( $code eq 'LocalUse' ) {
456         $err{localuse} = 1;
457     }
458     elsif ( $code eq 'WasLost' ) {
459         $err{waslost} = 1;
460     }
461     elsif ( $code eq 'LostItemFeeRefunded' ) {
462         $template->param( LostItemFeeRefunded => 1 );
463     }
464     elsif ( $code eq 'ResFound' ) {
465         ;    # FIXME... anything to do here?
466     }
467     elsif ( $code eq 'WasReturned' ) {
468         ;    # FIXME... anything to do here?
469     }
470     elsif ( $code eq 'WasTransfered' ) {
471         ;    # FIXME... anything to do here?
472     }
473     elsif ( $code eq 'withdrawn' ) {
474         $err{withdrawn} = 1;
475         $exit_required_p = 1 if C4::Context->preference("BlockReturnOfWithdrawnItems");
476     }
477     elsif ( ( $code eq 'IsPermanent' ) && ( not $messages->{'ResFound'} ) ) {
478         if ( $messages->{'IsPermanent'} ne $userenv_branch ) {
479             $err{ispermanent} = 1;
480             $err{msg}         =
481               $branches->{ $messages->{'IsPermanent'} }->{'branchname'};
482         }
483     }
484     elsif ( $code eq 'WrongTransfer' ) {
485         ;    # FIXME... anything to do here?
486     }
487     elsif ( $code eq 'WrongTransferItem' ) {
488         ;    # FIXME... anything to do here?
489     }
490     elsif ( $code eq 'NeedsTransfer' ) {
491     }
492     elsif ( $code eq 'Wrongbranch' ) {
493     }
494     elsif ( $code eq 'Debarred' ) {
495         $err{debarred}            = $messages->{'Debarred'};
496         $err{debarcardnumber}     = $borrower->{cardnumber};
497         $err{debarborrowernumber} = $borrower->{borrowernumber};
498         $err{debarname}           = "$borrower->{firstname} $borrower->{surname}";
499     }
500     else {
501         die "Unknown error code $code";    # note we need all the (empty) elsif's above, or we die.
502         # This forces the issue of staying in sync w/ Circulation.pm
503     }
504     if (%err) {
505         push( @errmsgloop, \%err );
506     }
507     last if $exit_required_p;
508 }
509 $template->param( errmsgloop => \@errmsgloop );
510
511 #set up so only the last 8 returned items display (make for faster loading pages)
512 my $returned_counter = ( C4::Context->preference('numReturnedItemsToShow') ) ? C4::Context->preference('numReturnedItemsToShow') : 8;
513 my $count = 0;
514 my @riloop;
515 my $shelflocations = GetKohaAuthorisedValues('items.location','');
516 foreach ( sort { $a <=> $b } keys %returneditems ) {
517     my %ri;
518     if ( $count++ < $returned_counter ) {
519         my $bar_code = $returneditems{$_};
520         if ($riduedate{$_}) {
521             my $duedate = dt_from_string( $riduedate{$_}, 'sql');
522             $ri{year}  = $duedate->year();
523             $ri{month} = $duedate->month();
524             $ri{day}   = $duedate->day();
525             $ri{hour}   = $duedate->hour();
526             $ri{minute}   = $duedate->minute();
527             $ri{duedate} = output_pref($duedate);
528             my ($b)      = GetMemberDetails( $riborrowernumber{$_}, 0 );
529             $ri{return_overdue} = 1 if (DateTime->compare($duedate, DateTime->now()) == -1 );
530             $ri{borrowernumber} = $b->{'borrowernumber'};
531             $ri{borcnum}        = $b->{'cardnumber'};
532             $ri{borfirstname}   = $b->{'firstname'};
533             $ri{borsurname}     = $b->{'surname'};
534             $ri{bortitle}       = $b->{'title'};
535             $ri{bornote}        = $b->{'borrowernotes'};
536             $ri{borcategorycode}= $b->{'categorycode'};
537         }
538         else {
539             $ri{borrowernumber} = $riborrowernumber{$_};
540         }
541
542         #        my %ri;
543         my $biblio = GetBiblioFromItemNumber(GetItemnumberFromBarcode($bar_code));
544         my $item   = GetItem( GetItemnumberFromBarcode($bar_code) );
545         # fix up item type for display
546         $biblio->{'itemtype'} = C4::Context->preference('item-level_itypes') ? $biblio->{'itype'} : $biblio->{'itemtype'};
547         $ri{itembiblionumber} = $biblio->{'biblionumber'};
548         $ri{itemtitle}        = $biblio->{'title'};
549         $ri{itemauthor}       = $biblio->{'author'};
550         $ri{itemcallnumber}   = $biblio->{'itemcallnumber'};
551         $ri{itemtype}         = $biblio->{'itemtype'};
552         $ri{itemnote}         = $biblio->{'itemnotes'};
553         $ri{ccode}            = $biblio->{'ccode'};
554         $ri{itemnumber}       = $biblio->{'itemnumber'};
555         $ri{barcode}          = $bar_code;
556         $ri{homebranch}       = $item->{'homebranch'};
557         $ri{holdingbranch}    = $item->{'holdingbranch'};
558
559         $ri{location}         = $biblio->{'location'};
560         my $shelfcode = $ri{'location'};
561         $ri{'location'} = $shelflocations->{$shelfcode} if ( defined( $shelfcode ) && defined($shelflocations) && exists( $shelflocations->{$shelfcode} ) );
562
563     }
564     else {
565         last;
566     }
567     push @riloop, \%ri;
568 }
569 my ($genbrname, $genprname);
570 if (my $b = $branches->{$userenv_branch}) {
571     $genbrname = $b->{'branchname'};
572 }
573 if (my $p = $printers->{$printer}) {
574     $genprname = $p->{'printername'};
575 }
576 $template->param(
577     riloop         => \@riloop,
578     genbrname      => $genbrname,
579     genprname      => $genprname,
580     branchname     => $genbrname,
581     printer        => $printer,
582     errmsgloop     => \@errmsgloop,
583     exemptfine     => $exemptfine,
584     dropboxmode    => $dropboxmode,
585     dropboxdate    => output_pref($dropboxdate),
586     overduecharges => $overduecharges,
587     soundon        => C4::Context->preference("SoundOn"),
588     BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
589 );
590
591 ### Comment out rotating collections for now to allow it a little more time to bake
592 ### for 3.4; in particular, must ensure that it doesn't fight with transfers required
593 ### to fill hold requests
594 ### -- Galen Charlton 2010-10-06
595 #my $itemnumber = GetItemnumberFromBarcode( $query->param('barcode') );
596 #if ( $itemnumber ) {
597 #   my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
598 #    if ( ! ( $holdingBranch eq $collectionBranch ) ) {
599 #        $template->param(
600 #          collectionItemNeedsTransferred => 1,
601 #          collectionBranch => GetBranchName($collectionBranch),
602 #        );
603 #    }
604 #}                                                                                                            
605
606 # actually print the page!
607 output_html_with_http_headers $query, $cookie, $template->output;