4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
25 use C4
::Branch
; # GetBranches
27 use C4
::Dates qw
/format_date/;
42 my ( $template, $loggedinuser, $cookie ) = get_template_and_user
(
44 template_name
=> "circ/transferstodo.tmpl",
48 flagsrequired
=> { circulate
=> 1 },
53 # set the userenv branch
54 my $default = C4
::Context
->userenv->{'branch'};
56 my @datearr = localtime( time() );
58 ( 1900 + $datearr[5] ) . '-'
59 . sprintf( "%0.2d", ( $datearr[4] + 1 ) ) . '-'
60 . sprintf( "%0.2d", $datearr[3] );
62 my $item = $input->param('itemnumber');
63 my $fbr = $input->param('fbr');
64 my $tbr = $input->param('tbr');
66 # If we have a return of the form dotransfer, we launch the subroutine dotransfer
68 C4
::Circulation
::Circ2
::ModItemTransfer
( $item, $fbr, $tbr );
71 # get the all the branches for reference
72 my $branches = GetBranches
();
75 foreach my $br ( keys %$branches ) {
79 GetReservesToBranch
( $branches->{$br}->{'branchcode'} );
81 $branchloop{'branchname'} = $branches->{$br}->{'branchname'};
82 $branchloop{'branchcode'} = $branches->{$br}->{'branchcode'};
83 foreach my $num (@getreserves) {
85 my $gettitle = GetBiblioFromItemNumber
( $num->{'itemnumber'} );
87 # warn Dumper($gettitle);
88 my $itemtypeinfo = getitemtypeinfo
( $gettitle->{'itemtype'} );
89 if ( $gettitle->{'holdingbranch'} eq $default ) {
91 GetMemberDetails
( $num->{'borrowernumber'} );
92 $getreserv{'reservedate'} =
93 format_date
( $num->{'reservedate'} );
94 my ( $reserve_year, $reserve_month, $reserve_day ) = split /-/,
95 $num->{'reservedate'};
96 ( $reserve_year, $reserve_month, $reserve_day ) =
97 Add_Delta_Days
( $reserve_year, $reserve_month, $reserve_day,
98 C4
::Context
->preference('ReservesMaxPickUpDelay'));
100 Date_to_Days
( $reserve_year, $reserve_month, $reserve_day );
101 my $today = Date_to_Days
(&Today
);
102 my $warning = ( $today > $calcDate );
104 if ( $warning > 0 ) {
105 $getreserv{'messcompa'} = 1;
107 $getreserv{'title'} = $gettitle->{'title'};
108 $getreserv{'biblionumber'} = $gettitle->{'biblionumber'};
109 $getreserv{'itemnumber'} = $gettitle->{'itemnumber'};
110 $getreserv{'barcode'} = $gettitle->{'barcode'};
111 $getreserv{'itemtype'} = $itemtypeinfo->{'description'};
112 $getreserv{'holdingbranch'} = $gettitle->{'holdingbranch'};
113 $getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
114 $getreserv{'borrowernum'} = $getborrower->{'borrowernumber'};
115 $getreserv{'borrowername'} = $getborrower->{'surname'};
116 $getreserv{'borrowerfirstname'} = $getborrower->{'firstname'};
117 $getreserv{'borrowermail'} = $getborrower->{'emailaddress'};
118 $getreserv{'borrowerphone'} = $getborrower->{'phone'};
119 push( @reservloop, \
%getreserv );
123 # If we have a return of reservloop we put it in the branchloop sequence
125 $branchloop{'reserv'} = \
@reservloop;
127 # else, we unset the value of the branchcode .
129 $branchloop{'branchcode'} = 0;
132 push( @branchesloop, \
%branchloop ) if %branchloop;
136 branchesloop
=> \
@branchesloop,
137 show_date
=> format_date
($todaysdate)
140 output_html_with_http_headers
$input, $cookie, $template->output;