Commenting out a line that was preventing the script executing
[koha.git] / acqui / lateorders.pl
1 #!/usr/bin/perl
2
3 use strict;
4 use CGI;
5 use C4::Acquisition;
6 use C4::Auth;
7 use C4::Koha;
8 use C4::Output;
9 use C4::Interface::CGI::Output;
10 use C4::Context;
11 use HTML::Template;
12
13 my $query = new CGI;
14 my ($template, $loggedinuser, $cookie)
15 = get_template_and_user({template_name => "acqui/lateorders.tmpl",
16                                 query => $query,
17                                 type => "intranet",
18                                 authnotrequired => 0,
19                                 flagsrequired => {acquisition => 1},
20                                 debug => 1,
21                                 });
22 # my $title = $query->param('title');
23 # my $ISSN = $query->param('ISSN');
24 # my @subscriptions = getsubscriptions($title,$ISSN);
25
26 my $supplierid = $query->param('supplierid');
27 my $delay = $query->param('delay');
28 my $branch = $query->param('branch');
29
30 $delay =($delay?$delay:30);
31
32 my %supplierlist = getsupplierlistwithlateorders($delay,$branch);
33 my @select_supplier;
34 push @select_supplier,"";
35 foreach my $supplierid (keys %supplierlist){
36         push @select_supplier, $supplierid;
37 }
38 my $CGIsupplier=CGI::scrolling_list( -name     => 'supplierid',
39                         -values   => \@select_supplier,
40                         -default  => $supplierid,
41                         -labels   => \%supplierlist,
42                         -size     => 1,
43                         -multiple => 0 );
44
45 $template->param(Supplier=>$supplierlist{$supplierid}) if ($supplierid);
46
47 my $branches = getbranches;
48 my @branchloop;
49 foreach my $thisbranch (sort keys %$branches) {
50         my %row =(value => $thisbranch,
51                                 branchname => $branches->{$thisbranch}->{'branchname'},
52                         );
53         push @branchloop, \%row;
54 }
55
56 my ($count, @lateorders) = getlateorders($delay,$supplierid,$branch);
57 my $total;
58 foreach my $lateorder (@lateorders){
59         $total+=$lateorder->{subtotal};
60 }
61 $template->param(delay=>$delay) if ($delay);
62 $template->param(
63         branchloop => \@branchloop,
64         CGIsupplier => $CGIsupplier,
65         lateorders => \@lateorders,
66         total=>$total,
67         );
68 output_html_with_http_headers $query, $cookie, $template->output;