minor template changes
[koha.git] / catalogue / issuehistory.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 with
15 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16 # Suite 330, Boston, MA  02111-1307 USA
17
18 # $Id$
19
20 use strict;
21 require Exporter;
22 use CGI;
23 use C4::Auth;
24 use C4::Output;
25
26 use C4::Circulation;    # GetBiblioIssues
27
28 my $query = new CGI;
29 my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
30     {
31         template_name   => "catalogue/issuehistory.tmpl",
32         query           => $query,
33         type            => "intranet",
34         authnotrequired => 0,
35         flagsrequired   => { circulate => 1 },
36     }
37 );
38
39 # getting cgi params.
40 my $params = $query->Vars;
41
42 my $biblionumber = $params->{'biblionumber'};
43 my $title        = $params->{'title'};
44 my $author       = $params->{'author'};
45
46 my $issues = GetBiblioIssues($biblionumber);
47 my $total  = scalar @$issues;
48
49 if ( $total && !$title ) {
50     $title  = $issues->[0]->{'title'};
51     $author = $issues->[0]->{'author'};
52 }
53
54 $template->param(
55     biblionumber => $biblionumber,
56     total        => scalar @$issues,
57     title        => $title,
58     author       => $author,
59     issues       => $issues
60 );
61
62 output_html_with_http_headers $query, $cookie, $template->output;