small bugfix to make logout work
[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 HTML::Template;
8
9 my $query=new CGI;
10 my ($template, $borrowernumber, $cookie) 
11     = get_template_and_user({template_name => "opac-detail.tmpl",
12                              query => $query,
13                              type => "opac",
14                              authnotrequired => 1,
15                              flagsrequired => {borrow => 1},
16                              });
17
18 my $biblionumber=$query->param('bib');
19 $template->param(biblionumber => $biblionumber);
20
21
22 # change back when ive fixed request.pl
23 my @items                                 = &ItemInfo(undef, $biblionumber, 'opac');
24 my $dat                                   = &bibdata($biblionumber);
25 my ($authorcount, $addauthor)             = &addauthor($biblionumber);
26 my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber);
27 my ($websitecount, @websites)             = &getwebsites($biblionumber);
28
29 $dat->{'count'}=@items;
30
31 $dat->{'additional'}=$addauthor->[0]->{'author'};
32 for (my $i = 1; $i < $authorcount; $i++) {
33         $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'};
34 } # for
35
36 my $norequests = 1;
37 foreach my $itm (@items) {
38     $norequests = 0 unless $itm->{'notforloan'};
39     $itm->{$itm->{'publictype'}} = 1;
40 }
41
42 $template->param(norequests => $norequests);
43
44 my @results = ($dat,);
45
46 my $resultsarray=\@results;
47 my $itemsarray=\@items;
48 my $webarray=\@webbiblioitems;
49 my $sitearray=\@websites;
50
51 $template->param(BIBLIO_RESULTS => $resultsarray);
52 $template->param(ITEM_RESULTS => $itemsarray);
53 $template->param(WEB_RESULTS => $webarray);
54 $template->param(SITE_RESULTS => $sitearray);
55
56 print $query->header(-cookie => $cookie), $template->output;
57