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
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
41 use Koha
::BiblioFrameworks
;
45 my $itemnumber = $input->param('itemnumber');
47 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user
(
49 template_name
=> "circ/transferstoreceive.tt",
53 flagsrequired
=> { circulate
=> "circulate_remaining_permissions" },
58 # set the userenv branch
59 my $default = C4
::Context
->userenv->{'branch'};
61 # get the all the branches for reference
62 my $libraries = Koha
::Libraries
->search({}, { order_by
=> 'branchname' });
65 while ( my $library = $libraries->next ) {
69 GetTransfersFromTo
( $library->branchcode, $default );
72 $branchloop{'branchname'} = $library->branchname;
73 $branchloop{'branchcode'} = $library->branchcode;
74 foreach my $num (@gettransfers) {
77 my ( $sent_year, $sent_month, $sent_day ) = split "-",
79 $sent_day = ( split " ", $sent_day )[0];
80 ( $sent_year, $sent_month, $sent_day ) =
81 Add_Delta_Days
( $sent_year, $sent_month, $sent_day,
82 C4
::Context
->preference('TransfersMaxDaysWarning'));
83 my $calcDate = Date_to_Days
( $sent_year, $sent_month, $sent_day );
84 my $today = Date_to_Days
(&Today
);
85 my $diff = $today - $calcDate;
87 if ($today > $calcDate) {
89 $getransf{'messcompa'} = 1;
90 $getransf{'diff'} = $diff;
93 my $item = Koha
::Items
->find( $num->{itemnumber
} );
94 my $biblio = $item->biblio;
95 my $itemtype = Koha
::ItemTypes
->find( $item->effective_itemtype );
97 $getransf{'datetransfer'} = $num->{'datesent'};
98 $getransf{'itemtype'} = $itemtype->description; # FIXME Should not it be translated_description?
101 title
=> $biblio->title,
102 subtitle
=> $biblio->subtitle,
103 medium
=> $biblio->medium,
104 part_number
=> $biblio->part_number,
105 part_name
=> $biblio->part_name,
106 author
=> $biblio->author,
107 biblionumber
=> $biblio->biblionumber,
108 itemnumber
=> $item->itemnumber,
109 barcode
=> $item->barcode,
110 homebranch
=> $item->homebranch,
111 holdingbranch
=> $item->holdingbranch,
112 itemcallnumber
=> $item->itemcallnumber,
115 # we check if we have a reserv for this transfer
116 my $holds = $item->current_holds;
117 if ( my $first_hold = $holds->next ) {
118 $getransf{patron
} = Koha
::Patrons
->find( $first_hold->borrowernumber );
120 push( @transferloop, \
%getransf );
123 # If we have a return of reservloop we put it in the branchloop sequence
124 $branchloop{'reserv'} = \
@transferloop;
126 push( @branchesloop, \
%branchloop ) if %branchloop;
130 branchesloop
=> \
@branchesloop,
131 show_date
=> output_pref
({ dt
=> dt_from_string
, dateformat
=> 'iso', dateonly
=> 1 }),
132 TransfersMaxDaysWarning
=> C4
::Context
->preference('TransfersMaxDaysWarning'),
133 latetransfers
=> $latetransfers ?
1 : 0,
136 # Checking if there is a Fast Cataloging Framework
137 $template->param( fast_cataloging
=> 1 ) if Koha
::BiblioFrameworks
->find( 'FA' );
139 output_html_with_http_headers
$input, $cookie, $template->output;