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 $item = $input->param('itemnumber');
57 my $fbr = $input->param('fbr');
58 my $tbr = $input->param('tbr');
60 # If we have a return of the form dotransfer, we launch the subroutine dotransfer
62 C4
::Circulation
::Circ2
::ModItemTransfer
( $item, $fbr, $tbr );
65 # get the all the branches for reference
66 my $branches = GetBranches
();
69 foreach my $br ( keys %$branches ) {
73 GetReservesToBranch
( $branches->{$br}->{'branchcode'} );
75 $branchloop{'branchname'} = $branches->{$br}->{'branchname'};
76 $branchloop{'branchcode'} = $branches->{$br}->{'branchcode'};
77 foreach my $num (@getreserves) {
79 my $gettitle = GetBiblioFromItemNumber
( $num->{'itemnumber'} );
81 # warn Dumper($gettitle);
82 my $itemtypeinfo = getitemtypeinfo
( $gettitle->{'itemtype'} );
83 if ( $gettitle->{'holdingbranch'} eq $default ) {
85 GetMemberDetails
( $num->{'borrowernumber'} );
86 $getreserv{'reservedate'} =
87 format_date
( $num->{'reservedate'} );
88 my ( $reserve_year, $reserve_month, $reserve_day ) = split /-/,
89 $num->{'reservedate'};
90 ( $reserve_year, $reserve_month, $reserve_day ) =
91 Add_Delta_Days
( $reserve_year, $reserve_month, $reserve_day,
92 C4
::Context
->preference('ReservesMaxPickUpDelay'));
94 Date_to_Days
( $reserve_year, $reserve_month, $reserve_day );
95 my $today = Date_to_Days
(&Today
);
96 my $warning = ( $today > $calcDate );
99 $getreserv{'messcompa'} = 1;
101 $getreserv{'title'} = $gettitle->{'title'};
102 $getreserv{'biblionumber'} = $gettitle->{'biblionumber'};
103 $getreserv{'itemnumber'} = $gettitle->{'itemnumber'};
104 $getreserv{'barcode'} = $gettitle->{'barcode'};
105 $getreserv{'itemtype'} = $itemtypeinfo->{'description'};
106 $getreserv{'holdingbranch'} = $gettitle->{'holdingbranch'};
107 $getreserv{'itemcallnumber'} = $gettitle->{'itemcallnumber'};
108 $getreserv{'borrowernum'} = $getborrower->{'borrowernumber'};
109 $getreserv{'borrowername'} = $getborrower->{'surname'};
110 $getreserv{'borrowerfirstname'} = $getborrower->{'firstname'};
111 $getreserv{'borrowermail'} = $getborrower->{'emailaddress'};
112 $getreserv{'borrowerphone'} = $getborrower->{'phone'};
113 push( @reservloop, \
%getreserv );
117 # If we have a return of reservloop we put it in the branchloop sequence
119 $branchloop{'reserv'} = \
@reservloop;
121 # else, we unset the value of the branchcode .
123 $branchloop{'branchcode'} = 0;
126 push( @branchesloop, \
%branchloop ) if %branchloop;
130 branchesloop
=> \
@branchesloop,
131 show_date
=> format_date
(C4
::Dates
->today('iso')),
134 output_html_with_http_headers
$input, $cookie, $template->output;