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