Bug 21503: Changed logic for checking values
authorChristopher Brannon <cbrannon@cdalibrary.org>
Wed, 17 Oct 2018 21:19:43 +0000 (21:19 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 24 Mar 2020 11:29:55 +0000 (11:29 +0000)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha/Template/Plugin/AuthorisedValues.pm

index b15136e..ae90288 100644 (file)
@@ -81,13 +81,17 @@ sub GetDescriptionByKohaField {
             authorised_value => $params->{authorised_value},
         }
     );
-    return %$av
-            ? $params->{opac}
-                ? $av->{opac_description}
-                : $av->{lib}
-            : $params->{authorised_value}
-                ? $params->{authorised_value}
-                : ''
+    my $av_check = $params->{authorised_value};
+    if ($params->{opac}) {
+        if ($av->{opac_description}) {
+            $av_check = $av->{opac_description}
+        } elsif ($av->{lib}) {
+            $av_check = $av->{lib}
+        }
+    } elsif ($av->{lib}) {
+        $av_check = $av->{lib}
+    }
+    return $av_check
 }
 
 1;