3 # This file is part of Koha.
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
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.
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
23 use C4
::Serials
; #uses getsubscriptionfrom biblionumber
27 use C4
::XISBN
qw(get_xisbns get_biblio_from_xisbn);
31 my ( $template, $borrowernumber, $cookie ) = get_template_and_user
(
33 template_name
=> "catalogue/detail.tmpl",
37 flagsrequired
=> { catalogue
=> 1 },
41 my $biblionumber = $query->param('biblionumber');
43 # change back when ive fixed request.pl
44 my @items = &GetItemsInfo
( $biblionumber, 'intra' );
45 my $dat = &GetBiblioData
($biblionumber);
48 print $query->redirect("/cgi-bin/koha/koha-tmpl/errors/404.pl");
51 #coping with subscriptions
52 my $subscriptionsnumber = CountSubscriptionFromBiblionumber
($biblionumber);
53 my @subscriptions = GetSubscriptions
( $dat->{title
}, $dat->{issn
}, $biblionumber );
56 foreach my $subscription (@subscriptions) {
58 $cell{subscriptionid
} = $subscription->{subscriptionid
};
59 $cell{subscriptionnotes
} = $subscription->{notes
};
61 #get the three latest serials.
62 $cell{latestserials
} =
63 GetLatestSerials
( $subscription->{subscriptionid
}, 3 );
67 $dat->{'count'} = @items;
70 foreach my $itm (@items) {
72 unless ( ( $itm->{'notforloan'} > 0 )
73 || ( $itm->{'itemnotforloan'} > 0 ) );
74 $itm->{ $itm->{'publictype'} } = 1;
77 $template->param( norequests
=> $norequests );
79 ## get notes and subjects from MARC record
80 my $dbh = C4
::Context
->dbh;
81 my $marcflavour = C4
::Context
->preference("marcflavour");
82 my $record = GetMarcBiblio
($biblionumber);
83 my $marcnotesarray = GetMarcNotes
( $record, $marcflavour );
84 my $marcauthorsarray = GetMarcAuthors
( $record, $marcflavour );
85 my $marcsubjctsarray = GetMarcSubjects
( $record, $marcflavour );
88 MARCNOTES
=> $marcnotesarray,
89 MARCSUBJCTS
=> $marcsubjctsarray,
90 MARCAUTHORS
=> $marcauthorsarray
93 my @results = ( $dat, );
94 foreach ( keys %{$dat} ) {
95 $template->param( "$_" => $dat->{$_} . "" );
99 ITEM_RESULTS
=> \
@items,
100 biblionumber
=> $biblionumber,
102 subscriptions
=> \
@subs,
103 subscriptionsnumber
=> $subscriptionsnumber,
104 subscriptiontitle
=> $dat->{title
},
108 my $xisbn=$dat->{'isbn'};
109 $xisbn =~ s/(p|-| |:)//g;
110 $template->param(amazonisbn
=> $xisbn);
111 if (C4
::Context
->preference("FRBRizeEditions")==1) {
115 XISBNS
=> get_xisbns
($xisbn)
118 if ($@
) { warn "XISBN Failed $@"; }
120 if ( C4
::Context
->preference("AmazonContent") == 1 ) {
121 my $amazon_details = &get_amazon_details
( $xisbn );
122 foreach my $result ( @
{ $amazon_details->{Details
} } ) {
123 $template->param( item_description
=> $result->{ProductDescription
} );
124 $template->param( image
=> $result->{ImageUrlMedium
} );
125 $template->param( list_price
=> $result->{ListPrice
} );
126 $template->param( amazon_url
=> $result->{url
} );
131 for my $details ( @
{ $amazon_details->{Details
} } ) {
132 next unless $details->{SimilarProducts
};
133 for my $product ( @
{ $details->{SimilarProducts
}->{Product
} } ) {
134 if (C4
::Context
->preference("AmazonSimilarItems") ) {
138 if (C4
::Context
->preference("XISBNAmazonSimilarItems") ) {
139 my $xbiblio = get_biblio_from_xisbn
($product);
140 push @xisbns, $xbiblio;
141 $xbiblios = \
@xisbns;
144 $xbiblios = get_xisbns
($product);
146 push @products, +{ product
=> $xbiblios };
149 next unless $details->{Reviews
};
150 for my $product ( @
{ $details->{Reviews
}->{AvgCustomerRating
} } ) {
151 $template->param( rating
=> $product * 20 );
153 for my $reviews ( @
{ $details->{Reviews
}->{CustomerReview
} } ) {
156 summary
=> $reviews->{Summary
},
157 comment
=> $reviews->{Comment
},
161 $template->param( SIMILAR_PRODUCTS
=> \
@products );
162 $template->param( AMAZONREVIEWS
=> \
@reviews );
165 output_html_with_http_headers
$query, $cookie, $template->output;