New XML API
[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 C4::Date;
26 use CGI;
27 use C4::Output;
28 use C4::Auth;
29 use C4::Interface::CGI::Output;
30
31 my $input = new CGI;
32 my $time  = $input->param('time');
33
34 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
35     {
36         template_name   => "reports/reservereport.tmpl",
37         query           => $input,
38         type            => "intranet",
39         authnotrequired => 0,
40         flagsrequired   => { editcatalogue => 1 },
41         debug           => 1,
42     }
43 );
44
45 my ( $count, $data ) = unfilledreserves();
46
47 my @dataloop;
48 my $toggle;
49 for ( my $i = 0 ; $i < $count ; $i++ ) {
50     my %line;
51         $toggle = $i%2 ? 0 : 1;
52         $line{'borrowernumber'} = $data->[$i]->{'borrowernumber'};
53         $line{'surname'} = $data->[$i]->{'surname'};
54         $line{'firstname'} = $data->[$i]->{'firstname'};
55     $line{'reservedate'}    = format_date($data->[$i]->{'reservedate'});
56         $line{'biblionumber'} = $data->[$i]->{'biblionumber'};
57         $line{'title'} = $data->[$i]->{'title'};
58         $line{'classification'} = $data->[$i]->{'classification'};
59         $line{'dewey'} = $data->[$i]->{'dewey'};
60     $line{'status'} = $data->[$i]->{'found'};
61         $line{'toggle'} = $toggle;
62
63     push( @dataloop, \%line );
64 }
65
66
67 $template->param(
68     count    => $count,
69     dataloop => \@dataloop
70 );
71
72 output_html_with_http_headers $input, $cookie, $template->output;