3 # Copyright 2019 PTFS-Europe Ltd.
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # Koha is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 use C4::Auth qw( get_template_and_user );
24 use C4::Output qw( output_html_with_http_headers );
26 use Koha::DateUtils qw( dt_from_string );
29 my $itemnumber = $input->param('itemnumber');
31 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
33 template_name => "circ/transfers_to_send.tt",
36 flagsrequired => { circulate => "circulate_remaining_permissions" },
40 # set the userenv branch
41 my $branchcode = C4::Context->userenv->{'branch'};
43 # transfers requested but not yet sent
44 my @transfers = Koha::Libraries->search(
46 'branchtransfers_tobranches.frombranch' => $branchcode,
47 'branchtransfers_tobranches.daterequested' => { '!=' => undef },
48 'branchtransfers_tobranches.datesent' => undef,
49 'branchtransfers_tobranches.datearrived' => undef,
50 'branchtransfers_tobranches.datecancelled' => undef,
53 prefetch => 'branchtransfers_tobranches',
54 order_by => 'branchtransfers_tobranches.tobranch'
59 libraries => \@transfers,
60 show_date => dt_from_string
63 output_html_with_http_headers $input, $cookie, $template->output;