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