Lines 1008-1013
C<$opac> If set to a true value, displays OPAC descriptions rather than normal o
Link Here
|
1008 |
|
1008 |
|
1009 |
=cut |
1009 |
=cut |
1010 |
|
1010 |
|
|
|
1011 |
sub _AddSelectedAuthVal { |
1012 |
my ( $authorised_values, $selected ) = @_; |
1013 |
foreach my $data ( @$authorised_values ) { |
1014 |
$data->{selected} = $selected eq $data->{authorised_value} ? 1 : 0; |
1015 |
} |
1016 |
} |
1017 |
|
1011 |
sub GetAuthorisedValues { |
1018 |
sub GetAuthorisedValues { |
1012 |
my ( $category, $opac ) = @_; |
1019 |
my ( $category, $opac ) = @_; |
1013 |
|
1020 |
|
Lines 1019-1025
sub GetAuthorisedValues {
Link Here
|
1019 |
"AuthorisedValues-$category-$opac-$branch_limit"; |
1026 |
"AuthorisedValues-$category-$opac-$branch_limit"; |
1020 |
my $cache = Koha::Cache->get_instance(); |
1027 |
my $cache = Koha::Cache->get_instance(); |
1021 |
my $result = $cache->get_from_cache($cache_key); |
1028 |
my $result = $cache->get_from_cache($cache_key); |
1022 |
return $result if $result; |
1029 |
if ($result) { |
|
|
1030 |
_AddSelectedAuthVal( $result, $selected ) if defined $selected; |
1031 |
return $result; |
1032 |
} |
1023 |
|
1033 |
|
1024 |
my @results; |
1034 |
my @results; |
1025 |
my $dbh = C4::Context->dbh; |
1035 |
my $dbh = C4::Context->dbh; |
Lines 1060-1066
sub GetAuthorisedValues {
Link Here
|
1060 |
} |
1070 |
} |
1061 |
$sth->finish; |
1071 |
$sth->finish; |
1062 |
|
1072 |
|
1063 |
$cache->set_in_cache( $cache_key, \@results, { deepcopy => 1, expiry => 5 } ); |
1073 |
$cache->set_in_cache( $cache_key, \@results ); |
|
|
1074 |
_AddSelectedAuthVal( \@results, $selected ); |
1064 |
return \@results; |
1075 |
return \@results; |
1065 |
} |
1076 |
} |
1066 |
|
1077 |
|