View | Details | Raw Unified | Return to bug 8025
Collapse All | Expand All

(-)a/C4/Koha.pm (-11 / +13 lines)
Lines 1008-1029 C<$opac> If set to a true value, displays OPAC descriptions rather than normal o Link Here
1008
1008
1009
sub GetAuthorisedValues {
1009
sub GetAuthorisedValues {
1010
    my ($category,$selected,$opac) = @_;
1010
    my ($category,$selected,$opac) = @_;
1011
	my @results;
1011
    my @results;
1012
    my $dbh      = C4::Context->dbh;
1012
    my $dbh      = C4::Context->dbh;
1013
    my $query    = "SELECT * FROM authorised_values";
1013
    my $query    = "SELECT * FROM authorised_values";
1014
    $query .= " WHERE category = '" . $category . "'" if $category;
1014
    $query .= " WHERE category = '" . $category . "'" if $category;
1015
    $query .= " ORDER BY category, lib, lib_opac";
1015
    $query .= " ORDER BY category, lib, lib_opac";
1016
    my $sth = $dbh->prepare($query);
1016
    my $sth = $dbh->prepare($query);
1017
    $sth->execute;
1017
    $sth->execute;
1018
	while (my $data=$sth->fetchrow_hashref) {
1018
    while (my $data=$sth->fetchrow_hashref) {
1019
	    if ($selected && $selected eq $data->{'authorised_value'} ) {
1019
        if ( (defined($selected)) && ($selected eq $data->{'authorised_value'}) ) {
1020
		    $data->{'selected'} = 1;
1020
            $data->{'selected'} = 1;
1021
	    }
1021
        }
1022
	    if ($opac && $data->{'lib_opac'}) {
1022
        else {
1023
		$data->{'lib'} = $data->{'lib_opac'};
1023
            $data->{'selected'} = 0;
1024
	    }
1024
        }
1025
	    push @results, $data;
1025
        if ($opac && $data->{'lib_opac'}) {
1026
	}
1026
            $data->{'lib'} = $data->{'lib_opac'};
1027
        }
1028
        push @results, $data;
1029
    }
1027
    #my $data = $sth->fetchall_arrayref({});
1030
    #my $data = $sth->fetchall_arrayref({});
1028
    return \@results; #$data;
1031
    return \@results; #$data;
1029
}
1032
}
1030
- 

Return to bug 8025