Bug 5453 Move declarations out of conditionals in opac
[koha_ffzg] / opac / opac-detail.pl
index 0510917..e18e046 100755 (executable)
@@ -281,7 +281,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,
@@ -295,11 +298,10 @@ $template->param(
     ocoins => GetCOinSBiblio($biblionumber),
 );
 
-my $libravatar_available = 0;
-
+my $libravatar_enabled = 0;
 eval 'use Libravatar::URL';
-if (! $@) {
-    $libravatar_available = 1;
+if (!$@ and C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowReviewerPhoto')) {
+    $libravatar_enabled = 1;
 }
 
 my $reviews = getreviews( $biblionumber, 1 );
@@ -310,7 +312,7 @@ foreach ( @$reviews ) {
     $_->{title}     = $borrowerData->{'title'};
     $_->{surname}   = $borrowerData->{'surname'};
     $_->{firstname} = $borrowerData->{'firstname'};
-    if ($libravatar_available and $borrowerData->{'email'}) {
+    if ($libravatar_enabled and $borrowerData->{'email'}) {
         $_->{avatarurl} = libravatar_url(email => $borrowerData->{'email'}, https => $ENV{HTTPS});
     }
     $_->{userid}    = $borrowerData->{'userid'};