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>.
20 # Display items which have been triggered for transfer, but not yet sent.
21 # CAVEAT: Currently limited to transfers prompted by stockrotation only.
27 use C4::Auth qw( get_template_and_user );
28 use C4::Output qw( output_html_with_http_headers );
30 use Koha::DateUtils qw( dt_from_string );
33 my $itemnumber = $input->param('itemnumber');
35 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user(
37 template_name => "circ/transfers_to_send.tt",
40 flagsrequired => { circulate => "circulate_remaining_permissions" },
44 # set the userenv branch
45 my $branchcode = C4::Context->userenv->{'branch'};
47 # transfers requested but not yet sent
48 my $transfers = Koha::Libraries->search(
50 'branchtransfers_tobranches.frombranch' => $branchcode,
51 'branchtransfers_tobranches.daterequested' => { '!=' => undef },
52 'branchtransfers_tobranches.datesent' => undef,
53 'branchtransfers_tobranches.datearrived' => undef,
54 'branchtransfers_tobranches.datecancelled' => undef,
57 prefetch => 'branchtransfers_tobranches',
58 order_by => 'branchtransfers_tobranches.tobranch'
63 libraries => $transfers,
64 show_date => dt_from_string
67 output_html_with_http_headers $input, $cookie, $template->output;