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
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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
55 use C4
::Serials
; # uses getsubscriptionfrom biblionumber
57 use C4
::Members
; # GetMember
58 use C4
::External
::Amazon
;
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 $template->param( 'AllowOnShelfHolds' => C4
::Context
->preference('AllowOnShelfHolds') );
74 $template->param( 'ItemsIssued' => CountItemsIssued
( $biblionumber ) );
76 my $marcflavour = C4
::Context
->preference("marcflavour");
77 my $record = GetMarcBiblio
($biblionumber);
79 # some useful variables for enhanced content;
80 # in each case, we're grabbing the first value we find in
81 # the record and normalizing it
82 my $upc = GetNormalizedUPC
($record,$marcflavour);
83 my $ean = GetNormalizedEAN
($record,$marcflavour);
84 my $oclc = GetNormalizedOCLCNumber
($record,$marcflavour);
85 my $isbn = GetNormalizedISBN
(undef,$record,$marcflavour);
86 my $content_identifier_exists = 1 if ($isbn or $ean or $oclc or $upc);
88 normalized_upc
=> $upc,
89 normalized_ean
=> $ean,
90 normalized_oclc
=> $oclc,
91 normalized_isbn
=> $isbn,
92 content_identifier_exists
=> $content_identifier_exists,
95 #coping with subscriptions
96 my $subscriptionsnumber = CountSubscriptionFromBiblionumber
($biblionumber);
97 my $dbh = C4
::Context
->dbh;
98 my $dat = TransformMarcToKoha
( $dbh, $record );
100 GetSubscriptions
( $dat->{title
}, $dat->{issn
}, $biblionumber );
102 foreach my $subscription (@subscriptions) {
104 my $serials_to_display;
105 $cell{subscriptionid
} = $subscription->{subscriptionid
};
106 $cell{subscriptionnotes
} = $subscription->{notes
};
107 $cell{branchcode
} = $subscription->{branchcode
};
109 #get the three latest serials.
110 $serials_to_display = $subscription->{opacdisplaycount
};
111 $serials_to_display = C4
::Context
->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
112 $cell{opacdisplaycount
} = $serials_to_display;
113 $cell{latestserials
} =
114 GetLatestSerials
( $subscription->{subscriptionid
}, $serials_to_display );
119 subscriptions
=> \
@subs,
120 subscriptionsnumber
=> $subscriptionsnumber,
123 # my @blocs = split /\@/,$ISBD;
124 # my @fields = $record->fields();
125 my $res = GetISBDView
($biblionumber, "opac");
127 my $reviews = getreviews
( $biblionumber, 1 );
128 foreach ( @
$reviews ) {
129 my $borrower_number_review = $_->{borrowernumber
};
130 my $borrowerData = GetMember
('borrowernumber' =>$borrower_number_review);
131 # setting some borrower info into this hash
132 $_->{title
} = $borrowerData->{'title'};
133 $_->{surname
} = $borrowerData->{'surname'};
134 $_->{firstname
} = $borrowerData->{'firstname'};
140 biblionumber
=> $biblionumber,
145 #not used unless preference set
146 if ( C4
::Context
->preference("OPACAmazonEnabled") == 1 ) {
148 my $amazon_details = &get_amazon_details
( $isbn, $record, $marcflavour );
150 foreach my $result ( @
{ $amazon_details->{Details
} } ) {
151 $template->param( item_description
=> $result->{ProductDescription
} );
152 $template->param( image
=> $result->{ImageUrlMedium
} );
153 $template->param( list_price
=> $result->{ListPrice
} );
154 $template->param( amazon_url
=> $result->{url
} );
159 for my $details ( @
{ $amazon_details->{Details
} } ) {
160 next unless $details->{SimilarProducts
};
161 for my $product ( @
{ $details->{SimilarProducts
}->{Product
} } ) {
162 push @products, +{ Product
=> $product };
164 next unless $details->{Reviews
};
165 for my $product ( @
{ $details->{Reviews
}->{AvgCustomerRating
} } ) {
166 $template->param( rating
=> $product * 20 );
168 for my $reviews ( @
{ $details->{Reviews
}->{CustomerReview
} } ) {
171 Summary
=> $reviews->{Summary
},
172 Comment
=> $reviews->{Comment
},
176 $template->param( SIMILAR_PRODUCTS
=> \
@products );
177 $template->param( AMAZONREVIEWS
=> \
@reviews );
180 output_html_with_http_headers
$query, $cookie, $template->output;