7 use C4::Bull; #uses getsubscriptionfrom biblionumber
8 use C4::Interface::CGI::Output;
14 my ($template, $borrowernumber, $cookie)
15 = get_template_and_user({template_name => "opac-detail.tmpl",
19 flagsrequired => {borrow => 1},
22 my $biblionumber=$query->param('bib');
23 $template->param(biblionumber => $biblionumber);
26 # change back when ive fixed request.pl
27 my @items = &ItemInfo(undef, $biblionumber, 'opac');
28 my $dat = &bibdata($biblionumber);
29 my ($authorcount, $addauthor) = &addauthor($biblionumber);
30 my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber);
31 my ($websitecount, @websites) = &getwebsites($biblionumber);
32 my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber);
34 $dat->{'count'}=@items;
36 $dat->{'additional'}=$addauthor->[0]->{'author'};
37 for (my $i = 1; $i < $authorcount; $i++) {
38 $dat->{'additional'} .= " ; " . $addauthor->[$i]->{'author'};
42 foreach my $itm (@items) {
43 $norequests = 0 unless $itm->{'notforloan'};
44 $itm->{$itm->{'publictype'}} = 1;
47 $template->param(norequests => $norequests);
49 ## get notes and subjects from MARC record
50 my $marc = C4::Context->preference("marc");
52 my $dbh = C4::Context->dbh;
53 my $bibid = &MARCfind_MARCbibid_from_oldbiblionumber($dbh,$biblionumber);
54 my $marcflavour = C4::Context->preference("marcflavour");
55 my $marcnotesarray = &getMARCnotes($dbh,$bibid,$marcflavour);
56 my $marcsubjctsarray = &getMARCsubjects($dbh,$bibid,$marcflavour);
58 $template->param(MARCNOTES => $marcnotesarray);
59 $template->param(MARCSUBJCTS => $marcsubjctsarray);
62 my @results = ($dat,);
64 my $resultsarray=\@results;
65 my $itemsarray=\@items;
66 my $webarray=\@webbiblioitems;
67 my $sitearray=\@websites;
69 $template->param(BIBLIO_RESULTS => $resultsarray,
70 ITEM_RESULTS => $itemsarray,
71 WEB_RESULTS => $webarray,
72 SITE_RESULTS => $sitearray,
73 subscriptionsnumber => $subscriptionsnumber,
77 my $isbn=$dat->{'isbn'};
78 my $amazon_details = &get_amazon_details($isbn);
79 foreach my $result (@{$amazon_details->{Details}}){
80 $template->param(item_description => $result->{ProductDescription});
81 $template->param(image => $result->{ImageUrlMedium});
82 $template->param(list_price => $result->{ListPrice});
83 $template->param(amazon_url => $result->{url});
88 for my $details( @{ $amazon_details->{ Details } } ) {
89 next unless $details->{ SimilarProducts };
90 for my $product ( @{ $details->{ SimilarProducts }->{ Product } } ) {
91 push @products, +{ Product => $product };
93 next unless $details->{ Reviews };
94 for my $product ( @{ $details->{ Reviews }->{ AvgCustomerRating } } ) {
95 $template->param(rating => $product);
97 for my $reviews ( @{ $details->{ Reviews }->{ CustomerReview } } ) {
98 push @reviews, +{ Summary => $reviews->{ Summary }, Comment => $reviews->{ Comment }, };
101 $template->param( SIMILAR_PRODUCTS => \@products );
102 $template->param( REVIEWS => \@reviews );
103 ## End of Amazon Stuff
105 output_html_with_http_headers $query, $cookie, $template->output;