5 # Copyright 2000-2002 Katipo Communications
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
29 use C4::Circulation::Circ2;
37 my $theme = $input->param('theme'); # only used if allowthemeoverride is set
38 my $itemnumber = $input->param('itemnumber');
39 # if we have a resturn of the form to delete the transfer, we launch the subrroutine
41 C4::Circulation::Circ2::DeleteTransfer($itemnumber);
44 my ($template, $loggedinuser, $cookie)
45 = get_template_and_user({template_name => "circ/currenttransfers.tmpl",
49 flagsrequired => {borrowers => 1},
54 # set the userenv branch
55 my $default = C4::Context->userenv->{'branch'};
58 my @datearr = localtime(time());
59 my $todaysdate = (1900+$datearr[5]).'-'.sprintf ("%0.2d", ($datearr[4]+1)).'-'.sprintf ("%0.2d", $datearr[3]);
61 # get the all the branches for reference
62 my $branches = getbranches();
64 foreach my $br (keys %$branches) {
67 $branchloop{'branchname'} = $branches->{$br}->{'branchname'};
68 $branchloop{'branchcode'} = $branches->{$br}->{'branchcode'};
69 # # # # # # # # # # # # # # # # # # # # # #
70 my @gettransfers = GetTransfersFromBib($branches->{$br}->{'branchcode'},$default);
72 foreach my $num (@gettransfers) {
75 my $calcDate=DateCalc($num->{'datesent'},"+".C4::Context->preference('TransfersMaxDaysWarning')." days");
76 my $warning=Date_Cmp(ParseDate("today"),$calcDate);
78 $getransf{'messcompa'} = 1;
80 my $gettitle = getiteminformation(\%env,$num->{'itemnumber'});
81 $getransf{'title'} = $gettitle->{'title'};
82 $getransf{'datetransfer'} = format_date($num->{'datesent'});
83 $getransf{'biblionumber'} = $gettitle->{'biblionumber'};
84 $getransf{'itemnumber'} = $gettitle->{'itemnumber'};
85 $getransf{'barcode'} = $gettitle->{'barcode'};
86 # $getransf{'itemtype'} = ItemType($gettitle->{'itemtype'});
87 $getransf{'homebranch'} = $gettitle->{'homebranch'};
88 $getransf{'holdingbranch'} = $gettitle->{'holdingbranch'};
89 $getransf{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
91 # we check if we have a reserv for this transfer
92 my @checkreserv = FastFindReserves($num->{'itemnumber'});
94 my $getborrower = getpatroninformation (\%env,$checkreserv[1]);
95 $getransf{'borrowernum'} = $getborrower->{'borrowernumber'};
96 $getransf{'borrowername'} = $getborrower->{'surname'};
97 $getransf{'borrowerfirstname'} = $getborrower->{'firstname'};
98 if ($getborrower->{'emailaddress'}){
99 $getransf{'borrowermail'} = $getborrower->{'emailaddress'} ;
101 $getransf{'borrowerphone'} = $getborrower->{'phone'};
104 push(@transferloop, \%getransf);
106 # If we have a return of reservloop we put it in the branchloop sequence
107 $branchloop{'reserv'} = \@transferloop ;
110 # if we don't have a retrun from reservestobranch we unset branchname and branchcode
111 $branchloop{'branchname'} = 0;
112 $branchloop{'branchcode'} = 0;
114 push(@branchesloop, \%branchloop);
116 $template->param( branchesloop => \@branchesloop,
117 show_date => format_date($todaysdate)
120 print "Content-Type: text/html\n\n", $template->output;