X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=opac%2Fopac-ISBDdetail.pl;h=94055a993af5fa1747bc689aa64aac80d6e2e529;hb=afccbfcce7192c6e1fcd73f137135cb5289c3d3d;hp=9b5c031172ae2d37ade61f38bbb76fa3262ae116;hpb=f245998ac964881e9cc2b36434860c55698e8701;p=koha.git diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 9b5c031172..94055a993a 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl # Copyright 2000-2002 Katipo Communications +# parts copyright 2010 BibLibre # # This file is part of Koha. # @@ -20,8 +21,7 @@ =head1 NAME -opac-ISBDdetail.pl : script to show a biblio in ISBD format - +opac-ISBDdetail.pl - script to show a biblio in ISBD format =head1 DESCRIPTION @@ -37,8 +37,6 @@ the items attached to the biblio =head1 FUNCTIONS -=over 2 - =cut use strict; @@ -50,12 +48,12 @@ use C4::Output; use CGI; use MARC::Record; use C4::Biblio; +use C4::Items; use C4::Acquisition; use C4::Review; use C4::Serials; # uses getsubscriptionfrom biblionumber use C4::Koha; use C4::Members; # GetMember -use C4::External::Amazon; my $query = CGI->new(); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -63,12 +61,24 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( template_name => "opac-ISBDdetail.tmpl", query => $query, type => "opac", - authnotrequired => 1, + authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), debug => 1, } ); my $biblionumber = $query->param('biblionumber'); +$biblionumber = int($biblionumber); + +# get biblionumbers stored in the cart +my @cart_list; + +if($query->cookie("bib_list")){ + my $cart_list = $query->cookie("bib_list"); + @cart_list = split(/\//, $cart_list); + if ( grep {$_ eq $biblionumber} @cart_list) { + $template->param( incart => 1 ); + } +} $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); @@ -86,7 +96,10 @@ my $upc = GetNormalizedUPC($record,$marcflavour); my $ean = GetNormalizedEAN($record,$marcflavour); my $oclc = GetNormalizedOCLCNumber($record,$marcflavour); my $isbn = GetNormalizedISBN(undef,$record,$marcflavour); -my $content_identifier_exists = 1 if ($isbn or $ean or $oclc or $upc); +my $content_identifier_exists; +if ( $isbn or $ean or $oclc or $upc ) { + $content_identifier_exists = 1; +} $template->param( normalized_upc => $upc, normalized_ean => $ean, @@ -99,8 +112,8 @@ $template->param( my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber); my $dbh = C4::Context->dbh; my $dat = TransformMarcToKoha( $dbh, $record ); -my @subscriptions = - GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber ); + +my @subscriptions = GetSubscriptions( $dat->{title}, $dat->{issn}, undef, $biblionumber ); my @subs; foreach my $subscription (@subscriptions) { my %cell; @@ -123,9 +136,19 @@ $template->param( subscriptionsnumber => $subscriptionsnumber, ); -# my @blocs = split /\@/,$ISBD; -# my @fields = $record->fields(); +my $norequests = 1; my $res = GetISBDView($biblionumber, "opac"); +my @items = GetItemsInfo( $biblionumber ); + +my $itemtypes = GetItemTypes(); +for my $itm (@items) { + $norequests = 0 + if ( (not $itm->{'wthdrawn'} ) + && (not $itm->{'itemlost'} ) + && ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} ) + && (not $itemtypes->{$itm->{'itype'}}->{notforloan} ) + && ($itm->{'itemnumber'} ) ); +} my $reviews = getreviews( $biblionumber, 1 ); foreach ( @$reviews ) { @@ -139,45 +162,39 @@ foreach ( @$reviews ) { $template->param( + RequestOnOpac => C4::Context->preference("RequestOnOpac"), + AllowOnShelfHolds => C4::Context->preference('AllowOnShelfHolds'), + norequests => $norequests, ISBD => $res, biblionumber => $biblionumber, reviews => $reviews, ); -## Amazon.com stuff -#not used unless preference set -if ( C4::Context->preference("OPACAmazonEnabled") == 1 ) { - - my $amazon_details = &get_amazon_details( $isbn, $record, $marcflavour ); - - foreach my $result ( @{ $amazon_details->{Details} } ) { - $template->param( item_description => $result->{ProductDescription} ); - $template->param( image => $result->{ImageUrlMedium} ); - $template->param( list_price => $result->{ListPrice} ); - $template->param( amazon_url => $result->{url} ); - } - - my @products; - my @reviews; - for my $details ( @{ $amazon_details->{Details} } ) { - next unless $details->{SimilarProducts}; - for my $product ( @{ $details->{SimilarProducts}->{Product} } ) { - push @products, +{ Product => $product }; - } - next unless $details->{Reviews}; - for my $product ( @{ $details->{Reviews}->{AvgCustomerRating} } ) { - $template->param( rating => $product * 20 ); +#Export options +my $OpacExportOptions=C4::Context->preference("OpacExportOptions"); +my @export_options = split(/\|/,$OpacExportOptions); +$template->{VARS}->{'export_options'} = \@export_options; + +#Search for title in links +my $marccontrolnumber = GetMarcControlnumber ($record, $marcflavour); +my $marcissns = GetMarcISSN ( $record, $marcflavour ); +my $issn = $marcissns->[0] || ''; + +if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ + $dat->{title} =~ s/\/+$//; # remove trailing slash + $dat->{title} =~ s/\s+$//; # remove trailing space + $search_for_title = parametrized_url( + $search_for_title, + { + TITLE => $dat->{title}, + AUTHOR => $dat->{author}, + ISBN => $isbn, + ISSN => $issn, + CONTROLNUMBER => $marccontrolnumber, + BIBLIONUMBER => $biblionumber, } - for my $reviews ( @{ $details->{Reviews}->{CustomerReview} } ) { - push @reviews, - +{ - Summary => $reviews->{Summary}, - Comment => $reviews->{Comment}, - }; - } - } - $template->param( SIMILAR_PRODUCTS => \@products ); - $template->param( AMAZONREVIEWS => \@reviews ); + ); + $template->param('OPACSearchForTitleIn' => $search_for_title); } output_html_with_http_headers $query, $cookie, $template->output;