3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
23 opac-ISBDdetail.pl : script to show a biblio in ISBD format
28 This script needs a biblionumber as parameter
32 The template is in <templates_dir>/catalogue/ISBDdetail.tmpl.
33 this template must be divided into 11 "tabs".
35 The first 10 tabs present the biblio, the 11th one presents
36 the items attached to the biblio
54 use C4::External::Amazon;
56 use C4::Serials; # uses getsubscriptionfrom biblionumber
57 use C4::Koha; # use getitemtypeinfo
58 use C4::Members; # GetMember
60 my $query = CGI->new();
61 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
63 template_name => "opac-ISBDdetail.tmpl",
71 my $biblionumber = $query->param('biblionumber');
73 my $marcflavour = C4::Context->preference("marcflavour");
74 my $record = GetMarcBiblio($biblionumber);
76 #coping with subscriptions
77 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
78 my $dbh = C4::Context->dbh;
79 my $dat = TransformMarcToKoha( $dbh, $record );
81 GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );
83 foreach my $subscription (@subscriptions) {
85 $cell{subscriptionid} = $subscription->{subscriptionid};
86 $cell{subscriptionnotes} = $subscription->{notes};
87 $cell{branchcode} = $subscription->{branchcode};
89 #get the three latest serials.
90 $cell{latestserials} =
91 GetLatestSerials( $subscription->{subscriptionid}, 3 );
96 subscriptions => \@subs,
97 subscriptionsnumber => $subscriptionsnumber,
100 # my @blocs = split /\@/,$ISBD;
101 # my @fields = $record->fields();
102 my $res = GetISBDView($biblionumber);
104 my $reviews = getreviews( $biblionumber, 1 );
105 foreach ( @$reviews ) {
106 my $borrower_number_review = $_->{borrowernumber};
107 my $borrowerData = GetMember($borrower_number_review,'borrowernumber');
108 # setting some borrower info into this hash
109 $_->{title} = $borrowerData->{'title'};
110 $_->{surname} = $borrowerData->{'surname'};
111 $_->{firstname} = $borrowerData->{'firstname'};
117 biblionumber => $biblionumber,
121 my $amazon_reviews = C4::Context->preference("AmazonReviews");
122 my $amazon_similars = C4::Context->preference("AmazonSimilarItems");
124 if ( $amazon_reviews ) {
125 $template->param( AmazonReviews => 1 );
126 push( @services, 'EditorialReview' );
128 if ( $amazon_similars ) {
129 $template->param( AmazonSimilarItems => 1 );
130 push( @services, 'Similarities' );
134 #not used unless preference set
135 if ( C4::Context->preference("AmazonContent") == 1 ) {
136 use C4::External::Amazon;
137 $dat->{'amazonisbn'} = $dat->{'isbn'};
138 $dat->{'amazonisbn'} =~ s|-||g;
140 $template->param( amazonisbn => $dat->{amazonisbn} );
142 my $amazon_details = &get_amazon_details( $dat->{amazonisbn}, $record, $marcflavour );
144 foreach my $result ( @{ $amazon_details->{Details} } ) {
145 $template->param( item_description => $result->{ProductDescription} );
146 $template->param( image => $result->{ImageUrlMedium} );
147 $template->param( list_price => $result->{ListPrice} );
148 $template->param( amazon_url => $result->{url} );
153 for my $details ( @{ $amazon_details->{Details} } ) {
154 next unless $details->{SimilarProducts};
155 for my $product ( @{ $details->{SimilarProducts}->{Product} } ) {
156 push @products, +{ Product => $product };
158 next unless $details->{Reviews};
159 for my $product ( @{ $details->{Reviews}->{AvgCustomerRating} } ) {
160 $template->param( rating => $product * 20 );
162 for my $reviews ( @{ $details->{Reviews}->{CustomerReview} } ) {
165 Summary => $reviews->{Summary},
166 Comment => $reviews->{Comment},
170 $template->param( SIMILAR_PRODUCTS => \@products );
171 $template->param( AMAZONREVIEWS => \@reviews );
174 output_html_with_http_headers $query, $cookie, $template->output;