---
 C4/Koha.pm |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/C4/Koha.pm b/C4/Koha.pm
index 0192989..a028937 100644
--- a/C4/Koha.pm
+++ b/C4/Koha.pm
@@ -1008,22 +1008,25 @@ C<$opac> If set to a true value, displays OPAC 
descriptions rather than normal o
 
 sub GetAuthorisedValues {
     my ($category,$selected,$opac) = @_;
-       my @results;
+    my @results;
     my $dbh      = C4::Context->dbh;
     my $query    = "SELECT * FROM authorised_values";
     $query .= " WHERE category = '" . $category . "'" if $category;
     $query .= " ORDER BY category, lib, lib_opac";
     my $sth = $dbh->prepare($query);
     $sth->execute;
-       while (my $data=$sth->fetchrow_hashref) {
-           if ($selected && $selected eq $data->{'authorised_value'} ) {
-                   $data->{'selected'} = 1;
-           }
-           if ($opac && $data->{'lib_opac'}) {
-               $data->{'lib'} = $data->{'lib_opac'};
-           }
-           push @results, $data;
-       }
+    while (my $data=$sth->fetchrow_hashref) {
+        if ( (defined($selected)) && ($selected eq 
$data->{'authorised_value'}) ) {
+            $data->{'selected'} = 1;
+        }
+        else {
+            $data->{'selected'} = 0;
+        }
+        if ($opac && $data->{'lib_opac'}) {
+            $data->{'lib'} = $data->{'lib_opac'};
+        }
+        push @results, $data;
+    }
     #my $data = $sth->fetchall_arrayref({});
     return \@results; #$data;
 }
-- 
1.7.4.1

_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to