Bug 7298: (follow-up) make CSV strings translatables.
[koha.git] / acqui / lateorders-export.pl
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
5 # Koha is free software; you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation; either version 2 of the License, or (at your option) any later
8 # version.
9 #
10 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with Koha; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 use Modern::Perl;
19 use CGI;
20
21 use C4::Auth;
22 use C4::Acquisition;
23 use C4::Output;
24 use C4::Context;
25
26 my $input = new CGI;
27 my ($template, $loggedinuser, $cookie) = get_template_and_user({
28     template_name => "acqui/csv/lateorders.tt",
29     query => $input,
30     type => "intranet",
31     authnotrequired => 0,
32     flagsrequired => {acquisition => 'order_receive'},
33 });
34 my @ordernumbers = $input->param('ordernumber');
35
36 my @orders;
37 for my $ordernumber ( @ordernumbers ) {
38     my $order = GetOrder $ordernumber;
39     push @orders, {
40             orderdate => $order->{orderdate},
41             latesince => $order->{latesince},
42             estimateddeliverydate => $order->{estimateddeliverydate},
43             supplier => $order->{supplier},
44             supplierid => $order->{supplierid},
45             title => $order->{title},
46             author => $order->{author},
47             publisher => $order->{publisher},
48             unitpricesupplier => $order->{unitpricesupplier},
49             quantity_to_receive => $order->{quantity_to_receive},
50             subtotal => $order->{subtotal},
51             budget => $order->{budget},
52             basketname => $order->{basketname},
53             basketno => $order->{basketno},
54             claims_count => $order->{claims_count},
55             claimed_date => $order->{claimed_date},
56         }
57     ;
58 }
59
60 print $input->header(
61     -type       => 'text/csv',
62     -attachment => 'lateorders.csv',
63 );
64 $template->param( orders => \@orders );
65 print $template->output;