Fixed reserve report script
[koha.git] / reports / reservereport.pl
1 #!/usr/bin/perl
2
3 #written 26/4/2000
4 #script to display reports
5
6 # Copyright 2000-2002 Katipo Communications
7 #
8 # This file is part of Koha.
9 #
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
13 # version.
14 #
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA  02111-1307 USA
22
23 use strict;
24 use C4::Stats;
25 use Date::Manip;
26 use CGI;
27 use C4::Output;
28 use HTML::Template;
29 use C4::Auth;
30 use C4::Interface::CGI::Output;
31
32 my $input = new CGI;
33 my $time  = $input->param('time');
34
35 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
36     {
37         template_name   => "reports/reservereport.tmpl",
38         query           => $input,
39         type            => "intranet",
40         authnotrequired => 0,
41         flagsrequired   => { editcatalogue => 1 },
42         debug           => 1,
43     }
44 );
45
46 my ( $count, $data ) = unfilledreserves();
47
48 my @dataloop;
49 for ( my $i = 0 ; $i < $count ; $i++ ) {
50     warn "here";
51     my %line;
52     $line{name} = "$data->[$i]->{'surname'}\, $data->[$i]->{'firstname'}";
53     $line{'reservedate'}    = $data->[$i]->{'reservedate'};
54     $line{'title'}          = $data->[$i]->{'title'};
55     $line{'classification'} =
56       "$data->[$i]->{'classification'}$data->[$i]->{'dewey'}";
57     push( @dataloop, \%line );
58 }
59
60 $template->param(
61     count    => $count,
62     dataloop => \@dataloop
63 );
64
65 output_html_with_http_headers $input, $cookie, $template->output;