*** empty log message ***
[koha.git] / opac / opac-detail.pl
1 #!/usr/bin/perl
2 use strict;
3 require Exporter;
4 use CGI;
5 use C4::Search;
6 use C4::Auth;
7 use C4::Interface::CGI::Output;
8 use HTML::Template;
9
10 my $query=new CGI;
11 my ($template, $borrowernumber, $cookie) 
12     = get_template_and_user({template_name => "opac-detail.tmpl",
13                              query => $query,
14                              type => "opac",
15                              authnotrequired => 1,
16                              flagsrequired => {borrow => 1},
17                              });
18
19 my $biblionumber=$query->param('bib');
20 $template->param(biblionumber => $biblionumber);
21
22
23 # change back when ive fixed request.pl
24 my @items                                 = &ItemInfo(undef, $biblionumber, 'opac');
25 my $dat                                   = &bibdata($biblionumber);
26 my ($authorcount, $addauthor)             = &addauthor($biblionumber);
27 my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber);
28 my ($websitecount, @websites)             = &getwebsites($biblionumber);
29
30 $dat->{'count'}=@items;
31
32 $dat->{'additional'}=$addauthor->[0]->{'author'};
33 for (my $i = 1; $i < $authorcount; $i++) {
34         $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'};
35 } # for
36
37 my $norequests = 1;
38 foreach my $itm (@items) {
39     $norequests = 0 unless $itm->{'notforloan'};
40     $itm->{$itm->{'publictype'}} = 1;
41 }
42
43 $template->param(norequests => $norequests);
44
45 my @results = ($dat,);
46
47 my $resultsarray=\@results;
48 my $itemsarray=\@items;
49 my $webarray=\@webbiblioitems;
50 my $sitearray=\@websites;
51
52 $template->param(BIBLIO_RESULTS => $resultsarray);
53 $template->param(ITEM_RESULTS => $itemsarray);
54 $template->param(WEB_RESULTS => $webarray);
55 $template->param(SITE_RESULTS => $sitearray);
56
57 output_html_with_http_headers $query, $cookie, $template->output;
58