Fixing Hierarchies : taking any heading subfield
[koha.git] / catalogue / detail.pl
index a8a0cfa..a615f16 100755 (executable)
@@ -34,6 +34,7 @@ use C4::Members;
 use C4::Serials;
 use C4::XISBN qw(get_xisbns get_biblionumber_from_isbn get_biblio_from_xisbn);
 use C4::External::Amazon;
+use C4::Search;                # enabled_staff_search_views
 
 # use Smart::Comments;
 
@@ -65,7 +66,7 @@ my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
 my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
 my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
 my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
-my $subtitle         = C4::Biblio::get_koha_field_from_marc('bibliosubtitle', 'subtitle', $record, '');
+my $subtitle         = GetRecordValue('subtitle', $record, $fw);
 
 # Get Branches, Itemtypes and Locations
 my $branches = GetBranches();
@@ -177,6 +178,8 @@ $template->param(
        itemdata_uri        => $itemfields{uri},
        itemdata_copynumber => $itemfields{copynumber},
        volinfo                         => $itemfields{enumchron} || $dat->{'serial'} ,
+       z3950_search_params     => C4::Search::z3950_search_args($dat),
+       C4::Search::enabled_staff_search_views,
 );
 
 my @results = ( $dat, );
@@ -184,6 +187,9 @@ foreach ( keys %{$dat} ) {
     $template->param( "$_" => defined $dat->{$_} ? $dat->{$_} : '' );
 }
 
+# does not work: my %views_enabled = map { $_ => 1 } $template->query(loop => 'EnableViews');
+# method query not found?!?!
+
 $template->param(
     itemloop        => \@itemloop,
     biblionumber        => $biblionumber,
@@ -208,10 +214,12 @@ if (C4::Context->preference("FRBRizeEditions")==1) {
     };
     if ($@) { warn "XISBN Failed $@"; }
 }
+
 if ( C4::Context->preference("AmazonEnabled") == 1 ) {
     $template->param( AmazonTld => get_amazon_tld() );
     my $amazon_reviews  = C4::Context->preference("AmazonReviews");
     my $amazon_similars = C4::Context->preference("AmazonSimilarItems");
+    my $isbn = $dat->{'isbn'};
     my @services;
     if ( $amazon_reviews ) {
         $template->param( AmazonReviews => 1 );
@@ -240,18 +248,11 @@ if ( C4::Context->preference("AmazonEnabled") == 1 ) {
     if ( $amazon_reviews ) {
         my $item = $amazon_details->{Items}->{Item}->[0];
         my $editorial_reviews = \@{ $item->{EditorialReviews}->{EditorialReview} };
-        #my $customer_reviews  = \@{$amazon_details->{Items}->{Item}->[0]->{CustomerReviews}->{Review}};
-        #my $average_rating = $amazon_details->{Items}->{Item}->[0]->{CustomerReviews}->{AverageRating} || 0;
-        #$template->param( amazon_average_rating    => $average_rating * 20    );
-        #$template->param( AMAZON_CUSTOMER_REVIEWS  => $customer_reviews       );
+        my $customer_reviews  = \@{$amazon_details->{Items}->{Item}->[0]->{CustomerReviews}->{Review}};
+        my $average_rating = $amazon_details->{Items}->{Item}->[0]->{CustomerReviews}->{AverageRating} || 0;
+        $template->param( amazon_average_rating    => $average_rating * 20    );
+        $template->param( AMAZON_CUSTOMER_REVIEWS  => $customer_reviews       );
         $template->param( AMAZON_EDITORIAL_REVIEWS => $editorial_reviews      );
     }
-    my $editorial_reviews = \@{$amazon_details->{Items}->{Item}->{EditorialReviews}->{EditorialReview}};
-    my $average_rating    =    $amazon_details->{Items}->{Item}->{CustomerReviews}->{AverageRating} || 0;
-    $template->param( AmazonSimilarItems       => $similar_products_exist );
-    $template->param( amazon_average_rating    => $average_rating * 20    );
-    $template->param( AMAZON_CUSTOMER_REVIEWS  => $customer_reviews       );
-    $template->param( AMAZON_SIMILAR_PRODUCTS  => \@similar_products      );
-    $template->param( AMAZON_EDITORIAL_REVIEWS => $editorial_reviews      );
 }
 output_html_with_http_headers $query, $cookie, $template->output;