4 #script to display reports
6 # Copyright 2000-2002 Katipo Communications
8 # This file is part of Koha.
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
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.
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
23 # script now takes a branchcode arg
24 # eg: http://koha.rangitikei.katipo.co.nz/cgi-bin/koha/reports/reservereport.pl?branch=BL
28 use C4
::Dates qw
/format_date/;
31 use C4
::Branch
; # GetBranches
38 my $time = $input->param('time');
39 my $branch = $input->param('branch');
40 my $sort = $input->param('sort');
46 my $branches=GetBranches
();
48 my ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
50 template_name
=> "reports/reservereport.tmpl",
54 flagsrequired
=> { reports
=> 1 },
59 # building up branches dropdown box
65 foreach my $br (keys %$branches) {
68 $branch1{name
}=$branches->{$br}->{'branchname'};
70 push(@branchloop,\
%branch1);
73 my ( $count, $data ) = unfilledreserves
($branch);
77 for ( my $i = 0 ; $i < $count ; $i++ ) {
79 $toggle = $i%2 ?
0 : 1;
80 $line{'borrowernumber'} = $data->[$i]->{'borrowernumber'};
81 $line{'surname'} = $data->[$i]->{'surname'};
82 $line{'firstname'} = $data->[$i]->{'firstname'};
83 $line{'sortdate'} = $data->[$i]->{'reservedate'};
84 $line{'reservedate'} = format_date
($data->[$i]->{'reservedate'});
85 $line{'biblionumber'} = $data->[$i]->{'biblionumber'};
86 $line{'title'} = $data->[$i]->{'title'};
87 $line{'classification'} = $data->[$i]->{'classification'};
88 $line{'dewey'} = $data->[$i]->{'dewey'};
89 $line{'status'} = $data->[$i]->{'found'};
90 $line{'branchcode'} = $data->[$i]->{'branchcode'};
91 $line{'toggle'} = $toggle;
92 if ( $line{'status'} ne 'W' ) {
94 # its not waiting, we need to find if its on issue, or on the shelf
95 # FIXME still need to shift the text to the template so its translateable
97 # find if its on issue
98 my @items = GetItemsInfo
($line{'biblionumber'}, 'intra' );
100 foreach my $item (@items) {
101 if ( $item->{'datedue'} eq 'Reserved' ) {
103 if ($item->{'branchname'} eq ''){
104 $line{'status'}='In Transit';
107 $line{'status'} = "On shelf at $item->{'branchname'}";
117 $line{'status'} = 'On Issue';
121 $line{'status'}="Waiting for pickup";
125 push( @dataloop, \
%line );
128 if ($sort eq 'name'){
129 @dataloop = sort {$a->{'surname'} cmp $b->{'surname'}} @dataloop;
131 elsif ($sort eq 'date'){
132 @dataloop = sort {$a->{'sortdate'} cmp $b->{'sortdate'}} @dataloop;
134 elsif ($sort eq 'title'){
135 @dataloop = sort {$a->{'title'} cmp $b->{'title'}} @dataloop;
138 @dataloop = sort {$a->{'status'} cmp $b->{'status'}} @dataloop;
144 dataloop
=> \
@dataloop,
145 branchcode
=> $branch,
146 branchloop
=> \
@branchloop
150 output_html_with_http_headers
$input, $cookie, $template->output;