From 90a5a7dc687a4742430d3ecb2dc65eb3e8d8cab9 Mon Sep 17 00:00:00 2001 From: kados Date: Sun, 21 May 2006 02:17:02 +0000 Subject: [PATCH] syncing dev-week and HEAD --- opac/opac-detail.pl | 83 ++++++++++++++++++++++++++------------------ opac/opac-reserve.pl | 12 +++---- 2 files changed, 54 insertions(+), 41 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 26fedc61a5..46f0de1a0a 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -32,7 +32,19 @@ my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber); my ($websitecount, @websites) = &getwebsites($biblionumber); my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber); -my @title; + #coping with subscriptions + my $subscriptionsnumber = getsubscriptionfrombiblionumber($biblionumber); + my @subscriptions = getsubscriptions($dat->{title},$dat->{issn},$biblionumber); + my @subs; + foreach my $subscription (@subscriptions){ + my %cell; + $cell{subscriptionid}= $subscription->{subscriptionid}; + $cell{subscriptionnotes}= $subscription->{notes}; + #get the three latest serials. + $cell{latestserials}=getlatestserials($subscription->{subscriptionid},3); + push @subs, \%cell; + } + $dat->{'count'}=@items; my @author; if ($dat->{'author'}){ @@ -124,38 +136,43 @@ $template->param(BIBLIO_RESULTS => $resultsarray, LibraryName => C4::Context->preference("LibraryName"), suggestion => C4::Context->preference("suggestion"), virtualshelves => C4::Context->preference("virtualshelves"), - titlewords => $titlewords, - authorwords => $authorwords, + titlewords => $titlewords, + authorwords => $authorwords, ); - ## Amazon.com stuff -=head -my $isbn=$dat->{'isbn'}; -my $amazon_details = &get_amazon_details($isbn); -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); - } - for my $reviews ( @{ $details->{ Reviews }->{ CustomerReview } } ) { - push @reviews, +{ Summary => $reviews->{ Summary }, Comment => $reviews->{ Comment }, }; - } +## Amazon.com stuff +#not used unless preference set +if (C4::Context->preference("AmazonContent")==1) { + use C4::Amazon; + $dat->{'amazonisbn'}=$dat->{'isbn'}; + $dat->{'amazonisbn'} =~ s|-||g; + + $template->param( amazonisbn => $dat->{amazonisbn} ); + + my $amazon_details = &get_amazon_details($dat->{amazonisbn}); + + 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); + } + for my $reviews ( @{ $details->{ Reviews }->{ CustomerReview } } ) { + push @reviews, +{ Summary => $reviews->{ Summary }, Comment => $reviews->{ Comment }, }; + } + } + $template->param( SIMILAR_PRODUCTS => \@products ); + $template->param( REVIEWS => \@reviews ); } -$template->param( SIMILAR_PRODUCTS => \@products ); -$template->param( REVIEWS => \@reviews ); - ## End of Amazon Stuff -=cut output_html_with_http_headers $query, $cookie, $template->output; - diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 888c88dea5..95d1cfdf95 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -74,16 +74,15 @@ my @CGIbranchlooparray; foreach my $branch (keys %$branches) { if ($branch) { my %line; - $line{branch} = $branches->{$branch}->{'branchname'}; - $line{value} = $branch; - push @CGIbranchlooparray, \%line; + $line{branch} = $branches->{$branch}->{'branchname'}; + $line{value} = $branch; + push @CGIbranchlooparray, \%line; } } @CGIbranchlooparray = sort {$a->{branch} cmp $b->{branch}} @CGIbranchlooparray; my $CGIbranchloop = \@CGIbranchlooparray; $template->param( CGIbranch => $CGIbranchloop); - #### THIS IS A BIT OF A HACK BECAUSE THE BIBLIOITEMS DATA IS A LITTLE MESSED UP! # get the itemtype data.... my @items = ItemInfo(undef, $biblionumber, 'opac'); @@ -175,9 +174,6 @@ for (my $rownum=0;$rownum<$publictypes[0]->{'count'} ;$rownum++) { $template->param(TYPE_ROWS => \@typerows); $width = 2*$width -1; $template->param(totalwidth => 2*$width-1, - LibraryName => C4::Context->preference("LibraryName"), - suggestion => C4::Context->preference("suggestion"), - virtualshelves => C4::Context->preference("virtualshelves"), ); if ($query->param('item_types_selected')) { @@ -239,7 +235,7 @@ if ($query->param('item_types_selected')) { } else { # Here we check that the borrower can actually make reserves Stage 1. my $noreserves = 0; - my $maxoutstanding = C4::Context->preference("maxoustanding"); + my $maxoutstanding = C4::Context->preference("maxoutstanding"); $template->param(noreserve => 1) unless $maxoutstanding; if ($borr->{'amountoutstanding'} > $maxoutstanding) { my $amount = sprintf "\$%.02f", $borr->{'amountoutstanding'}; -- 2.39.5