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
53 use C4::Serials; # uses getsubscriptionfrom biblionumber
54 use C4::Koha; # use getitemtypeinfo
55 use C4::Members; # GetMember
57 my $query = CGI->new();
58 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
60 template_name => "opac-ISBDdetail.tmpl",
68 my $biblionumber = $query->param('biblionumber');
70 my $marcflavour = C4::Context->preference("marcflavour");
71 my $record = GetMarcBiblio($biblionumber);
73 #coping with subscriptions
74 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
75 my $dbh = C4::Context->dbh;
76 my $dat = TransformMarcToKoha( $dbh, $record );
78 GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );
80 foreach my $subscription (@subscriptions) {
82 $cell{subscriptionid} = $subscription->{subscriptionid};
83 $cell{subscriptionnotes} = $subscription->{notes};
84 $cell{branchcode} = $subscription->{branchcode};
86 #get the three latest serials.
87 $cell{latestserials} =
88 GetLatestSerials( $subscription->{subscriptionid}, 3 );
93 subscriptions => \@subs,
94 subscriptionsnumber => $subscriptionsnumber,
97 # my @blocs = split /\@/,$ISBD;
98 # my @fields = $record->fields();
99 my $res = GetISBDView($biblionumber);
101 my $reviews = getreviews( $biblionumber, 1 );
102 foreach ( @$reviews ) {
103 my $borrower_number_review = $_->{borrowernumber};
104 my $borrowerData = GetMember($borrower_number_review,'borrowernumber');
105 # setting some borrower info into this hash
106 $_->{title} = $borrowerData->{'title'};
107 $_->{surname} = $borrowerData->{'surname'};
108 $_->{firstname} = $borrowerData->{'firstname'};
114 biblionumber => $biblionumber,
119 #not used unless preference set
120 if ( C4::Context->preference("AmazonContent") == 1 ) {
122 $dat->{'amazonisbn'} = $dat->{'isbn'};
123 $dat->{'amazonisbn'} =~ s|-||g;
125 $template->param( amazonisbn => $dat->{amazonisbn} );
127 my $amazon_details = &get_amazon_details( $dat->{amazonisbn}, $record, $marcflavour );
129 foreach my $result ( @{ $amazon_details->{Details} } ) {
130 $template->param( item_description => $result->{ProductDescription} );
131 $template->param( image => $result->{ImageUrlMedium} );
132 $template->param( list_price => $result->{ListPrice} );
133 $template->param( amazon_url => $result->{url} );
138 for my $details ( @{ $amazon_details->{Details} } ) {
139 next unless $details->{SimilarProducts};
140 for my $product ( @{ $details->{SimilarProducts}->{Product} } ) {
141 push @products, +{ Product => $product };
143 next unless $details->{Reviews};
144 for my $product ( @{ $details->{Reviews}->{AvgCustomerRating} } ) {
145 $template->param( rating => $product * 20 );
147 for my $reviews ( @{ $details->{Reviews}->{CustomerReview} } ) {
150 Summary => $reviews->{Summary},
151 Comment => $reviews->{Comment},
155 $template->param( SIMILAR_PRODUCTS => \@products );
156 $template->param( AMAZONREVIEWS => \@reviews );
159 output_html_with_http_headers $query, $cookie, $template->output;